diff options
author | Santo Cariotti <santo@dcariotti.me> | 2024-06-27 22:18:55 +0200 |
---|---|---|
committer | Santo Cariotti <santo@dcariotti.me> | 2024-06-27 22:18:55 +0200 |
commit | 3f29e5101d9c6e670dd05715297f2060707dc6c7 (patch) | |
tree | 16f343b8fa12b8cc119d356c909e5d3864eea14f | |
parent | 4516c901ccbabfba9115c87237996dc9acdc7590 (diff) |
Fix trailer with parentheeses `for (key, val) in ...`
Resolves test `a228.py`
-rw-r--r-- | src/ast/nodes/TestlistCompNode.java | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/ast/nodes/TestlistCompNode.java b/src/ast/nodes/TestlistCompNode.java index bcaca83..4ae77c9 100644 --- a/src/ast/nodes/TestlistCompNode.java +++ b/src/ast/nodes/TestlistCompNode.java @@ -23,7 +23,8 @@ public class TestlistCompNode implements Node { ArrayList<SemanticError> errors = new ArrayList(); if (comp != null) { - // if comp is set, then we save the atom in the ST (we assume the first expr is an atom) + // if comp is set, then we save the atom in the ST (we assume the first expr is + // an atom) String id = ((ExprNode) exprs.get(0)).getId(); Type t = ((ExprNode) exprs.get(0)).typeCheck(); ST.insert(id, t, _nesting, ""); @@ -31,6 +32,8 @@ public class TestlistCompNode implements Node { } else { // if comp is not set, then exprs is a list of 1 or more element for (var param : exprs) { + var exp = (ExprNode) param; + ST.insert(exp.getId(), exp.typeCheck(), _nesting, ""); errors.addAll(param.checkSemantics(ST, _nesting)); } } |