comparison python/c3/typecheck.py @ 164:e023d3ce1d63

Fix to loc of assignment
author Windel Bouwman
date Mon, 18 Mar 2013 22:15:57 +0100
parents 8104fc8b5e90
children 598d3888a11c
comparison
equal deleted inserted replaced
163:8104fc8b5e90 164:e023d3ce1d63
23 elif type(sym) is IfStatement: 23 elif type(sym) is IfStatement:
24 print(sym.condition) 24 print(sym.condition)
25 if not equalTypes(sym.condition.typ, boolType): 25 if not equalTypes(sym.condition.typ, boolType):
26 self.diag.error('Condition must be a boolean expression', sym.condition.loc) 26 self.diag.error('Condition must be a boolean expression', sym.condition.loc)
27 elif type(sym) is Assignment: 27 elif type(sym) is Assignment:
28 pass 28 if not equalTypes(sym.lval.typ, sym.rval.typ):
29 self.diag.error('Cannot assign {0} to {1}'.format(sym.rval.typ, sym.lval.typ), sym.loc)
29 elif type(sym) is ReturnStatement: 30 elif type(sym) is ReturnStatement:
30 pass 31 pass
31 elif type(sym) is ProcedureCall: 32 elif type(sym) is ProcedureCall:
32 # Check arguments: 33 # Check arguments:
33 34