diff python/ppci/c3/scope.py @ 389:2ec730e45ea1

Added check for recursive struct
author Windel Bouwman
date Fri, 16 May 2014 12:29:31 +0200
parents 5477e499b039
children 988f3fb861e4
line wrap: on
line diff
--- a/python/ppci/c3/scope.py	Fri May 02 14:51:46 2014 +0200
+++ b/python/ppci/c3/scope.py	Fri May 16 12:29:31 2014 +0200
@@ -20,6 +20,10 @@
         return sorted(syms, key=lambda v: v.name)
 
     @property
+    def Types(self):
+        return [s for s in self.Syms if isinstance(s, DefinedType)]
+
+    @property
     def Constants(self):
         return [s for s in self.Syms if type(s) is Constant]
 
@@ -81,6 +85,7 @@
     # Construct string type from others:
     ln = StructField('len', intType)
     txt = StructField('txt', ArrayType(byteType, 0))
-    strType = DefinedType('string', PointerType(StructureType([ln, txt])), None)
+    strType = DefinedType('string', PointerType(StructureType([ln, txt])),
+                          None)
     scope.addSymbol(strType)
     return scope