Mercurial > lcfOS
comparison 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 |
comparison
equal
deleted
inserted
replaced
388:e07c2a9abac1 | 389:2ec730e45ea1 |
---|---|
16 | 16 |
17 @property | 17 @property |
18 def Syms(self): | 18 def Syms(self): |
19 syms = self.symbols.values() | 19 syms = self.symbols.values() |
20 return sorted(syms, key=lambda v: v.name) | 20 return sorted(syms, key=lambda v: v.name) |
21 | |
22 @property | |
23 def Types(self): | |
24 return [s for s in self.Syms if isinstance(s, DefinedType)] | |
21 | 25 |
22 @property | 26 @property |
23 def Constants(self): | 27 def Constants(self): |
24 return [s for s in self.Syms if type(s) is Constant] | 28 return [s for s in self.Syms if type(s) is Constant] |
25 | 29 |
79 scope.addSymbol(byteType) | 83 scope.addSymbol(byteType) |
80 | 84 |
81 # Construct string type from others: | 85 # Construct string type from others: |
82 ln = StructField('len', intType) | 86 ln = StructField('len', intType) |
83 txt = StructField('txt', ArrayType(byteType, 0)) | 87 txt = StructField('txt', ArrayType(byteType, 0)) |
84 strType = DefinedType('string', PointerType(StructureType([ln, txt])), None) | 88 strType = DefinedType('string', PointerType(StructureType([ln, txt])), |
89 None) | |
85 scope.addSymbol(strType) | 90 scope.addSymbol(strType) |
86 return scope | 91 return scope |