summaryrefslogtreecommitdiff
path: root/src/ast/nodes/ArglistNode.java
diff options
context:
space:
mode:
authorL0P0P <grassoemanuele@live.com>2024-06-26 11:44:58 +0200
committerL0P0P <grassoemanuele@live.com>2024-06-26 11:44:58 +0200
commit9e6c17cb44bc165e315ec039a0e09183716d2037 (patch)
tree4a64fd37fa9b2483b88a5f33a37c6b9b51812d81 /src/ast/nodes/ArglistNode.java
parentfc712f94a7ed8554d8d44f4965be367354a7e670 (diff)
Semantic check for function declaration and function invocation
Diffstat (limited to 'src/ast/nodes/ArglistNode.java')
-rw-r--r--src/ast/nodes/ArglistNode.java14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/ast/nodes/ArglistNode.java b/src/ast/nodes/ArglistNode.java
index f0c33e1..71bcdce 100644
--- a/src/ast/nodes/ArglistNode.java
+++ b/src/ast/nodes/ArglistNode.java
@@ -19,9 +19,19 @@ public class ArglistNode implements Node {
@Override
public ArrayList<SemanticError> checkSemantics(SymbolTable ST, int _nesting) {
ArrayList<SemanticError> errors = new ArrayList<SemanticError>();
-
+
for (var arg : arguments) {
- errors.addAll(arg.checkSemantics(ST, _nesting));
+ ExprNode argExpr = (ExprNode) arg;
+ String argName = argExpr.getId();
+
+ // TODO: check fucking IntType for params
+ // TODO: remove fucking comments
+ if (!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."));
+ } else {
+ errors.addAll(arg.checkSemantics(ST, _nesting));
+ }
}
return errors;