mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 07:13:54 -06:00
qapi: union_types is a list used like a dict, make it one
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <1489582656-31133-45-git-send-email-armbru@redhat.com>
This commit is contained in:
parent
ed285bf821
commit
768562ded0
1 changed files with 3 additions and 16 deletions
|
@ -48,7 +48,7 @@ name_case_whitelist = []
|
||||||
|
|
||||||
enum_types = {}
|
enum_types = {}
|
||||||
struct_types = {}
|
struct_types = {}
|
||||||
union_types = []
|
union_types = {}
|
||||||
all_names = {}
|
all_names = {}
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -569,7 +569,7 @@ def find_alternate_member_qtype(qapi_type):
|
||||||
return 'QTYPE_QDICT'
|
return 'QTYPE_QDICT'
|
||||||
elif qapi_type in enum_types:
|
elif qapi_type in enum_types:
|
||||||
return 'QTYPE_QSTRING'
|
return 'QTYPE_QSTRING'
|
||||||
elif find_union(qapi_type):
|
elif qapi_type in union_types:
|
||||||
return 'QTYPE_QDICT'
|
return 'QTYPE_QDICT'
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
@ -638,19 +638,6 @@ def add_name(name, info, meta, implicit=False):
|
||||||
all_names[name] = meta
|
all_names[name] = meta
|
||||||
|
|
||||||
|
|
||||||
def add_union(definition, info):
|
|
||||||
global union_types
|
|
||||||
union_types.append(definition)
|
|
||||||
|
|
||||||
|
|
||||||
def find_union(name):
|
|
||||||
global union_types
|
|
||||||
for union in union_types:
|
|
||||||
if union['union'] == name:
|
|
||||||
return union
|
|
||||||
return None
|
|
||||||
|
|
||||||
|
|
||||||
def check_type(info, source, value, allow_array=False,
|
def check_type(info, source, value, allow_array=False,
|
||||||
allow_dict=False, allow_optional=False,
|
allow_dict=False, allow_optional=False,
|
||||||
allow_metas=[]):
|
allow_metas=[]):
|
||||||
|
@ -908,7 +895,7 @@ def check_exprs(exprs):
|
||||||
meta = 'union'
|
meta = 'union'
|
||||||
check_keys(expr_elem, 'union', ['data'],
|
check_keys(expr_elem, 'union', ['data'],
|
||||||
['base', 'discriminator'])
|
['base', 'discriminator'])
|
||||||
add_union(expr, info)
|
union_types[expr[meta]] = expr
|
||||||
elif 'alternate' in expr:
|
elif 'alternate' in expr:
|
||||||
meta = 'alternate'
|
meta = 'alternate'
|
||||||
check_keys(expr_elem, 'alternate', ['data'])
|
check_keys(expr_elem, 'alternate', ['data'])
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue