Mercurial > lcfOS
diff python/c3/semantics.py @ 167:0b5b2ee6b435
Added 2 unit tests
author | Windel Bouwman |
---|---|
date | Fri, 22 Mar 2013 17:40:13 +0100 |
parents | 598d3888a11c |
children | ee0d30533dae |
line wrap: on
line diff
--- a/python/c3/semantics.py Fri Mar 22 16:15:31 2013 +0100 +++ b/python/c3/semantics.py Fri Mar 22 17:40:13 2013 +0100 @@ -36,7 +36,8 @@ return p def actOnFuncDef2(self, parameters, returntype, body): self.curFunc.body = body - self.curFunc.typ = astnodes.FunctionType(parameters, returntype) + paramtypes = [p.typ for p in parameters] + self.curFunc.typ = astnodes.FunctionType(paramtypes, returntype) self.curFunc = None self.curScope = self.curScope.parent def actOnType(self, tok): @@ -63,6 +64,10 @@ a = astnodes.Assignment(lval, rval) a.loc = loc return a + def actOnFunctionCall(self, func, args, loc): + fc = astnodes.FunctionCall(func, args) + fc.loc = loc + return fc def actOnIfStatement(self, cond, yes, no, loc): i = astnodes.IfStatement(cond, yes, no) i.loc = loc