[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 19/34] qapi/schema: Call QAPIDoc.connect_member() in just one
From: |
Markus Armbruster |
Subject: |
[PATCH v4 19/34] qapi/schema: Call QAPIDoc.connect_member() in just one place |
Date: |
Tue, 17 Mar 2020 12:54:44 +0100 |
The .connect_doc() of classes that have QAPISchemaMember connect them
to their documentation. Change them to delegate the actual work to
new QAPISchemaMember.connect_doc(). Matches the .connect_doc() that
already exist.
Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Marc-André Lureau <address@hidden>
---
scripts/qapi/schema.py | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py
index 033c84c4a0..59e1f5a395 100644
--- a/scripts/qapi/schema.py
+++ b/scripts/qapi/schema.py
@@ -252,9 +252,8 @@ class QAPISchemaEnumType(QAPISchemaType):
def connect_doc(self, doc=None):
super().connect_doc(doc)
doc = doc or self.doc
- if doc:
- for m in self.members:
- doc.connect_member(m)
+ for m in self.members:
+ m.connect_doc(doc)
def is_implicit(self):
# See QAPISchema._make_implicit_enum_type() and ._def_predefineds()
@@ -396,11 +395,10 @@ class QAPISchemaObjectType(QAPISchemaType):
def connect_doc(self, doc=None):
super().connect_doc(doc)
doc = doc or self.doc
- if doc:
- if self.base and self.base.is_implicit():
- self.base.connect_doc(doc)
- for m in self.local_members:
- doc.connect_member(m)
+ if self.base and self.base.is_implicit():
+ self.base.connect_doc(doc)
+ for m in self.local_members:
+ m.connect_doc(doc)
@property
def ifcond(self):
@@ -496,9 +494,8 @@ class QAPISchemaAlternateType(QAPISchemaType):
def connect_doc(self, doc=None):
super().connect_doc(doc)
doc = doc or self.doc
- if doc:
- for v in self.variants.variants:
- doc.connect_member(v)
+ for v in self.variants.variants:
+ v.connect_doc(doc)
def c_type(self):
return c_name(self.name) + pointer_suffix
@@ -627,6 +624,10 @@ class QAPISchemaMember:
% (self.describe(info), seen[cname].describe(info)))
seen[cname] = self
+ def connect_doc(self, doc):
+ if doc:
+ doc.connect_member(self)
+
def describe(self, info):
role = self.role
defined_in = self.defined_in
--
2.21.1
- [PATCH v4 27/34] qemu-options: New -compat to set policy for deprecated interfaces, (continued)
- [PATCH v4 27/34] qemu-options: New -compat to set policy for deprecated interfaces, Markus Armbruster, 2020/03/17
- [PATCH v4 21/34] qapi: Inline do_qmp_dispatch() into qmp_dispatch(), Markus Armbruster, 2020/03/17
- [PATCH v4 32/34] qapi: Implement deprecated-input=reject for QMP commands, Markus Armbruster, 2020/03/17
- [PATCH v4 28/34] qapi: Implement deprecated-output=hide for QMP command results, Markus Armbruster, 2020/03/17
- [PATCH v4 25/34] qapi: New special feature flag "deprecated", Markus Armbruster, 2020/03/17
- [PATCH v4 13/34] qapi: Consistently put @features parameter right after @ifcond, Markus Armbruster, 2020/03/17
- [PATCH v4 29/34] qapi: Implement deprecated-output=hide for QMP events, Markus Armbruster, 2020/03/17
- [PATCH v4 34/34] qapi: New -compat deprecated-input=crash, Markus Armbruster, 2020/03/17
- [PATCH v4 19/34] qapi/schema: Call QAPIDoc.connect_member() in just one place,
Markus Armbruster <=
- [PATCH v4 26/34] qapi: Mark deprecated QMP parts with feature 'deprecated', Markus Armbruster, 2020/03/17
- [PATCH v4 17/34] qapi/schema: Reorder classes so related ones are together, Markus Armbruster, 2020/03/17
- [PATCH v4 31/34] qapi: Implement deprecated-output=hide for QMP introspection, Markus Armbruster, 2020/03/17
- [PATCH v4 33/34] qapi: Implement deprecated-input=reject for QMP command arguments, Markus Armbruster, 2020/03/17
- [PATCH v4 12/34] qapi: Add feature flags to remaining definitions, Markus Armbruster, 2020/03/17
- [PATCH v4 20/34] qapi: Add feature flags to struct members, Markus Armbruster, 2020/03/17
- [PATCH v4 15/34] qapi/introspect: Factor out _make_tree(), Markus Armbruster, 2020/03/17
- [PATCH v4 14/34] qapi/introspect: Rename *qlit* to reduce confusion, Markus Armbruster, 2020/03/17