fix main method null check

This commit is contained in:
404Simon 2024-05-30 23:58:01 +02:00
parent 0b720eedcd
commit ec5cb4b490

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().isEmpty()) {
if (!ctx.mainmeth().isEmpty()) {
if (ctx.mainmeth().size() > 1) {
throw new RuntimeException("Only one main method allowed!");
}