diff options
Diffstat (limited to 'src/ast/nodes/RootNode.java')
-rw-r--r-- | src/ast/nodes/RootNode.java | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/ast/nodes/RootNode.java b/src/ast/nodes/RootNode.java index e0989e8..fd33e30 100644 --- a/src/ast/nodes/RootNode.java +++ b/src/ast/nodes/RootNode.java @@ -1,6 +1,7 @@ package ast.nodes; import java.util.ArrayList; +import java.util.HashMap; import semanticanalysis.SemanticError; import semanticanalysis.SymbolTable; @@ -24,13 +25,20 @@ public class RootNode implements Node { public ArrayList<SemanticError> checkSemantics(SymbolTable ST, int _nesting) { ArrayList<SemanticError> errors = new ArrayList<SemanticError>(); - for (Node stmt : stmts) { + HashMap<String, STentry> HM = new HashMap<String, STentry>(); + + ST.add(HM); + + for (Node stmt : compoundStmts) { errors.addAll(stmt.checkSemantics(ST, _nesting)); } - for (Node stmt : compoundStmts) { + + for (Node stmt : stmts) { errors.addAll(stmt.checkSemantics(ST, _nesting)); } + ST.remove(); + return errors; } |