mirror of https://gitee.com/openkylin/qemu.git
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>
This commit is contained in:
parent
b66c62a2d3
commit
926bb8add7
|
@ -171,6 +171,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:
|
||||
|
@ -181,10 +185,6 @@ def check_type(value, info, source,
|
|||
source)
|
||||
return
|
||||
|
||||
# Type name
|
||||
if isinstance(value, str):
|
||||
return
|
||||
|
||||
# Anonymous type
|
||||
|
||||
if not allow_dict:
|
||||
|
|
Loading…
Reference in New Issue