Skip to content
Snippets Groups Projects
Verified Commit d4816436 authored by Recolic Keghart's avatar Recolic Keghart
Browse files

multi-assign stmt bug fix. silly TA not using reference-type for assignment

parent 1f79b934
No related branches found
No related tags found
No related merge requests found
Pipeline #42 passed with warnings with stages
in 2 minutes and 45 seconds
......@@ -181,14 +181,20 @@ public class TypeChecker extends AbstractNodeAnalyzer<SymbolType> {
if(right_type == null)
right_type = NONE_TYPE;
for(Expr target : node.targets) {
Identifier id = (Identifier) target;
if(id == null) {
err(node, "assign to non-identifier expr.");
return NONE_TYPE;
System.out.println("assign: " + target.getClass().getName());
if(target instanceof IndexExpr) {
IndexExpr indexExpr = (IndexExpr) target;
left_type = indexExpr.dispatch(this);
}
else if(target instanceof Identifier) {
Identifier id = (Identifier) target;
left_type = id.dispatch(this);
}
else {
err(node, "Not implemented assignStmt");
}
left_type = id.dispatch(this);
if(left_type == null) {
err(node, "Syntax error: assign to non-declared variable: " + id.name);
err(node, "Syntax error: assign to non-declared variable");
return NONE_TYPE;
}
if(!typeConvertible(right_type, left_type)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment