On 9/14/19 10:35 AM, Markus Armbruster wrote:
> We normalize shorthand to longhand forms in check_expr(): enumeration
> values with normalize_enum(), feature values with
> normalize_features(), struct members, union branches and alternate
> branches with normalize_members().  If conditions are an exception: we
> normalize them in QAPISchemaEntity.check() and
> QAPISchemaMember.__init(), with listify_cond().  The idea goes back to
> commit 2cbc94376e "qapi: pass 'if' condition into QAPISchemaEntity
> objects", v3.0.0.
> 
> Normalize in check_expr() instead, with new helper normalize_if().
> 
> Signed-off-by: Markus Armbruster <arm...@redhat.com>
> ---
>  scripts/qapi/common.py | 26 +++++++++++++++-----------
>  1 file changed, 15 insertions(+), 11 deletions(-)
> 

Definitely more consistent.


> @@ -904,6 +905,7 @@ def check_union(expr, info):
>          check_known_keys(info, "member '%s' of union '%s'" % (key, name),
>                           value, ['type'], ['if'])
>          check_if(value, info)
> +        normalize_if(value)

Is it worth combining check_if() and normalize_if() into a single helper
function, since they always seem to be paired?

Reviewed-by: Eric Blake <ebl...@redhat.com>


-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to