diff options
author | John Snow <jsnow@redhat.com> | 2021-09-30 16:57:10 -0400 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2021-10-02 07:33:42 +0200 |
commit | f4c05aaf148a44d80855eb45b9342feaeeb4764a (patch) | |
tree | 64bd532191e41f1ad2912a02cc2ebf35d747debf /monitor | |
parent | 1e20a77576dedf1489ce1cdb6abc4b34663637a4 (diff) | |
download | qemu-f4c05aaf148a44d80855eb45b9342feaeeb4764a.zip qemu-f4c05aaf148a44d80855eb45b9342feaeeb4764a.tar.gz qemu-f4c05aaf148a44d80855eb45b9342feaeeb4764a.tar.bz2 |
qapi/parser: Introduce NullSection
Here's the weird bit. QAPIDoc generally expects -- virtually everywhere
-- that it will always have a current section. The sole exception to
this is in the case that end_comment() is called, which leaves us with
*no* section. However, in this case, we also don't expect to actually
ever mutate the comment contents ever again.
NullSection is just a Null-object that allows us to maintain the
invariant that we *always* have a current section, enforced by static
typing -- allowing us to type that field as QAPIDoc.Section instead of
the more ambiguous Optional[QAPIDoc.Section].
end_section is renamed to switch_section and now accepts as an argument
the new section to activate, clarifying that no callers ever just
unilaterally end a section; they only do so when starting a new section.
Signed-off-by: John Snow <jsnow@redhat.com>
Message-Id: <20210930205716.1148693-8-jsnow@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'monitor')
0 files changed, 0 insertions, 0 deletions