mirror of
https://github.com/JonathanFleischmann/CompilerULTIMATE.git
synced 2024-12-27 09:28:03 +00:00
Parser Bugfix
This commit is contained in:
parent
4d0f124057
commit
35d7733c62
@ -14,7 +14,10 @@ public class BlockGenerator extends DecafBaseVisitor<Block> {
|
||||
public Block visitBlock(DecafParser.BlockContext ctx) {
|
||||
List<Statement> statements = new ArrayList<>(ctx.stmt().size());
|
||||
for (DecafParser.StmtContext stmtContext : ctx.stmt()) {
|
||||
statements.addAll(new StatementGenerator().visit(stmtContext));
|
||||
List<Statement> statementList = new StatementGenerator().visit(stmtContext);
|
||||
if (statementList != null){
|
||||
statements.addAll(statementList);
|
||||
}
|
||||
}
|
||||
if (ctx.return_() != null){
|
||||
statements.add(ctx.return_().isEmpty() ? new Return(null) : new Return(new ExpressionGenerator().visit(ctx.return_())));
|
||||
|
@ -110,9 +110,11 @@ public class StatementGenerator extends DecafBaseVisitor<List<Statement>> {
|
||||
recursiveOwnerChain = ExpressionGenerator.generateRecursiveOwnerChain(recipientList, null);
|
||||
}
|
||||
List<Expression> args = new ArrayList<>();
|
||||
for (var expr : ctx.methCall().methName().args().expr()) {
|
||||
Expression astExpr = expr.accept(new ExpressionGenerator());
|
||||
args.add(astExpr);
|
||||
if (ctx.methCall().methName().args() != null) {
|
||||
for (var expr : ctx.methCall().methName().args().expr()) {
|
||||
Expression astExpr = expr.accept(new ExpressionGenerator());
|
||||
args.add(astExpr);
|
||||
}
|
||||
}
|
||||
return List.of(new MethodCall(new FieldVarAccess(isField, recursiveOwnerChain, ctx.methCall().methName().id().IDENTIFIER().getText()), args));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user