mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-30 22:03:54 -06:00
docs/qapidoc: add visit_returns() method
Generates :return: fields for explicit returns statements. Note that this does not presently handle undocumented returns, which is handled in a later commit. Signed-off-by: John Snow <jsnow@redhat.com> Message-ID: <20250311034303.75779-51-jsnow@redhat.com> Acked-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
parent
38a349ff5b
commit
52c806cad0
1 changed files with 15 additions and 0 deletions
|
@ -41,6 +41,7 @@ from qapi.parser import QAPIDoc
|
||||||
from qapi.schema import (
|
from qapi.schema import (
|
||||||
QAPISchema,
|
QAPISchema,
|
||||||
QAPISchemaArrayType,
|
QAPISchemaArrayType,
|
||||||
|
QAPISchemaCommand,
|
||||||
QAPISchemaDefinition,
|
QAPISchemaDefinition,
|
||||||
QAPISchemaEnumMember,
|
QAPISchemaEnumMember,
|
||||||
QAPISchemaFeature,
|
QAPISchemaFeature,
|
||||||
|
@ -210,6 +211,20 @@ class Transmogrifier:
|
||||||
|
|
||||||
self.generate_field("feat", section.member, section.text, section.info)
|
self.generate_field("feat", section.member, section.text, section.info)
|
||||||
|
|
||||||
|
def visit_returns(self, section: QAPIDoc.Section) -> None:
|
||||||
|
assert isinstance(self.entity, QAPISchemaCommand)
|
||||||
|
rtype = self.entity.ret_type
|
||||||
|
# q_empty can produce None, but we won't be documenting anything
|
||||||
|
# without an explicit return statement in the doc block, and we
|
||||||
|
# should not have any such explicit statements when there is no
|
||||||
|
# return value.
|
||||||
|
assert rtype
|
||||||
|
|
||||||
|
typ = self.format_type(rtype)
|
||||||
|
assert typ
|
||||||
|
assert section.text
|
||||||
|
self.add_field("return", typ, section.text, section.info)
|
||||||
|
|
||||||
def visit_errors(self, section: QAPIDoc.Section) -> None:
|
def visit_errors(self, section: QAPIDoc.Section) -> None:
|
||||||
# FIXME: the formatting for errors may be inconsistent and may
|
# FIXME: the formatting for errors may be inconsistent and may
|
||||||
# or may not require different newline placement to ensure
|
# or may not require different newline placement to ensure
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue