diff options
author | Markus Armbruster | 2019-10-24 13:02:28 +0200 |
---|---|---|
committer | Markus Armbruster | 2019-10-29 07:35:16 +0100 |
commit | 7faefad184201b10c2db4270b2bb93e2a5e9552b (patch) | |
tree | 51f5bb310f6c83e0746d388f837a76a85411f3e5 /tests/qapi-schema/doc-bad-event-arg.json | |
parent | qapi: Fix enum doc comment checking (diff) | |
download | qemu-7faefad184201b10c2db4270b2bb93e2a5e9552b.tar.gz qemu-7faefad184201b10c2db4270b2bb93e2a5e9552b.tar.xz qemu-7faefad184201b10c2db4270b2bb93e2a5e9552b.zip |
qapi: Clean up doc comment checking for implicit union base
An object type's doc comment describes the type's members, less the
ones defined in a named base type. Cases:
* Struct: the members are defined in 'data' and inherited from 'base'.
Since the base type cannot be implicit, the doc comment describes
just 'data'.
* Simple union: the only member is the implicit tag member @type, and
the doc comment describes it.
* Flat union with implicit base type: the members are defined in
'base', and the doc comment describes it.
* Flat union with named base type: the members are inherited from
'base'. The doc comment describes no members.
Before we can check a doc comment with .check_doc(), we need
.connect_doc() connect each of its "argument sections" to the member
it documents.
For structs and simple unions, this is straightforward: the members in
question are in .local_members, and .connect_doc() connects them.
For flat unions with a named base type, it's trivial: .local_members
is empty, and .connect_doc() does nothing.
For flat unions with an implicit base type, it's tricky. We have
QAPISchema._make_implicit_object_type() forward the union's doc
comment to the implicit base type, so that the base type's
.connect_doc() connects the members. The union's .connect_doc() does
nothing, as .local_members is empty.
Dirt effect: we check the doc comment twice, once for the union type,
and once for the implicit base type.
This is needlessly brittle and hard to understand. Clean up as
follows. Make the union's .connect_doc() connect an implicit base's
members itself. Do not forward the union's doc comment to its
implicit base type.
Requires extending .connect_doc() so it can work with a doc comment
other than self.doc. Add an optional argument for that.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20191024110237.30963-11-armbru@redhat.com>
Diffstat (limited to 'tests/qapi-schema/doc-bad-event-arg.json')
0 files changed, 0 insertions, 0 deletions