summaryrefslogtreecommitdiff
path: root/src/ast/nodes/AssignmentNode.java
diff options
context:
space:
mode:
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;
}