diff python/c3/astnodes.py @ 226:240111e0456f

Work on named types
author Windel Bouwman
date Fri, 12 Jul 2013 17:25:31 +0200
parents 1c7364bd74c7
children 82dfe6a32717
line wrap: on
line diff
--- a/python/c3/astnodes.py	Thu Jul 11 07:42:30 2013 +0200
+++ b/python/c3/astnodes.py	Fri Jul 12 17:25:31 2013 +0200
@@ -67,13 +67,15 @@
 class StructureType(Type):
     def __init__(self, mems):
         self.mems = mems
+        for ft, fn in mems:
+            assert type(fn) is str
     def hasField(self, name):
-        for fn, ft in self.mems:
+        for ft, fn in self.mems:
             if name == fn:
                 return True
         return False
     def fieldType(self, name):
-        for fn, ft in self.mems:
+        for ft, fn in self.mems:
             if name == fn:
                 return ft
         raise Exception()