comparison python/c3/codegenerator.py @ 259:ac603eb66b63

Added function call
author Windel Bouwman
date Mon, 05 Aug 2013 20:41:25 +0200
parents 7416c923a02a
children 444b9df2ed99
comparison
equal deleted inserted replaced
258:04c19282a5aa 259:ac603eb66b63
209 else: 209 else:
210 raise Exception() 210 raise Exception()
211 else: 211 else:
212 raise NotImplementedError("not implemented") 212 raise NotImplementedError("not implemented")
213 elif type(expr) is astnodes.FunctionCall: 213 elif type(expr) is astnodes.FunctionCall:
214 tmp = self.builder.newTmp("res") 214 tmp = self.builder.newTmp("res")
215 args = [] 215 args = []
216 for arg in expr.args: 216 for arg in expr.args:
217 ar = self.genExprCode(arg) 217 ar = self.genExprCode(arg)
218 args.append(ar) 218 args.append(ar)
219 fn = self.funcMap[expr.proc] 219 fn = self.funcMap[expr.proc]
220 ins = ir.Call(fn, args, tmp) 220 ins = ir.Call(fn, args, tmp)
221 self.builder.addIns(ins) 221 self.builder.addIns(ins)
222 return tmp 222 return tmp
223 else: 223 else:
224 raise NotImplementedError('Unknown expr {}'.format(expr)) 224 raise NotImplementedError('Unknown expr {}'.format(expr))
225 225