[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 36/38] qapi/visit.py: assert tag_member contains a QAPISch
From: |
Cleber Rosa |
Subject: |
Re: [PATCH v2 36/38] qapi/visit.py: assert tag_member contains a QAPISchemaEnumType |
Date: |
Thu, 24 Sep 2020 15:10:47 -0400 |
On Tue, Sep 22, 2020 at 05:00:59PM -0400, John Snow wrote:
> Signed-off-by: John Snow <jsnow@redhat.com>
> ---
> scripts/qapi/visit.py | 15 ++++++++++-----
> 1 file changed, 10 insertions(+), 5 deletions(-)
>
> diff --git a/scripts/qapi/visit.py b/scripts/qapi/visit.py
> index 4edaee33e3..180c140180 100644
> --- a/scripts/qapi/visit.py
> +++ b/scripts/qapi/visit.py
> @@ -22,7 +22,10 @@
> indent,
> )
> from .gen import QAPISchemaModularCVisitor, ifcontext
> -from .schema import QAPISchemaObjectType
> +from .schema import (
> + QAPISchemaEnumType,
> + QAPISchemaObjectType,
> +)
>
>
> def gen_visit_decl(name, scalar=False):
> @@ -84,15 +87,17 @@ def gen_visit_object_members(name, base, members,
> variants):
> ret += gen_endif(memb.ifcond)
>
> if variants:
> + tag_member = variants.tag_member
> + assert isinstance(tag_member.type, QAPISchemaEnumType)
> +
I'd be interested in knowing why this wasn't left to be handled by the
type checking only. Anyway,
Reviewed-by: Cleber Rosa <crosa@redhat.com>
signature.asc
Description: PGP signature
- [PATCH v2 30/38] qapi/introspect.py: Add a typed 'extra' structure, (continued)
[PATCH v2 34/38] qapi/types.py: add type hint annotations, John Snow, 2020/09/22
[PATCH v2 38/38] qapi/visit.py: add type hint annotations, John Snow, 2020/09/22
[PATCH v2 31/38] qapi/introspect.py: add _gen_features helper, John Snow, 2020/09/22