aboutsummaryrefslogtreecommitdiff
path: root/tests/qapi-schema
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2016-07-13 21:50:15 -0600
committerMarkus Armbruster <armbru@redhat.com>2016-07-19 13:21:08 +0200
commitda9cb19385fc66b2cb2584bbbbcbf50246d057e2 (patch)
treecd58d2df5b69114b3fd82c8d5df05a5534c8addc /tests/qapi-schema
parentcd50a2564560986e865ff64fa73b59d2564076f0 (diff)
qapi: Hide tag_name data member of variants
Clean up the only remaining external use of the tag_name field of QAPISchemaObjectTypeVariants, by explicitly listing the generated 'type' tag for all variants in the testsuite (you can still tell simple unions by the -wrapper types). Then we can mark the tag_name field as private by adding a leading underscore to prevent any further use. Signed-off-by: Eric Blake <eblake@redhat.com> Message-Id: <1468468228-27827-5-git-send-email-eblake@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'tests/qapi-schema')
-rw-r--r--tests/qapi-schema/qapi-schema-test.out10
-rw-r--r--tests/qapi-schema/test-qapi.py3
2 files changed, 11 insertions, 2 deletions
diff --git a/tests/qapi-schema/qapi-schema-test.out b/tests/qapi-schema/qapi-schema-test.out
index 19cd214f6b..f34ecc71cd 100644
--- a/tests/qapi-schema/qapi-schema-test.out
+++ b/tests/qapi-schema/qapi-schema-test.out
@@ -1,19 +1,25 @@
alternate AltIntNum
+ tag type
case i: int
case n: number
alternate AltNumInt
+ tag type
case n: number
case i: int
alternate AltNumStr
+ tag type
case n: number
case s: str
alternate AltStrBool
+ tag type
case s: str
case b: bool
alternate AltStrInt
+ tag type
case s: str
case i: int
alternate AltStrNum
+ tag type
case s: str
case n: number
event EVENT_A None
@@ -50,6 +56,7 @@ object UserDefA
member boolean: bool optional=False
member a_b: int optional=True
alternate UserDefAlternate
+ tag type
case udfu: UserDefFlatUnion
case s: str
case i: int
@@ -72,6 +79,7 @@ object UserDefFlatUnion2
case value2: UserDefB
object UserDefNativeListUnion
member type: UserDefNativeListUnionKind optional=False
+ tag type
case integer: q_obj_intList-wrapper
case s8: q_obj_int8List-wrapper
case s16: q_obj_int16List-wrapper
@@ -117,6 +125,7 @@ object WrapAlternate
member alt: UserDefAlternate optional=False
event __ORG.QEMU_X-EVENT __org.qemu_x-Struct
alternate __org.qemu_x-Alt
+ tag type
case __org.qemu_x-branch: str
case b: __org.qemu_x-Base
object __org.qemu_x-Base
@@ -130,6 +139,7 @@ object __org.qemu_x-Struct2
member array: __org.qemu_x-Union1List optional=False
object __org.qemu_x-Union1
member type: __org.qemu_x-Union1Kind optional=False
+ tag type
case __org.qemu_x-branch: q_obj_str-wrapper
enum __org.qemu_x-Union1Kind ['__org.qemu_x-branch']
object __org.qemu_x-Union2
diff --git a/tests/qapi-schema/test-qapi.py b/tests/qapi-schema/test-qapi.py
index 649677e017..bedd145452 100644
--- a/tests/qapi-schema/test-qapi.py
+++ b/tests/qapi-schema/test-qapi.py
@@ -47,8 +47,7 @@ class QAPISchemaTestVisitor(QAPISchemaVisitor):
@staticmethod
def _print_variants(variants):
if variants:
- if variants.tag_name:
- print ' tag %s' % variants.tag_name
+ print ' tag %s' % variants.tag_member.name
for v in variants.variants:
print ' case %s: %s' % (v.name, v.type.name)