Skip to content

Commit 0106d76

Browse files
committed
field array assignment
1 parent b67ea33 commit 0106d76

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/main/pt/up/fe/comp2023/ollir/Optimization.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -374,13 +374,14 @@ private Void dealWithArrayAssignment(JmmNode jmmNode, Void unused) {
374374
visit(right);
375375

376376
if (isLocal)
377-
code += "\t\t" + left + "[" ;
377+
code += "\t\t" + left;
378378
else if (isParam)
379-
code += "\t\t$" + idParam + '.' + left + "[";
379+
code += "\t\t$" + idParam + '.' + left;
380380
else if (isField)
381-
code += "\t\tputfield(this, " + left + "[";
381+
code += "\t\tt" + tempVarId + ".array.i32 :=.array.i32 getfield(this, " + left + ".array.i32).array.i32;" +
382+
"\n\t\tt" + tempVarId++;
382383

383-
code += right.get("valueOl") + "].i32 :=.i32 ";
384+
code += "[" + right.get("valueOl") + "].i32 :=.i32 ";
384385

385386
visit(last);
386387

0 commit comments

Comments
 (0)