mirror of
https://github.com/JonathanFleischmann/CompilerULTIMATE.git
synced 2024-12-28 02:28:03 +00:00
bugfix Parser for return; statements
This commit is contained in:
parent
ca9f6cc06a
commit
ce19fcb603
@ -21,7 +21,7 @@ public class ASTGenerator {
|
|||||||
declarations = ctx.field().stream().map(ASTGenerator::generateFieldVariable).toList();
|
declarations = ctx.field().stream().map(ASTGenerator::generateFieldVariable).toList();
|
||||||
}
|
}
|
||||||
List<Constructor> constructors = new ArrayList<>();
|
List<Constructor> constructors = new ArrayList<>();
|
||||||
if (!ctx.constructor().isEmpty()) {
|
if (ctx.constructor() != null && !ctx.constructor().isEmpty()) {
|
||||||
constructors = ctx.constructor().stream().map(ASTGenerator::generateConstructor).toList();
|
constructors = ctx.constructor().stream().map(ASTGenerator::generateConstructor).toList();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -20,7 +20,7 @@ public class BlockGenerator extends DecafBaseVisitor<Block> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ctx.return_() != null){
|
if (ctx.return_() != null){
|
||||||
statements.add(ctx.return_().expr().isEmpty() ? new Return(null) : new Return(new ExpressionGenerator().visit(ctx.return_().expr())));
|
statements.add(ctx.return_().expr() == null ? new Return(null) : new Return(new ExpressionGenerator().visit(ctx.return_().expr())));
|
||||||
}
|
}
|
||||||
return new Block(statements);
|
return new Block(statements);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user