mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-07-21 18:34:33 +00:00
qapi: Tighten check whether implicit object type already exists
Entities with names starting with q_obj_ are implicit object types. Therefore, QAPISchema._make_implicit_object_type()'s .lookup_entity() can only return a QAPISchemaObjectType. Assert that. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-ID: <20240315152301.3621858-25-armbru@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: John Snow <jsnow@redhat.com>
This commit is contained in:
parent
8d413dbd5d
commit
99e75d8c2a
|
@ -1297,8 +1297,9 @@ def _make_implicit_object_type(
|
||||||
return None
|
return None
|
||||||
# See also QAPISchemaObjectTypeMember.describe()
|
# See also QAPISchemaObjectTypeMember.describe()
|
||||||
name = 'q_obj_%s-%s' % (name, role)
|
name = 'q_obj_%s-%s' % (name, role)
|
||||||
typ = self.lookup_entity(name, QAPISchemaObjectType)
|
typ = self.lookup_entity(name)
|
||||||
if typ:
|
if typ:
|
||||||
|
assert(isinstance(typ, QAPISchemaObjectType))
|
||||||
# The implicit object type has multiple users. This can
|
# The implicit object type has multiple users. This can
|
||||||
# only be a duplicate definition, which will be flagged
|
# only be a duplicate definition, which will be flagged
|
||||||
# later.
|
# later.
|
||||||
|
|
Loading…
Reference in a new issue