summaryrefslogtreecommitdiff
path: root/src/ast/nodes/AssignmentNode.java
diff options
context:
space:
mode:
authorSanto Cariotti <santo@dcariotti.me>2024-06-25 11:33:41 +0200
committerSanto Cariotti <santo@dcariotti.me>2024-06-25 11:33:41 +0200
commit6bdf1fc6c1b7afe18ffcae05f8fb11eca0f51258 (patch)
tree2cfbae97d45388bac38defc9907c77e7b275b207 /src/ast/nodes/AssignmentNode.java
parent54b2c77e6875c1abb3d73fdfd0de924e75633087 (diff)
wip
Diffstat (limited to 'src/ast/nodes/AssignmentNode.java')
-rw-r--r--src/ast/nodes/AssignmentNode.java12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/ast/nodes/AssignmentNode.java b/src/ast/nodes/AssignmentNode.java
index 627e842..b0310b5 100644
--- a/src/ast/nodes/AssignmentNode.java
+++ b/src/ast/nodes/AssignmentNode.java
@@ -10,24 +10,26 @@ import ast.types.*;
* Node for the `assignment` statement of the grammar.
*/
public class AssignmentNode implements Node {
- private Node lhr;
+ private ExprNode lhr;
private Node assign;
- private Node rhr;
+ private ExprNode rhr;
public AssignmentNode(Node lhr, Node assign, Node rhr) {
- this.lhr = lhr;
+ this.lhr = (ExprNode) lhr;
this.assign = assign;
- this.rhr = rhr;
+ this.rhr = (ExprNode) rhr;
}
@Override
public ArrayList<SemanticError> checkSemantics(SymbolTable ST, int _nesting) {
ArrayList<SemanticError> errors = new ArrayList<SemanticError>();
- errors.addAll(lhr.checkSemantics(ST, _nesting));
+ // errors.addAll(lhr.checkSemantics(ST, _nesting));
errors.addAll(assign.checkSemantics(ST, _nesting));
errors.addAll(rhr.checkSemantics(ST, _nesting));
+ ST.insert(lhr.getId(), rhr.typeCheck(), _nesting, "");
+
return errors;
}