Browse Source

qapi/expr.py: move string check upwards in check_type

For readability purposes only, shimmy the early return upwards to the
top of the function, so cases proceed in order from least to most
complex.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Cleber Rosa <crosa@redhat.com>
Message-Id: <20210421182032.3521476-7-jsnow@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
John Snow 4 years ago
parent
commit
926bb8add7
1 changed files with 4 additions and 4 deletions
  1. 4 4
      scripts/qapi/expr.py

+ 4 - 4
scripts/qapi/expr.py

@@ -171,6 +171,10 @@ def check_type(value, info, source,
     if value is None:
     if value is None:
         return
         return
 
 
+    # Type name
+    if isinstance(value, str):
+        return
+
     # Array type
     # Array type
     if isinstance(value, list):
     if isinstance(value, list):
         if not allow_array:
         if not allow_array:
@@ -181,10 +185,6 @@ def check_type(value, info, source,
                                source)
                                source)
         return
         return
 
 
-    # Type name
-    if isinstance(value, str):
-        return
-
     # Anonymous type
     # Anonymous type
 
 
     if not allow_dict:
     if not allow_dict: