mirror of
https://github.com/JonathanFleischmann/CompilerULTIMATE.git
synced 2024-12-27 09: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();
|
||||
}
|
||||
List<Constructor> constructors = new ArrayList<>();
|
||||
if (!ctx.constructor().isEmpty()) {
|
||||
if (ctx.constructor() != null && !ctx.constructor().isEmpty()) {
|
||||
constructors = ctx.constructor().stream().map(ASTGenerator::generateConstructor).toList();
|
||||
}
|
||||
else {
|
||||
|
@ -20,7 +20,7 @@ public class BlockGenerator extends DecafBaseVisitor<Block> {
|
||||
}
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user