[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 15/26] qapi: Inline check_name() into check_union()
From: |
Markus Armbruster |
Subject: |
[PATCH v2 15/26] qapi: Inline check_name() into check_union() |
Date: |
Fri, 27 Sep 2019 15:46:28 +0200 |
check_name() consists of check_name_is_str() and check_name_str().
check_union() relies on the latter to catch optional discriminators.
The next commit will replace that by a more straightforward check.
Inlining check_name() into check_union() now should make that easier
to review.
Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
---
scripts/qapi/common.py | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/scripts/qapi/common.py b/scripts/qapi/common.py
index 88945804dc..9acff01d3e 100644
--- a/scripts/qapi/common.py
+++ b/scripts/qapi/common.py
@@ -897,8 +897,10 @@ def check_union(expr, info):
# The value of member 'discriminator' must name a non-optional
# member of the base struct.
- check_name(discriminator, info,
- "discriminator of flat union '%s'" % name)
+ check_name_is_str(discriminator, info,
+ "discriminator of flat union '%s'" % name)
+ check_name_str(discriminator, info,
+ "discriminator of flat union '%s'" % name)
discriminator_value = base_members.get(discriminator)
if not discriminator_value:
raise QAPISemError(info,
--
2.21.0
- [PATCH v2 00/26] qapi: Pay back some frontend technical debt, Markus Armbruster, 2019/09/27
- [PATCH v2 01/26] qapi: Tighten QAPISchemaFOO.check() assertions, Markus Armbruster, 2019/09/27
- [PATCH v2 03/26] qapi: New QAPISourceInfo, replacing dict, Markus Armbruster, 2019/09/27
- [PATCH v2 10/26] qapi: Use check_name_str() where it suffices, Markus Armbruster, 2019/09/27
- [PATCH v2 02/26] qapi: Rename .owner to .defined_in, Markus Armbruster, 2019/09/27
- [PATCH v2 22/26] qapi: Improve reporting of invalid 'if' further, Markus Armbruster, 2019/09/27
- [PATCH v2 25/26] qapi: Improve reporting of redefinition, Markus Armbruster, 2019/09/27
- [PATCH v2 13/26] qapi: Make check_type()'s array case a bit more obvious, Markus Armbruster, 2019/09/27
- [PATCH v2 19/26] qapi: Improve reporting of invalid flags, Markus Armbruster, 2019/09/27
- [PATCH v2 07/26] qapi: Improve reporting of member name clashes, Markus Armbruster, 2019/09/27
- [PATCH v2 15/26] qapi: Inline check_name() into check_union(),
Markus Armbruster <=
- [PATCH v2 11/26] qapi: Report invalid '*' prefix like any other invalid name, Markus Armbruster, 2019/09/27
- [PATCH v2 17/26] qapi: Move context-free checking to the proper place, Markus Armbruster, 2019/09/27
- [PATCH v2 09/26] qapi: Improve reporting of invalid name errors, Markus Armbruster, 2019/09/27
- [PATCH v2 12/26] qapi: Move check for reserved names out of add_name(), Markus Armbruster, 2019/09/27
- [PATCH v2 21/26] qapi: Avoid redundant definition references in error messages, Markus Armbruster, 2019/09/27
- [PATCH v2 04/26] qapi: Prefix frontend errors with an "in definition" line, Markus Armbruster, 2019/09/27
- [PATCH v2 18/26] qapi: Improve reporting of invalid 'if' errors, Markus Armbruster, 2019/09/27
- [PATCH v2 08/26] qapi: Reorder check_FOO() parameters for consistency, Markus Armbruster, 2019/09/27
- [PATCH v2 05/26] qapi: Clean up member name case checking, Markus Armbruster, 2019/09/27