[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v11 09/28] qapi: Factor out QAPISchemaObjectTypeMemb
From: |
Eric Blake |
Subject: |
[Qemu-devel] [PATCH v11 09/28] qapi: Factor out QAPISchemaObjectTypeMember.check_clash() |
Date: |
Tue, 10 Nov 2015 23:51:11 -0700 |
From: Markus Armbruster <address@hidden>
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 <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Eric Blake <address@hidden>
---
v11: no change
v10: redo closer to Markus' original proposal
v9: new patch
---
scripts/qapi.py | 11 +++++++----
1 file 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):
--
2.4.3
- [Qemu-devel] [PATCH v11 00/28] qapi member collision, alternate layout (post-introspection cleanups, subset D), Eric Blake, 2015/11/11
- [Qemu-devel] [PATCH v11 01/28] qapi: Track simple union tag in object.local_members, Eric Blake, 2015/11/11
- [Qemu-devel] [PATCH v11 04/28] qapi: Drop obsolete tag value collision assertions, Eric Blake, 2015/11/11
- [Qemu-devel] [PATCH v11 07/28] qapi: Fix up commit 7618b91's clash sanity checking change, Eric Blake, 2015/11/11
- [Qemu-devel] [PATCH v11 03/28] qapi-types: Simplify gen_struct_field[s], Eric Blake, 2015/11/11
- [Qemu-devel] [PATCH v11 05/28] qapi: Simplify QAPISchemaObjectTypeMember.check(), Eric Blake, 2015/11/11
- [Qemu-devel] [PATCH v11 06/28] qapi: Clean up after previous commit, Eric Blake, 2015/11/11
- [Qemu-devel] [PATCH v11 02/28] qapi-types: Consolidate gen_struct() and gen_union(), Eric Blake, 2015/11/11
- [Qemu-devel] [PATCH v11 08/28] qapi: Eliminate QAPISchemaObjectType.check() variable members, Eric Blake, 2015/11/11
- [Qemu-devel] [PATCH v11 09/28] qapi: Factor out QAPISchemaObjectTypeMember.check_clash(),
Eric Blake <=
- [Qemu-devel] [PATCH v11 12/28] qapi: Factor out QAPISchemaObjectType.check_clash(), Eric Blake, 2015/11/11
- [Qemu-devel] [PATCH v11 14/28] qapi: Remove outdated tests related to QMP/branch collisions, Eric Blake, 2015/11/11
- [Qemu-devel] [PATCH v11 10/28] qapi: Simplify QAPISchemaObjectTypeVariants.check(), Eric Blake, 2015/11/11
- [Qemu-devel] [PATCH v11 13/28] qapi: Hoist tag collision check to Variants.check(), Eric Blake, 2015/11/11
- [Qemu-devel] [PATCH v11 11/28] qapi: Check for qapi collisions of flat union branches, Eric Blake, 2015/11/11