Bug 521898, part 2: Rename StructField .type to .typespec to avoid unintended "shadowing". r=bent

This commit is contained in:
Chris Jones 2012-06-08 17:25:36 -07:00
parent 0006967bc9
commit 1104ee58c2
2 changed files with 5 additions and 5 deletions

View File

@ -33,7 +33,7 @@ class Visitor:
f.accept(self)
def visitStructField(self, field):
field.type.accept(self)
field.typespec.accept(self)
def visitUnionDecl(self, union):
for t in union.components:
@ -256,7 +256,7 @@ class Protocol(NamespacedNode):
class StructField(Node):
def __init__(self, loc, type, name):
Node.__init__(self, loc)
self.type = type
self.typespec = type
self.name = name
class StructDecl(NamespacedNode):

View File

@ -704,15 +704,15 @@ class GatherDecls(TcheckVisitor):
self.symtab.enterScope(sd)
for f in sd.fields:
ftypedecl = self.symtab.lookup(str(f.type))
ftypedecl = self.symtab.lookup(str(f.typespec))
if ftypedecl is None:
self.error(f.loc, "field `%s' of struct `%s' has unknown type `%s'",
f.name, sd.name, str(f.type))
f.name, sd.name, str(f.typespec))
continue
f.decl = self.declare(
loc=f.loc,
type=self._canonicalType(ftypedecl.type, f.type),
type=self._canonicalType(ftypedecl.type, f.typespec),
shortname=f.name,
fullname=None)
stype.fields.append(f.decl.type)