mirror of https://github.com/xemu-project/xemu.git
qapi/schema: Call QAPIDoc.connect_member() in just one place
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 <armbru@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20200317115459.31821-20-armbru@redhat.com>
This commit is contained in:
parent
5858fd1a02
commit
645178c069
|
@ -252,9 +252,8 @@ class QAPISchemaEnumType(QAPISchemaType):
|
||||||
def connect_doc(self, doc=None):
|
def connect_doc(self, doc=None):
|
||||||
super().connect_doc(doc)
|
super().connect_doc(doc)
|
||||||
doc = doc or self.doc
|
doc = doc or self.doc
|
||||||
if doc:
|
for m in self.members:
|
||||||
for m in self.members:
|
m.connect_doc(doc)
|
||||||
doc.connect_member(m)
|
|
||||||
|
|
||||||
def is_implicit(self):
|
def is_implicit(self):
|
||||||
# See QAPISchema._make_implicit_enum_type() and ._def_predefineds()
|
# See QAPISchema._make_implicit_enum_type() and ._def_predefineds()
|
||||||
|
@ -396,11 +395,10 @@ class QAPISchemaObjectType(QAPISchemaType):
|
||||||
def connect_doc(self, doc=None):
|
def connect_doc(self, doc=None):
|
||||||
super().connect_doc(doc)
|
super().connect_doc(doc)
|
||||||
doc = doc or self.doc
|
doc = doc or self.doc
|
||||||
if doc:
|
if self.base and self.base.is_implicit():
|
||||||
if self.base and self.base.is_implicit():
|
self.base.connect_doc(doc)
|
||||||
self.base.connect_doc(doc)
|
for m in self.local_members:
|
||||||
for m in self.local_members:
|
m.connect_doc(doc)
|
||||||
doc.connect_member(m)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def ifcond(self):
|
def ifcond(self):
|
||||||
|
@ -496,9 +494,8 @@ class QAPISchemaAlternateType(QAPISchemaType):
|
||||||
def connect_doc(self, doc=None):
|
def connect_doc(self, doc=None):
|
||||||
super().connect_doc(doc)
|
super().connect_doc(doc)
|
||||||
doc = doc or self.doc
|
doc = doc or self.doc
|
||||||
if doc:
|
for v in self.variants.variants:
|
||||||
for v in self.variants.variants:
|
v.connect_doc(doc)
|
||||||
doc.connect_member(v)
|
|
||||||
|
|
||||||
def c_type(self):
|
def c_type(self):
|
||||||
return c_name(self.name) + pointer_suffix
|
return c_name(self.name) + pointer_suffix
|
||||||
|
@ -627,6 +624,10 @@ class QAPISchemaMember:
|
||||||
% (self.describe(info), seen[cname].describe(info)))
|
% (self.describe(info), seen[cname].describe(info)))
|
||||||
seen[cname] = self
|
seen[cname] = self
|
||||||
|
|
||||||
|
def connect_doc(self, doc):
|
||||||
|
if doc:
|
||||||
|
doc.connect_member(self)
|
||||||
|
|
||||||
def describe(self, info):
|
def describe(self, info):
|
||||||
role = self.role
|
role = self.role
|
||||||
defined_in = self.defined_in
|
defined_in = self.defined_in
|
||||||
|
|
Loading…
Reference in New Issue