diff options
author | Eric Blake <eblake@redhat.com> | 2016-07-13 21:50:15 -0600 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2016-07-19 13:21:08 +0200 |
commit | da9cb19385fc66b2cb2584bbbbcbf50246d057e2 (patch) | |
tree | cd58d2df5b69114b3fd82c8d5df05a5534c8addc /scripts | |
parent | cd50a2564560986e865ff64fa73b59d2564076f0 (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 'scripts')
-rw-r--r-- | scripts/qapi.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/scripts/qapi.py b/scripts/qapi.py index 68ee31903e..400c4ef4a6 100644 --- a/scripts/qapi.py +++ b/scripts/qapi.py @@ -1093,7 +1093,7 @@ class QAPISchemaObjectTypeVariants(object): assert len(variants) > 0 for v in variants: assert isinstance(v, QAPISchemaObjectTypeVariant) - self.tag_name = tag_name + self._tag_name = tag_name self.tag_member = tag_member self.variants = variants @@ -1103,8 +1103,8 @@ class QAPISchemaObjectTypeVariants(object): def check(self, schema, seen): if not self.tag_member: # flat union - self.tag_member = seen[c_name(self.tag_name)] - assert self.tag_name == self.tag_member.name + self.tag_member = seen[c_name(self._tag_name)] + assert self._tag_name == self.tag_member.name assert isinstance(self.tag_member.type, QAPISchemaEnumType) for v in self.variants: v.check(schema) @@ -1134,7 +1134,7 @@ class QAPISchemaAlternateType(QAPISchemaType): def __init__(self, name, info, variants): QAPISchemaType.__init__(self, name, info) assert isinstance(variants, QAPISchemaObjectTypeVariants) - assert not variants.tag_name + assert variants.tag_member variants.set_owner(name) variants.tag_member.set_owner(self.name) self.variants = variants |