diff options
author | L0P0P <grassoemanuele@live.com> | 2024-06-27 12:02:35 +0200 |
---|---|---|
committer | L0P0P <grassoemanuele@live.com> | 2024-06-27 12:02:35 +0200 |
commit | 3c4229fc9e0ec6da9a7f60b57b9e93c49d1b6b6c (patch) | |
tree | aca198eca62a0260a50ea59003c44a942e98f521 /src/ast/nodes/ArglistNode.java | |
parent | fb89b8c0885ee4e289cfb577bbabf0ee66b05024 (diff) |
Fixed a lot of problems from all the progs we need to parse
Diffstat (limited to 'src/ast/nodes/ArglistNode.java')
-rw-r--r-- | src/ast/nodes/ArglistNode.java | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/ast/nodes/ArglistNode.java b/src/ast/nodes/ArglistNode.java index cd1a403..78b4ca7 100644 --- a/src/ast/nodes/ArglistNode.java +++ b/src/ast/nodes/ArglistNode.java @@ -2,6 +2,8 @@ package ast.nodes; import ast.types.*; import java.util.ArrayList; +import java.util.Arrays; + import semanticanalysis.SemanticError; import semanticanalysis.SymbolTable; @@ -26,9 +28,18 @@ public class ArglistNode implements Node { // TODO: check fucking IntType for params // TODO: remove fucking comments - if (argName != null && !ST.top_lookup(argName) && argExpr.typeCheck() instanceof AtomType) { - // System.out.println(!(this.typeCheck() instanceof IntType) + " " + !ST.top_lookup(this.getId())); - errors.add(new SemanticError("'" + argName + "' is not defined.")); + if (argName != null) { + if (Arrays.asList(bif).contains(argName)) { + continue; + } + + if (ST.lookup(argName) != null && ST.lookup(argName).getType() instanceof ImportType) { + continue; + } + + if (!ST.top_lookup(argName) && argExpr.typeCheck() instanceof AtomType) { + errors.add(new SemanticError("'" + argName + "' is not defined.")); + } } else { errors.addAll(arg.checkSemantics(ST, _nesting)); } |