[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 08/19] qapi: Split .connect_doc(), .check_doc() off .check()
From: |
Markus Armbruster |
Subject: |
[PATCH 08/19] qapi: Split .connect_doc(), .check_doc() off .check() |
Date: |
Thu, 24 Oct 2019 13:02:26 +0200 |
Splitting documentation checking off the .check() methods makes them a
bit more focused, which is welcome, as some of them are pretty big.
It also prepares the ground for the following commits.
Signed-off-by: Markus Armbruster <address@hidden>
---
scripts/qapi/schema.py | 34 +++++++++++++++++++++++++++-------
1 file changed, 27 insertions(+), 7 deletions(-)
diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py
index f7d68a35f4..9b62c8d74d 100644
--- a/scripts/qapi/schema.py
+++ b/scripts/qapi/schema.py
@@ -51,6 +51,12 @@ class QAPISchemaEntity(object):
os.path.dirname(schema.fname))
self._checked = True
+ def connect_doc(self):
+ pass
+
+ def check_doc(self):
+ pass
+
@property
def ifcond(self):
assert self._checked
@@ -217,7 +223,10 @@ class QAPISchemaEnumType(QAPISchemaType):
seen = {}
for m in self.members:
m.check_clash(self.info, seen)
- if self.doc:
+
+ def connect_doc(self):
+ if self.doc:
+ for m in self.members:
self.doc.connect_member(m)
def is_implicit(self):
@@ -345,8 +354,6 @@ class QAPISchemaObjectType(QAPISchemaType):
for m in self.local_members:
m.check(schema)
m.check_clash(self.info, seen)
- if self.doc:
- self.doc.connect_member(m)
members = seen.values()
if self.variants:
@@ -358,9 +365,6 @@ class QAPISchemaObjectType(QAPISchemaType):
for f in self.features:
f.check_clash(self.info, seen)
- if self.doc:
- self.doc.check()
-
self.members = members # mark completed
# Check that the members of this type do not cause duplicate JSON members,
@@ -372,6 +376,15 @@ class QAPISchemaObjectType(QAPISchemaType):
for m in self.members:
m.check_clash(info, seen)
+ def connect_doc(self):
+ if self.doc:
+ for m in self.local_members:
+ self.doc.connect_member(m)
+
+ def check_doc(self):
+ if self.doc:
+ self.doc.check()
+
@property
def ifcond(self):
assert self._checked
@@ -639,8 +652,13 @@ class QAPISchemaAlternateType(QAPISchemaType):
"%s can't be distinguished from '%s'"
% (v.describe(self.info), types_seen[qt]))
types_seen[qt] = v.name
- if self.doc:
+
+ def connect_doc(self):
+ if self.doc:
+ for v in self.variants.variants:
self.doc.connect_member(v)
+
+ def check_doc(self):
if self.doc:
self.doc.check()
@@ -1043,6 +1061,8 @@ class QAPISchema(object):
def check(self):
for ent in self._entity_list:
ent.check(self)
+ ent.connect_doc()
+ ent.check_doc()
def visit(self, visitor):
visitor.visit_begin(self)
--
2.21.0
- [PATCH 00/19] qapi: Doc generation fixes, Markus Armbruster, 2019/10/24
- [PATCH 01/19] tests/qapi-schema: Demonstrate feature and enum doc comment bugs, Markus Armbruster, 2019/10/24
- [PATCH 13/19] qapi: Eliminate .check_doc() overrides, Markus Armbruster, 2019/10/24
- [PATCH 16/19] qapi: Fold normalize_enum() into check_enum(), Markus Armbruster, 2019/10/24
- [PATCH 12/19] qapi: Simplify ._make_implicit_object_type(), Markus Armbruster, 2019/10/24
- [PATCH 05/19] qemu-doc: Belatedly document QMP command deprecation, Markus Armbruster, 2019/10/24
- [PATCH 10/19] qapi: Clean up doc comment checking for implicit union base, Markus Armbruster, 2019/10/24
- [PATCH 08/19] qapi: Split .connect_doc(), .check_doc() off .check(),
Markus Armbruster <=
- [PATCH 18/19] qapi: Polish reporting of bogus member documentation, Markus Armbruster, 2019/10/24
- [PATCH 04/19] tests/qapi-schema: Fix feature documentation testing, Markus Armbruster, 2019/10/24
- [PATCH 03/19] tests/qapi-schema: Cover alternate documentation comments, Markus Armbruster, 2019/10/24
- [PATCH 09/19] qapi: Fix enum doc comment checking, Markus Armbruster, 2019/10/24
- [PATCH 07/19] qapi: De-duplicate entity documentation generation code, Markus Armbruster, 2019/10/24
- [PATCH 11/19] qapi: Fix doc comment checking for commands and events, Markus Armbruster, 2019/10/24
- [PATCH 15/19] qapi: Fold normalize_features() into check_features(), Markus Armbruster, 2019/10/24
- [PATCH 02/19] tests/qapi-schema: Demonstrate command and event doc comment bugs, Markus Armbruster, 2019/10/24
- [PATCH 19/19] qapi: Check feature documentation against the schema, Markus Armbruster, 2019/10/24
- [PATCH 14/19] qapi: Fold normalize_if() into check_if(), Markus Armbruster, 2019/10/24