]> git.proxmox.com Git - mirror_qemu.git/commitdiff
qapi: Inline check_name() into check_union()
authorMarkus Armbruster <armbru@redhat.com>
Fri, 27 Sep 2019 13:46:28 +0000 (15:46 +0200)
committerMarkus Armbruster <armbru@redhat.com>
Sat, 28 Sep 2019 15:17:19 +0000 (17:17 +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 <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20190927134639.4284-16-armbru@redhat.com>

scripts/qapi/common.py

index 88945804dc0107fc866d09785f90b656b0b0a262..9acff01d3ebbebcb49700f8f84bd8d88375d740d 100644 (file)
@@ -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,