Mercurial > lcfOS
comparison python/c3/astnodes.py @ 167:0b5b2ee6b435
Added 2 unit tests
author | Windel Bouwman |
---|---|
date | Fri, 22 Mar 2013 17:40:13 +0100 |
parents | da0087b82fbe |
children | 5fd02aa38b42 |
comparison
equal
deleted
inserted
replaced
166:da0087b82fbe | 167:0b5b2ee6b435 |
---|---|
24 self.name = name | 24 self.name = name |
25 def __repr__(self): | 25 def __repr__(self): |
26 return '{0}'.format(self.name) | 26 return '{0}'.format(self.name) |
27 | 27 |
28 class FunctionType(Type): | 28 class FunctionType(Type): |
29 def __init__(self, parameters, returntype): | 29 def __init__(self, parametertypes, returntype): |
30 self.parameters = parameters | 30 self.parametertypes = parametertypes |
31 self.returntype = returntype | 31 self.returntype = returntype |
32 def __repr__(self): | 32 def __repr__(self): |
33 params = ','.join([str(v) for v in self.parameters]) | 33 params = ', '.join([str(v) for v in self.parametertypes]) |
34 return '{1} f({0})'.format(params, self.returntype) | 34 return '{1} f({0})'.format(params, self.returntype) |
35 | 35 |
36 class DefinedType(Type): | 36 class DefinedType(Type): |
37 def __init__(self, name, typ): | 37 def __init__(self, name, typ): |
38 self.name = name | 38 self.name = name |
138 self.lval = lval | 138 self.lval = lval |
139 self.rval = rval | 139 self.rval = rval |
140 def __repr__(self): | 140 def __repr__(self): |
141 return 'ASSIGNMENT' | 141 return 'ASSIGNMENT' |
142 | 142 |
143 class ProcedureCall(Node): | 143 class FunctionCall(Node): |
144 def __init__(self, proc, args): | 144 def __init__(self, proc, args): |
145 self.proc = proc | 145 self.proc = proc |
146 self.args = args | 146 self.args = args |
147 def __repr__(self): | 147 def __repr__(self): |
148 return 'CALL {0} '.format(self.proc) | 148 return 'CALL {0} '.format(self.proc) |