diff python/c3/analyse.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/analyse.py	Thu Jul 11 07:42:30 2013 +0200
+++ b/python/c3/analyse.py	Fri Jul 12 17:25:31 2013 +0200
@@ -78,8 +78,13 @@
         if type(t) is PointerType:
             t.ptype = self.resolveType(t.ptype, scope)
             return t
+        elif type(t) is StructureType:
+            for mem in t.mems:
+                mem.typ = self.resolveType(mem.typ, scope)
+            return t
         elif type(t) is Designator:
-            return self.resolveDesignator(t, scope)
+            t = self.resolveDesignator(t, scope)
+            return self.resolveType(t)
         elif isinstance(t, Type):
             # Already resolved??
             return t
@@ -101,6 +106,8 @@
             ft = sym.typ
             ft.returntype = self.resolveType(ft.returntype, sym.scope)
             ft.parametertypes = [self.resolveType(pt, sym.scope) for pt in ft.parametertypes]
+        elif type(sym) is DefinedType:
+            sym.typ = self.resolveType(sym.typ, sym.scope)
 
     def sanity(self, sym):
         if type(sym) is FunctionType: