From bc5efde8c51be14c624559ac50aafa6986650d4a Mon Sep 17 00:00:00 2001 From: nitrix Date: Thu, 5 Mar 2020 22:43:20 +0100 Subject: [PATCH] add the retrieved structs to the constructor call of the eval visitor --- src/main/java/de/hsrm/compiler/Klang/Klang.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/hsrm/compiler/Klang/Klang.java b/src/main/java/de/hsrm/compiler/Klang/Klang.java index 8b63cd1..17a5dec 100644 --- a/src/main/java/de/hsrm/compiler/Klang/Klang.java +++ b/src/main/java/de/hsrm/compiler/Klang/Klang.java @@ -87,6 +87,7 @@ public class Klang { // Context Analysis and DAST generation Node root; + HashMap structs; try { // Extract information about all functions var functionDefinitions = new HashMap(); @@ -97,7 +98,7 @@ public class Klang { new GetStructNames(structNames).visit(tree); // Extract information about all structs - var structs = new HashMap(); + structs = new HashMap(); new GetStructs(structNames, structs).visit(tree); // Create the DAST @@ -120,7 +121,7 @@ public class Klang { if (evaluate) { // Evaluate the sourcecode and print the result System.out.println("\nEvaluating the source code:"); - EvalVisitor evalVisitor = new EvalVisitor(); + EvalVisitor evalVisitor = new EvalVisitor(structs); Value result = root.welcome(evalVisitor); generateOutput(out, "Result was: " + result.asObject().toString()); return;