[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v12 12/36] qapi: Factor out QAPISchemaObjectType.che
From: |
Eric Blake |
Subject: |
[Qemu-devel] [PATCH v12 12/36] qapi: Factor out QAPISchemaObjectType.check_clash() |
Date: |
Wed, 18 Nov 2015 01:52:47 -0700 |
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 <address@hidden>
---
v12: no change
v11: don't lose isinstance check, and don't hide type.check()
inside check_clash()
v10: rebase on new Variants.check_clash()
v9: new patch, split off from v8 7/17
---
scripts/qapi.py | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/scripts/qapi.py b/scripts/qapi.py
index b2d071f..296b9bb 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):
--
2.4.3
- [Qemu-devel] [PATCH v12 08/36] qapi: Eliminate QAPISchemaObjectType.check() variable members, (continued)
- [Qemu-devel] [PATCH v12 08/36] qapi: Eliminate QAPISchemaObjectType.check() variable members, Eric Blake, 2015/11/18
- [Qemu-devel] [PATCH v12 15/36] qapi: Track owner of each object member, Eric Blake, 2015/11/18
- [Qemu-devel] [PATCH v12 25/36] qapi: Add alias for ErrorClass, Eric Blake, 2015/11/18
- [Qemu-devel] [PATCH v12 09/36] qapi: Factor out QAPISchemaObjectTypeMember.check_clash(), Eric Blake, 2015/11/18
- [Qemu-devel] [PATCH v12 21/36] qapi: Tighten the regex on valid names, Eric Blake, 2015/11/18
- [Qemu-devel] [PATCH v12 06/36] qapi: Clean up after previous commit, Eric Blake, 2015/11/18
- [Qemu-devel] [PATCH v12 07/36] qapi: Fix up commit 7618b91's clash sanity checking change, Eric Blake, 2015/11/18
- [Qemu-devel] [PATCH v12 12/36] qapi: Factor out QAPISchemaObjectType.check_clash(),
Eric Blake <=
- [Qemu-devel] [PATCH v12 18/36] qapi: Remove dead visitor code, Eric Blake, 2015/11/18
- [Qemu-devel] [PATCH v12 16/36] qapi: Detect collisions in C member names, Eric Blake, 2015/11/18
- [Qemu-devel] [PATCH v12 17/36] qapi: Fix c_name() munging, Eric Blake, 2015/11/18
[Qemu-devel] [PATCH v12 26/36] qapi: Change munging of CamelCase enum values, Eric Blake, 2015/11/18
[Qemu-devel] [PATCH v12 14/36] qapi: Remove outdated tests related to QMP/branch collisions, Eric Blake, 2015/11/18
[Qemu-devel] [PATCH v12 23/36] qapi: Remove dead tests for max collision, Eric Blake, 2015/11/18