summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2019-09-27 15:46:28 +0200
committerMarkus Armbruster <armbru@redhat.com>2019-09-28 17:17:19 +0200
commit77daece3d95dc7edaa5982fbbfd7afe3bc4121ac (patch)
treeaab5a1fca887d02f6e5fde7cedb554673afd9c64
parente6f9678da5371642e237d6d93595dbc11bd17f85 (diff)
downloadfocaccia-qemu-77daece3d95dc7edaa5982fbbfd7afe3bc4121ac.tar.gz
focaccia-qemu-77daece3d95dc7edaa5982fbbfd7afe3bc4121ac.zip
qapi: Inline check_name() into check_union()
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 <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20190927134639.4284-16-armbru@redhat.com>
-rw-r--r--scripts/qapi/common.py6
1 files 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,