diff mbox

[RFC,v4,02/32] qapi: New QAPISchema intermediate reperesentation

Message ID 55E90A62.6010200@redhat.com
State New
Headers show

Commit Message

Eric Blake Sept. 4, 2015, 3:05 a.m. UTC
On 09/03/2015 08:29 AM, Markus Armbruster wrote:
> The QAPI code generators work with a syntax tree (nested dictionaries)
> plus a few symbol tables (also dictionaries) on the side.
> 

> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> Reviewed-by: Eric Blake <eblake@redhat.com>
> ---

> +class QAPISchemaObjectTypeVariants(object):
> +    def __init__(self, tag_name, tag_enum, variants):
> +        assert tag_name == None or isinstance(tag_name, str)
> +        assert tag_enum == None or isinstance(tag_enum, str)
> +        for v in variants:
> +            assert isinstance(v, QAPISchemaObjectTypeVariant)
> +        self.tag_name = tag_name
> +        if tag_name:
> +            assert not tag_enum
> +            self.tag_member = None
> +        else:
> +            self.tag_member = QAPISchemaObjectTypeMember('kind', tag_enum,
> +                                                         False)

See my review on 30/32.  Introspection-wise, we want this generated
member to be named 'type' to match what is on the wire.  This patch,
plus two more to qapi-types.py and qapi-visit.py, are sufficient to make
no changes to the other generated files, while fixing the bug in
qmp-introspect.c:
diff mbox

Patch

diff --git i/scripts/qapi.py w/scripts/qapi.py
index d2b6964..b2643af 100644
--- i/scripts/qapi.py
+++ w/scripts/qapi.py
@@ -928,7 +928,7 @@  class QAPISchemaObjectTypeVariants(object):
             assert not tag_enum
             self.tag_member = None
         else:
-            self.tag_member = QAPISchemaObjectTypeMember('kind', tag_enum,
+            self.tag_member = QAPISchemaObjectTypeMember('type', tag_enum,
                                                          False)
         self.variants = variants
     def check(self, schema, members, seen):