summaryrefslogtreecommitdiffstats
path: root/scripts/qapi/introspect.py
diff options
context:
space:
mode:
authorMarc-André Lureau2018-12-13 13:37:04 +0100
committerMarkus Armbruster2018-12-13 19:20:11 +0100
commit1962bd39d567e8b44646e558b07b2742a5a61339 (patch)
tree0e9ed5c1470126b4547db126d9286b3d9dbb92af /scripts/qapi/introspect.py
parentqapi: Do not define enumeration value explicitly (diff)
downloadqemu-1962bd39d567e8b44646e558b07b2742a5a61339.tar.gz
qemu-1962bd39d567e8b44646e558b07b2742a5a61339.tar.xz
qemu-1962bd39d567e8b44646e558b07b2742a5a61339.zip
qapi: change enum visitor and gen_enum* to take QAPISchemaMember
This will allow to add and access more properties associated with enum values/members, like the associated 'if' condition. We may want to have a specialized type QAPISchemaEnumMember, for now this will do. Modify gen_enum() and gen_enum_lookup() for the same reason. Suggested-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20181213123724.4866-3-marcandre.lureau@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'scripts/qapi/introspect.py')
-rw-r--r--scripts/qapi/introspect.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/scripts/qapi/introspect.py b/scripts/qapi/introspect.py
index 67d6106f77..417625d54b 100644
--- a/scripts/qapi/introspect.py
+++ b/scripts/qapi/introspect.py
@@ -174,8 +174,9 @@ const QLitObject %(c_name)s = %(c_string)s;
def visit_builtin_type(self, name, info, json_type):
self._gen_qlit(name, 'builtin', {'json-type': json_type}, [])
- def visit_enum_type(self, name, info, ifcond, values, prefix):
- self._gen_qlit(name, 'enum', {'values': values}, ifcond)
+ def visit_enum_type(self, name, info, ifcond, members, prefix):
+ self._gen_qlit(name, 'enum',
+ {'values': [m.name for m in members]}, ifcond)
def visit_array_type(self, name, info, ifcond, element_type):
element = self._use_type(element_type)