diff options
author | Eric Blake <eblake@redhat.com> | 2015-11-18 01:52:47 -0700 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2015-12-17 08:21:26 +0100 |
commit | c2183d2e62b6d9d66f80bc0bcf4fc7ec3c5d76d4 (patch) | |
tree | 0fde3f9362eaa5ac8f518694e77966bbb7d0bc23 /scripts/qapi.py | |
parent | b807a1e1e3796adaf3ece2f7b69ea5ee28468ff4 (diff) |
qapi: Factor out QAPISchemaObjectType.check_clash()
Consolidate two common sequences of clash detection into a
new QAPISchemaObjectType.check_clash() helper method.
No change to generated code.
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1447836791-369-13-git-send-email-eblake@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'scripts/qapi.py')
-rw-r--r-- | scripts/qapi.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/scripts/qapi.py b/scripts/qapi.py index b2d071f92d..296b9bb142 100644 --- a/scripts/qapi.py +++ b/scripts/qapi.py @@ -981,10 +981,8 @@ class QAPISchemaObjectType(QAPISchemaType): 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) - for m in self.base.members: - m.check_clash(seen) + self.base.check_clash(schema, seen) for m in self.local_members: m.check(schema) m.check_clash(seen) @@ -994,6 +992,11 @@ class QAPISchemaObjectType(QAPISchemaType): assert self.variants.tag_member in self.members self.variants.check_clash(schema, seen) + def check_clash(self, schema, seen): + assert not self.variants # not implemented + for m in self.members: + m.check_clash(seen) + def is_implicit(self): # See QAPISchema._make_implicit_object_type() return self.name[0] == ':' @@ -1064,11 +1067,8 @@ class QAPISchemaObjectTypeVariants(object): for v in self.variants: # Reset seen map for each variant, since qapi names from one # branch do not affect another branch - vseen = dict(seen) assert isinstance(v.type, QAPISchemaObjectType) - assert not v.type.variants # not implemented - for m in v.type.members: - m.check_clash(vseen) + v.type.check_clash(schema, dict(seen)) class QAPISchemaObjectTypeVariant(QAPISchemaObjectTypeMember): |