Mercurial > lcfOS
diff python/c3/astnodes.py @ 227:82dfe6a32717
Fixed tests
author | Windel Bouwman |
---|---|
date | Fri, 12 Jul 2013 17:42:39 +0200 |
parents | 240111e0456f |
children | 7f18ed9b6b7e |
line wrap: on
line diff
--- a/python/c3/astnodes.py Fri Jul 12 17:25:31 2013 +0200 +++ b/python/c3/astnodes.py Fri Jul 12 17:42:39 2013 +0200 @@ -64,20 +64,26 @@ def __repr__(self): return '({}*)'.format(self.ptype) +class StructField: + def __init__(self, name, typ): + self.name = name + self.typ = typ + class StructureType(Type): def __init__(self, mems): self.mems = mems - for ft, fn in mems: - assert type(fn) is str + for mem in mems: + assert type(mem) is StructField + assert type(mem.name) is str def hasField(self, name): - for ft, fn in self.mems: - if name == fn: + for mem in self.mems: + if name == mem.name: return True return False def fieldType(self, name): - for ft, fn in self.mems: - if name == fn: - return ft + for mem in self.mems: + if name == mem.name: + return mem.typ raise Exception()