WIP: Add enum support

This commit is contained in:
2023-03-15 15:55:41 +01:00
parent 7c40a50196
commit 7af815042b
28 changed files with 436 additions and 255 deletions

View File

@@ -13,7 +13,8 @@ public class VariableAssignmentTest {
ParseTree tree = Helper.prepareParser("function foo(): int { x = 1; return 1; } foo();");
var funcs = Helper.getFuncs(tree);
var structs = Helper.getStructs(tree);
ContextAnalysis ctxAnal = new ContextAnalysis(funcs, structs);
var enums = Helper.getEnums(tree);
ContextAnalysis ctxAnal = new ContextAnalysis(funcs, structs, enums);
Exception e = assertThrows(RuntimeException.class, () -> ctxAnal.visit(tree));
assertEquals("Error in line 1:22 Variable with name \"x\" not defined.", e.getMessage());