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>
This commit is contained in:
Marc-André Lureau 2018-12-13 16:37:04 +04:00 committed by Markus Armbruster
parent 9c2f56e9f9
commit 1962bd39d5
7 changed files with 28 additions and 26 deletions

View file

@ -23,8 +23,8 @@ class QAPISchemaTestVisitor(QAPISchemaVisitor):
def visit_include(self, name, info):
print('include %s' % name)
def visit_enum_type(self, name, info, ifcond, values, prefix):
print('enum %s %s' % (name, values))
def visit_enum_type(self, name, info, ifcond, members, prefix):
print('enum %s %s' % (name, [m.name for m in members]))
if prefix:
print(' prefix %s' % prefix)
self._print_if(ifcond)