mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-27 20:33:54 -06:00
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>
This commit is contained in:
parent
e6f9678da5
commit
77daece3d9
1 changed files with 4 additions and 2 deletions
|
@ -897,8 +897,10 @@ def check_union(expr, info):
|
||||||
|
|
||||||
# The value of member 'discriminator' must name a non-optional
|
# The value of member 'discriminator' must name a non-optional
|
||||||
# member of the base struct.
|
# member of the base struct.
|
||||||
check_name(discriminator, info,
|
check_name_is_str(discriminator, info,
|
||||||
"discriminator of flat union '%s'" % name)
|
"discriminator of flat union '%s'" % name)
|
||||||
|
check_name_str(discriminator, info,
|
||||||
|
"discriminator of flat union '%s'" % name)
|
||||||
discriminator_value = base_members.get(discriminator)
|
discriminator_value = base_members.get(discriminator)
|
||||||
if not discriminator_value:
|
if not discriminator_value:
|
||||||
raise QAPISemError(info,
|
raise QAPISemError(info,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue