提交 7e9c1707 编写于 作者: M Markus Armbruster

qapi: Tweak "command returns a nice type" check for clarity

Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
Message-Id: <20191120182551.23795-2-armbru@redhat.com>
Reviewed-by: NEric Blake <eblake@redhat.com>
上级 dc65a5bd
......@@ -711,10 +711,11 @@ class QAPISchemaCommand(QAPISchemaEntity):
self.ret_type = schema.resolve_type(
self._ret_type_name, self.info, "command's 'returns'")
if self.name not in self.info.pragma.returns_whitelist:
if not (isinstance(self.ret_type, QAPISchemaObjectType)
or (isinstance(self.ret_type, QAPISchemaArrayType)
and isinstance(self.ret_type.element_type,
QAPISchemaObjectType))):
typ = self.ret_type
if isinstance(typ, QAPISchemaArrayType):
typ = self.ret_type.element_type
assert typ
if not isinstance(typ, QAPISchemaObjectType):
raise QAPISemError(
self.info,
"command's 'returns' cannot take %s"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册