- if(assign.left->type && !assign.left->lvalue)
- error(assign, "Target of assignment is not an lvalue");
- if(assign.left->type && assign.right->type && assign.left->type!=assign.right->type)
- error(assign, format("Assignment to variable of type '%s' from expression of type '%s'",
- assign.left->type->name, assign.right->type->name));
+ if(assign.left->type)
+ {
+ if(!assign.left->lvalue)
+ error(assign, "Target of assignment is not an lvalue");
+ if(assign.right->type)
+ {
+ if(assign.oper->token[0]!='=')
+ {
+ if(!assign.type)
+ error(assign, format("No matching operator '%s' found for '%s' and '%s'",
+ string(assign.oper->token, strlen(assign.oper->token)-1), assign.left->type->name, assign.right->type->name));
+ }
+ else if(assign.left->type!=assign.right->type)
+ error(assign, format("Assignment to variable of type '%s' from expression of incompatible type '%s'",
+ assign.left->type->name, assign.right->type->name));
+ }
+ }