summaryrefslogtreecommitdiff
path: root/src/ast/nodes/ArglistNode.java
diff options
context:
space:
mode:
authorgeno <gabriele.genovese2@studio.unibo.it>2024-06-27 20:49:56 +0200
committergeno <gabriele.genovese2@studio.unibo.it>2024-06-27 20:49:56 +0200
commitfd85e9980c0305c6dfb91aaeb199430a89163c3e (patch)
tree724d7184c11ad3acb8a8b0d2e15f1922f5b36059 /src/ast/nodes/ArglistNode.java
parent4898724edf343650ffb80792caf9e242e5843059 (diff)
fixed comp_for and added reseved word type
Diffstat (limited to 'src/ast/nodes/ArglistNode.java')
-rw-r--r--src/ast/nodes/ArglistNode.java38
1 files changed, 20 insertions, 18 deletions
diff --git a/src/ast/nodes/ArglistNode.java b/src/ast/nodes/ArglistNode.java
index 983d150..c29a4e0 100644
--- a/src/ast/nodes/ArglistNode.java
+++ b/src/ast/nodes/ArglistNode.java
@@ -22,25 +22,27 @@ public class ArglistNode implements Node {
ArrayList<SemanticError> errors = new ArrayList<SemanticError>();
for (var arg : arguments) {
- ExprNode argExpr = (ExprNode) arg;
- String argName = argExpr.getId();
-
- // TODO: check fucking IntType for params
- // TODO: remove fucking comments
- if (argName != null) {
- if (Arrays.asList(bif).contains(argName)) {
- continue;
+ if (arg instanceof ExprNode) {
+ ExprNode argExpr = (ExprNode) arg;
+ String argName = argExpr.getId();
+
+ // TODO: check fucking IntType for params
+ // TODO: remove fucking comments
+ if (argName != null) {
+ if (Arrays.asList(bif).contains(argName)) {
+ continue;
+ }
+
+ if (ST.lookup(argName) != null && ST.lookup(argName).getType() instanceof ImportType) {
+ continue;
+ }
+
+ if (ST.nslookup(argName) < 0 && argExpr.typeCheck() instanceof AtomType) {
+ errors.add(new SemanticError("name '" + argName + "' is not defined."));
+ }
+ } else {
+ errors.addAll(arg.checkSemantics(ST, _nesting));
}
-
- if (ST.lookup(argName) != null && ST.lookup(argName).getType() instanceof ImportType) {
- continue;
- }
-
- if (ST.nslookup(argName) < 0 && argExpr.typeCheck() instanceof AtomType) {
- errors.add(new SemanticError("name '" + argName + "' is not defined."));
- }
- } else {
- errors.addAll(arg.checkSemantics(ST, _nesting));
}
}