comparison python/c3/codegenerator.py @ 167:0b5b2ee6b435

Added 2 unit tests
author Windel Bouwman
date Fri, 22 Mar 2013 17:40:13 +0100
parents 9683a4cd848f
children ee0d30533dae
comparison
equal deleted inserted replaced
166:da0087b82fbe 167:0b5b2ee6b435
34 genExprCode(bb, code.rval) 34 genExprCode(bb, code.rval)
35 # TODO: store 35 # TODO: store
36 elif type(code) is astnodes.IfStatement: 36 elif type(code) is astnodes.IfStatement:
37 genExprCode(bb, code.condition) 37 genExprCode(bb, code.condition)
38 # TODO: implement IF. 38 # TODO: implement IF.
39 t1, t2 = 1,2 39 t1, t2 = 1, 2
40 b = ir.BranchInstruction(t1, t2) 40 b = ir.BranchInstruction(t1, t2)
41 bb.Instructions.append(b) 41 bb.Instructions.append(b)
42 genCode(bb, code.truestatement) 42 genCode(bb, code.truestatement)
43 genCode(bb, code.falsestatement) 43 genCode(bb, code.falsestatement)
44 elif type(code) is astnodes.ProcedureCall: 44 elif type(code) is astnodes.FunctionCall:
45 ins = ir.CallInstruction('f', []) 45 ins = ir.CallInstruction('f', [])
46 bb.Instructions.append(ins) 46 bb.Instructions.append(ins)
47 elif type(code) is astnodes.EmptyStatement: 47 elif type(code) is astnodes.EmptyStatement:
48 pass 48 pass
49 elif type(code) is astnodes.ReturnStatement: 49 elif type(code) is astnodes.ReturnStatement: