mirror of
https://github.com/JonathanFleischmann/CompilerULTIMATE.git
synced 2024-12-28 17:28:03 +00:00
Add empty constructor in parser when none is found
This commit is contained in:
parent
b3fc0c5efd
commit
a911cc10e1
@ -17,9 +17,12 @@ public class ASTGenerator {
|
||||
declarations = ctx.field().stream().map(ASTGenerator::generateFieldVariable).toList();
|
||||
}
|
||||
List<Constructor> constructors = new ArrayList<>();
|
||||
if (ctx.constructor() != null) {
|
||||
if (!ctx.constructor().isEmpty()) {
|
||||
constructors = ctx.constructor().stream().map(ASTGenerator::generateConstructor).toList();
|
||||
}
|
||||
else {
|
||||
constructors.add(new Constructor(ctx.id().IDENTIFIER().getText(), List.of(), new Block(List.of(), List.of())));
|
||||
}
|
||||
List<Method> meths = new ArrayList<>();
|
||||
if (ctx.meth() != null) {
|
||||
meths = ctx.meth().stream().map(ASTGenerator::generateMethod).toList();
|
||||
|
Loading…
Reference in New Issue
Block a user