From b12c01732860f9727626829e0b25a273de5fe5c7 Mon Sep 17 00:00:00 2001 From: geno Date: Tue, 25 Jun 2024 16:04:07 +0200 Subject: check semantic of defined and undefined variables implemented do not check for built-in function works on the example --- src/ast/nodes/RootNode.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/ast/nodes/RootNode.java') diff --git a/src/ast/nodes/RootNode.java b/src/ast/nodes/RootNode.java index 4b7e579..45d20db 100644 --- a/src/ast/nodes/RootNode.java +++ b/src/ast/nodes/RootNode.java @@ -1,15 +1,15 @@ package ast.nodes; +import ast.types.*; import java.util.ArrayList; import java.util.HashMap; - import semanticanalysis.*; -import ast.types.*; /** * Node for the `root` statement of the grammar. */ public class RootNode implements Node { + // stms and compundStmts are protected because they are reused for a // BlockNode protected ArrayList stmts; @@ -28,11 +28,11 @@ public class RootNode implements Node { ST.add(HM); - for (Node stmt : compoundStmts) { + for (Node stmt : stmts) { errors.addAll(stmt.checkSemantics(ST, _nesting)); } - for (Node stmt : stmts) { + for (Node stmt : compoundStmts) { errors.addAll(stmt.checkSemantics(ST, _nesting)); } -- cgit v1.2.3-18-g5258