fix main method null check

This commit is contained in:
404Simon 2024-05-30 23:57:34 +02:00
parent fd35b4583e
commit 0b720eedcd

View File

@ -28,7 +28,7 @@ public class ASTGenerator {
constructors.add(new Constructor(ctx.id().IDENTIFIER().getText(), List.of(), new Block(List.of())));
}
Block mainmeth = null;
if (ctx.mainmeth() != null) {
if (ctx.mainmeth().isEmpty()) {
if (ctx.mainmeth().size() > 1) {
throw new RuntimeException("Only one main method allowed!");
}