mirror of https://gitee.com/openkylin/qemu.git
qapi: Eliminate .check_doc() overrides
All sub-classes of QAPISchemaEntity now override .check_doc() the same way, except for QAPISchemaType and and QAPISchemaArrayType. Put the overrides' code in QAPISchemaEntity.check_doc(), and drop the overrides. QAPISchemaType doesn't care because it's abstract. QAPISchemaArrayType doesn't care because its .doc is always None. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20191024110237.30963-14-armbru@redhat.com>
This commit is contained in:
parent
a710e1c8c3
commit
1192a4862b
|
@ -55,7 +55,8 @@ def connect_doc(self, doc=None):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def check_doc(self):
|
def check_doc(self):
|
||||||
pass
|
if self.doc:
|
||||||
|
self.doc.check()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def ifcond(self):
|
def ifcond(self):
|
||||||
|
@ -230,10 +231,6 @@ def connect_doc(self, doc=None):
|
||||||
for m in self.members:
|
for m in self.members:
|
||||||
doc.connect_member(m)
|
doc.connect_member(m)
|
||||||
|
|
||||||
def check_doc(self):
|
|
||||||
if self.doc:
|
|
||||||
self.doc.check()
|
|
||||||
|
|
||||||
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()
|
||||||
return self.name.endswith('Kind') or self.name == 'QType'
|
return self.name.endswith('Kind') or self.name == 'QType'
|
||||||
|
@ -389,10 +386,6 @@ def connect_doc(self, doc=None):
|
||||||
for m in self.local_members:
|
for m in self.local_members:
|
||||||
doc.connect_member(m)
|
doc.connect_member(m)
|
||||||
|
|
||||||
def check_doc(self):
|
|
||||||
if self.doc:
|
|
||||||
self.doc.check()
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def ifcond(self):
|
def ifcond(self):
|
||||||
assert self._checked
|
assert self._checked
|
||||||
|
@ -667,10 +660,6 @@ def connect_doc(self, doc=None):
|
||||||
for v in self.variants.variants:
|
for v in self.variants.variants:
|
||||||
doc.connect_member(v)
|
doc.connect_member(v)
|
||||||
|
|
||||||
def check_doc(self):
|
|
||||||
if self.doc:
|
|
||||||
self.doc.check()
|
|
||||||
|
|
||||||
def c_type(self):
|
def c_type(self):
|
||||||
return c_name(self.name) + pointer_suffix
|
return c_name(self.name) + pointer_suffix
|
||||||
|
|
||||||
|
@ -745,10 +734,6 @@ def connect_doc(self, doc=None):
|
||||||
if self.arg_type and self.arg_type.is_implicit():
|
if self.arg_type and self.arg_type.is_implicit():
|
||||||
self.arg_type.connect_doc(doc)
|
self.arg_type.connect_doc(doc)
|
||||||
|
|
||||||
def check_doc(self):
|
|
||||||
if self.doc:
|
|
||||||
self.doc.check()
|
|
||||||
|
|
||||||
def visit(self, visitor):
|
def visit(self, visitor):
|
||||||
QAPISchemaEntity.visit(self, visitor)
|
QAPISchemaEntity.visit(self, visitor)
|
||||||
visitor.visit_command(self.name, self.info, self.ifcond,
|
visitor.visit_command(self.name, self.info, self.ifcond,
|
||||||
|
@ -791,10 +776,6 @@ def connect_doc(self, doc=None):
|
||||||
if self.arg_type and self.arg_type.is_implicit():
|
if self.arg_type and self.arg_type.is_implicit():
|
||||||
self.arg_type.connect_doc(doc)
|
self.arg_type.connect_doc(doc)
|
||||||
|
|
||||||
def check_doc(self):
|
|
||||||
if self.doc:
|
|
||||||
self.doc.check()
|
|
||||||
|
|
||||||
def visit(self, visitor):
|
def visit(self, visitor):
|
||||||
QAPISchemaEntity.visit(self, visitor)
|
QAPISchemaEntity.visit(self, visitor)
|
||||||
visitor.visit_event(self.name, self.info, self.ifcond,
|
visitor.visit_event(self.name, self.info, self.ifcond,
|
||||||
|
|
Loading…
Reference in New Issue