summaryrefslogtreecommitdiffstats
path: root/scripts/qapi.py
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2015-11-18 01:52:44 -0700
committerTimothy Pearson <tpearson@raptorengineering.com>2019-11-29 19:28:19 -0600
commit0690626dfe11ab15f4eb05d8b5743884d5fc64f8 (patch)
tree0680686a5bac70d0d03e3237a709c0b15d58afad /scripts/qapi.py
parente2a3a102f979372f4050c4a65a19c2ae5f7450c1 (diff)
downloadhqemu-0690626dfe11ab15f4eb05d8b5743884d5fc64f8.zip
hqemu-0690626dfe11ab15f4eb05d8b5743884d5fc64f8.tar.gz
qapi: Factor out QAPISchemaObjectTypeMember.check_clash()
While there, stick in a TODO change key of seen from QAPI name to C name. Can't do it right away, because it would fail the assertion for tests/qapi-schema/args-has-clash.json. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <1446559499-26984-6-git-send-email-armbru@redhat.com> Signed-off-by: Eric Blake <eblake@redhat.com> Message-Id: <1447836791-369-10-git-send-email-eblake@redhat.com>
Diffstat (limited to 'scripts/qapi.py')
-rw-r--r--scripts/qapi.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/scripts/qapi.py b/scripts/qapi.py
index 44d08c1..2a73b2b 100644
--- a/scripts/qapi.py
+++ b/scripts/qapi.py
@@ -984,12 +984,10 @@ class QAPISchemaObjectType(QAPISchemaType):
assert not self.base.variants # not implemented
self.base.check(schema)
for m in self.base.members:
- assert m.name not in seen
- seen[m.name] = m
+ m.check_clash(seen)
for m in self.local_members:
m.check(schema)
- assert m.name not in seen
- seen[m.name] = m
+ m.check_clash(seen)
if self.variants:
self.variants.check(schema, seen)
self.members = seen.values()
@@ -1030,6 +1028,11 @@ class QAPISchemaObjectTypeMember(object):
self.type = schema.lookup_type(self._type_name)
assert self.type
+ def check_clash(self, seen):
+ # TODO change key of seen from QAPI name to C name
+ assert self.name not in seen
+ seen[self.name] = self
+
class QAPISchemaObjectTypeVariants(object):
def __init__(self, tag_name, tag_member, variants):
OpenPOWER on IntegriCloud