[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 06/14] qapi: Simplify code a bit after previous commit
From: |
Markus Armbruster |
Subject: |
[PATCH 06/14] qapi: Simplify code a bit after previous commit |
Date: |
Thu, 16 Mar 2023 08:13:17 +0100 |
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
scripts/qapi/expr.py | 14 +++-----------
1 file changed, 3 insertions(+), 11 deletions(-)
diff --git a/scripts/qapi/expr.py b/scripts/qapi/expr.py
index 5abeaa19dd..8a8de9e3aa 100644
--- a/scripts/qapi/expr.py
+++ b/scripts/qapi/expr.py
@@ -335,21 +335,13 @@ def normalize_members(members: object) -> None:
def check_type_name(value: Optional[object],
info: QAPISourceInfo, source: str) -> None:
- if value is None:
- return
-
- if isinstance(value, str):
- return
-
- raise QAPISemError(info, "%s should be a type name" % source)
+ if value is not None and not isinstance(value, str):
+ raise QAPISemError(info, "%s should be a type name" % source)
def check_type_name_or_array(value: Optional[object],
info: QAPISourceInfo, source: str) -> None:
- if value is None:
- return
-
- if isinstance(value, str):
+ if value is None or isinstance(value, str):
return
if isinstance(value, list):
--
2.39.2
- Re: [PATCH 08/14] qapi: Fix to reject 'data': 'mumble' in struct, (continued)
- [PATCH 12/14] tests/qapi-schema: Cover optional conditional struct member, Markus Armbruster, 2023/03/16
- [PATCH 14/14] qapi: Require boxed for conditional command and event arguments, Markus Armbruster, 2023/03/16
- [PATCH 04/14] qapi: Split up check_type(), Markus Armbruster, 2023/03/16
- [PATCH 03/14] qapi: Clean up after removal of simple unions, Markus Armbruster, 2023/03/16
- [PATCH 06/14] qapi: Simplify code a bit after previous commit,
Markus Armbruster <=
- [PATCH 09/14] tests/qapi-schema: Improve union discriminator coverage, Markus Armbruster, 2023/03/16
- [PATCH 07/14] qapi: Fix error message when type name or array is expected, Markus Armbruster, 2023/03/16
- [PATCH 10/14] tests/qapi-schema: Rename a few conditionals, Markus Armbruster, 2023/03/16