generate FieldVarAcces back to front instead of front to back

This commit is contained in:
laurenz 2024-05-12 18:18:14 +02:00
parent 48b41f67f4
commit 29a63e3771

View File

@ -115,8 +115,9 @@ public class ExpressionGenerator extends DecafBaseVisitor<Expression> {
if (ctxList.isEmpty()) {
return recipient;
}
DecafParser.RecipientContext ctx = ctxList.get(0);
ctxList.remove(0);
int lastElement = ctxList.size() - 1;
DecafParser.RecipientContext ctx = ctxList.get(lastElement);
ctxList.remove(lastElement);
if (ctx.id() != null) {
return new FieldVarAccess(false, generateRecursiveOwnerChain(ctxList, recipient), ctx.id().IDENTIFIER().getText());
}