diff mbox series

[05/16] qapi/expr.py: move string check upwards in check_type

Message ID 20200922211313.4082880-6-jsnow@redhat.com
State Accepted
Commit 926bb8add7c549496c612fcd4a32f3cf37883c2a
Headers show
Series qapi: static typing conversion, pt2 | expand

Commit Message

John Snow Sept. 22, 2020, 9:13 p.m. UTC
It's a simple case, shimmy the early return upwards.

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

Comments

Eduardo Habkost Sept. 23, 2020, 7:56 p.m. UTC | #1
On Tue, Sep 22, 2020 at 05:13:02PM -0400, John Snow wrote:
> It's a simple case, shimmy the early return upwards.

> 

> Signed-off-by: John Snow <jsnow@redhat.com>


Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>


-- 
Eduardo
Cleber Rosa Sept. 25, 2020, 12:22 a.m. UTC | #2
On Tue, Sep 22, 2020 at 05:13:02PM -0400, John Snow wrote:
> It's a simple case, shimmy the early return upwards.

> 

> Signed-off-by: John Snow <jsnow@redhat.com>


I'm only acking this because of the very graphical "shimmy dance"
movie that played in my mind.

Reviewed-by: Cleber Rosa <crosa@redhat.com>
diff mbox series

Patch

diff --git a/scripts/qapi/expr.py b/scripts/qapi/expr.py
index 67892502e9..3f5af5f5e4 100644
--- a/scripts/qapi/expr.py
+++ b/scripts/qapi/expr.py
@@ -143,6 +143,10 @@  def check_type(value, info, source,
     if value is None:
         return
 
+    # Type name
+    if isinstance(value, str):
+        return
+
     # Array type
     if isinstance(value, list):
         if not allow_array:
@@ -153,10 +157,6 @@  def check_type(value, info, source,
                                source)
         return
 
-    # Type name
-    if isinstance(value, str):
-        return
-
     # Anonymous type
 
     if not allow_dict: