mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-27 04:13:53 -06:00
qapi-schema: support alternates with array type
Detect array types as alternate branches, and turn the JSON list into a QAPISchemaArrayType. Array types in an alternate are represented with QTYPE_QLIST in the type field. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <20220321164243.200569-2-pbonzini@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
parent
9c125d17e9
commit
a58069494d
5 changed files with 23 additions and 5 deletions
|
@ -243,6 +243,7 @@ class QAPISchemaType(QAPISchemaEntity):
|
|||
'number': 'QTYPE_QNUM',
|
||||
'int': 'QTYPE_QNUM',
|
||||
'boolean': 'QTYPE_QBOOL',
|
||||
'array': 'QTYPE_QLIST',
|
||||
'object': 'QTYPE_QDICT'
|
||||
}
|
||||
return json2qtype.get(self.json_type())
|
||||
|
@ -1069,6 +1070,9 @@ class QAPISchema:
|
|||
None))
|
||||
|
||||
def _make_variant(self, case, typ, ifcond, info):
|
||||
if isinstance(typ, list):
|
||||
assert len(typ) == 1
|
||||
typ = self._make_array_type(typ[0], info)
|
||||
return QAPISchemaVariant(case, info, typ, ifcond)
|
||||
|
||||
def _def_union_type(self, expr, info, doc):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue