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/ImportNode.java | |
parent | fb89b8c0885ee4e289cfb577bbabf0ee66b05024 (diff) |
Fixed a lot of problems from all the progs we need to parse
Diffstat (limited to 'src/ast/nodes/ImportNode.java')
-rw-r--r-- | src/ast/nodes/ImportNode.java | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/ast/nodes/ImportNode.java b/src/ast/nodes/ImportNode.java index e264c99..900a909 100644 --- a/src/ast/nodes/ImportNode.java +++ b/src/ast/nodes/ImportNode.java @@ -29,12 +29,24 @@ public class ImportNode implements Node { public ArrayList<SemanticError> checkSemantics(SymbolTable ST, int _nesting) { ArrayList<SemanticError> errors = new ArrayList<SemanticError>(); + if (isFrom) { + for (int i = 0; i < names.size(); ++i) { + ST.insert(names.get(i), this.typeCheck(), _nesting, null); + } + } else { + errors.addAll(dottedName.checkSemantics(ST, _nesting)); + } + + if (importAs) { + ST.insert(names.get(names.size() - 1), this.typeCheck(), _nesting, null); + } + return errors; } @Override public Type typeCheck() { - return new VoidType(); + return new ImportType(); } // NOTE: we do not want to provide a code generation for this statement |