Skip to content

Commit

Permalink
qapi: Split .connect_doc(), .check_doc() off .check()
Browse files Browse the repository at this point in the history
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 <armbru@redhat.com>
Message-Id: <20191024110237.30963-9-armbru@redhat.com>
  • Loading branch information
Markus Armbruster committed Oct 29, 2019
1 parent a4bd91d commit ee1e6a1
Showing 1 changed file with 27 additions and 7 deletions.
34 changes: 27 additions & 7 deletions scripts/qapi/schema.py
Expand Up @@ -51,6 +51,12 @@ def check(self, schema):
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
Expand Down Expand Up @@ -217,7 +223,10 @@ def check(self, schema):
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):
Expand Down Expand Up @@ -345,8 +354,6 @@ def check(self, schema):
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:
Expand All @@ -358,9 +365,6 @@ def check(self, schema):
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,
Expand All @@ -372,6 +376,15 @@ def check_clash(self, info, seen):
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
Expand Down Expand Up @@ -639,8 +652,13 @@ def check(self, schema):
"%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()

Expand Down Expand Up @@ -1043,6 +1061,8 @@ def _def_exprs(self, exprs):
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)
Expand Down

0 comments on commit ee1e6a1

Please sign in to comment.