qapi: Eliminate QAPISchemaObjectType.check() variable members

We can use seen.values() instead if we make it an OrderedDict.

Backports commit 23a4b2c6f19297cd067455c852b4874879594c13 from qemu
This commit is contained in:
Markus Armbruster 2018-02-19 20:15:43 -05:00 committed by Lioncash
parent a0d6b16297
commit 8b6a605685
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7

View file

@ -977,26 +977,22 @@ class QAPISchemaObjectType(QAPISchemaType):
if self.members:
return
self.members = False # mark as being checked
seen = OrderedDict()
if self._base_name:
self.base = schema.lookup_type(self._base_name)
assert isinstance(self.base, QAPISchemaObjectType)
assert not self.base.variants # not implemented
self.base.check(schema)
members = list(self.base.members)
else:
members = []
seen = {}
for m in members:
assert m.name not in seen
seen[m.name] = m
for m in self.base.members:
assert m.name not in seen
seen[m.name] = m
for m in self.local_members:
m.check(schema)
assert m.name not in seen
seen[m.name] = m
members.append(m)
if self.variants:
self.variants.check(schema, seen)
self.members = members
self.members = seen.values()
def is_implicit(self):
# See QAPISchema._make_implicit_object_type()