Message ID | 20190924132830.15835-16-armbru@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | qapi: Pay back some frontend technical debt | expand |
On 9/24/19 8:28 AM, Markus Armbruster wrote: > 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> > --- > scripts/qapi/common.py | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > Reviewed-by: Eric Blake <eblake@redhat.com>
diff --git a/scripts/qapi/common.py b/scripts/qapi/common.py index 2dd794dfe7..f5599559ac 100644 --- a/scripts/qapi/common.py +++ b/scripts/qapi/common.py @@ -896,8 +896,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,
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> --- scripts/qapi/common.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)