summary refs log tree commit diff stats
path: root/scripts/qapi-types.py
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2015-10-12 22:22:27 -0600
committerMarkus Armbruster <armbru@redhat.com>2015-10-15 08:39:08 +0200
commit49823c4b4304a3e4aa5d67e089946b12d6a52d64 (patch)
treeb28a72ee09d0f1a635de4e8be236230f818634ba /scripts/qapi-types.py
parent849ab13c1657b51b89693282ddd42ca1f6255354 (diff)
downloadfocaccia-qemu-49823c4b4304a3e4aa5d67e089946b12d6a52d64.tar.gz
focaccia-qemu-49823c4b4304a3e4aa5d67e089946b12d6a52d64.zip
qapi: Don't use info as witness of implicit object type
A future patch will enable error reporting from the various
QAPISchema*.check() methods.  But to report an error related
to an implicit type, we'll need to associate a location with
the type (the same location as the top-level entity that is
causing the creation of the implicit type), and once we do
that, keying off of whether foo.info exists is no longer a
viable way to determine if foo is an implicit type.

Instead, add an is_implicit() method to QAPISchemaEntity, and use it.
It can be overridden later for ObjectType and EnumType, when implicit
instances of those classes gain info.

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1444710158-8723-8-git-send-email-eblake@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'scripts/qapi-types.py')
-rw-r--r--scripts/qapi-types.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/scripts/qapi-types.py b/scripts/qapi-types.py
index 2a29c6e106..4fe618ef3c 100644
--- a/scripts/qapi-types.py
+++ b/scripts/qapi-types.py
@@ -235,7 +235,8 @@ class QAPISchemaGenTypeVisitor(QAPISchemaVisitor):
 
     def visit_needed(self, entity):
         # Visit everything except implicit objects
-        return not isinstance(entity, QAPISchemaObjectType) or entity.info
+        return not (entity.is_implicit() and
+                    isinstance(entity, QAPISchemaObjectType))
 
     def _gen_type_cleanup(self, name):
         self.decl += gen_type_cleanup_decl(name)