qapi: New QAPISchemaBranches, QAPISchemaAlternatives
commit1d067e3953e76af28ba20c995b176fcbcb7a10aa
authorMarkus Armbruster <armbru@redhat.com>
Fri, 15 Mar 2024 19:32:41 +0000 (15 20:32 +0100)
committerMarkus Armbruster <armbru@redhat.com>
Mon, 6 May 2024 10:38:27 +0000 (6 12:38 +0200)
treee786d595fe7beb4ff37a9a783d1fb2338ded537b
parent248f6f62df073a3b4158fd0093863ab885feabb5
qapi: New QAPISchemaBranches, QAPISchemaAlternatives

QAPISchemaVariants represents either a union type's branches, or an
alternate type's alternatives.  Much of its code is conditional on
which one it actually is.

Create QAPISchemaBranches for branches, and QAPISchemaAlternatives for
alternatives, both subtypes of QAPISchemaVariants.

Replace QAPISchemaVariants by one of them where possible.  Keep it
only where we actually deal with either of them.

QAPISchemaVariants.__init__() takes @tag_name and @tag_member, where
exactly one must be None: @tag_name for alternatives, @tag_member for
branches.  Let QAPISchemaBranches.__init__() take just @tag_name, and
QAPISchemaAlternatives.__init__() take just @tag_member.

A later patch will move the conditional code to the subtypes.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
scripts/qapi/introspect.py
scripts/qapi/schema.py
scripts/qapi/types.py
scripts/qapi/visit.py