qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 04/25] qapi/schema.py: constrain QAPISchemaObjectType base type


From: John Snow
Subject: [PATCH 04/25] qapi/schema.py: constrain QAPISchemaObjectType base type
Date: Tue, 22 Sep 2020 18:44:40 -0400

Re-order check slightly so we can provide a stronger guarantee on the
typing of the base field.

Signed-off-by: John Snow <jsnow@redhat.com>
---
 scripts/qapi/schema.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py
index a53631e660..3aa842be08 100644
--- a/scripts/qapi/schema.py
+++ b/scripts/qapi/schema.py
@@ -378,14 +378,14 @@ def check(self, schema):
 
         seen = OrderedDict()
         if self._base_name:
-            self.base = schema.resolve_type(self._base_name, self.info,
-                                            "'base'")
-            if (not isinstance(self.base, QAPISchemaObjectType)
-                    or self.base.variants):
+            base = schema.resolve_type(self._base_name, self.info, "'base'")
+            if (not isinstance(base, QAPISchemaObjectType)
+                    or base.variants):
                 raise QAPISemError(
                     self.info,
                     "'base' requires a struct type, %s isn't"
-                    % self.base.describe())
+                    % base.describe())
+            self.base = base
             self.base.check(schema)
             self.base.check_clash(self.info, seen)
         for m in self.local_members:
-- 
2.26.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]