mirror of
https://github.com/JonathanFleischmann/CompilerULTIMATE.git
synced 2024-12-28 01:58:02 +00:00
Parser bugfix
This commit is contained in:
parent
35d7733c62
commit
fb8bfb719a
@ -112,12 +112,14 @@ public class ExpressionGenerator extends DecafBaseVisitor<Expression> {
|
||||
public Expression visitNew(DecafParser.NewContext ctx) {
|
||||
Type type = ASTGenerator.getType(ctx.type());
|
||||
List<Expression> args = new ArrayList<>();
|
||||
if (ctx.args() != null) {
|
||||
if (ctx.args() != null) {
|
||||
for (var expr : ctx.args().expr()) {
|
||||
Expression astExpr = expr.accept(this);
|
||||
args.add(astExpr);
|
||||
}
|
||||
}
|
||||
}
|
||||
return new New(type, args);
|
||||
}
|
||||
|
||||
|
@ -123,10 +123,12 @@ public class StatementGenerator extends DecafBaseVisitor<List<Statement>> {
|
||||
public List<Statement> visitNew(DecafParser.NewContext ctx) {
|
||||
Type type = ASTGenerator.getType(ctx.type());
|
||||
List<Expression> args = new ArrayList<>();
|
||||
if (ctx.args() != null) {
|
||||
for (var expr : ctx.args().expr()) {
|
||||
Expression astExpr = expr.accept(new ExpressionGenerator());
|
||||
args.add(astExpr);
|
||||
}
|
||||
}
|
||||
return List.of(new New(type, args));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user