[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v8 04/26] qapi: New QAPISchemaVisitor
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH v8 04/26] qapi: New QAPISchemaVisitor |
Date: |
Wed, 16 Sep 2015 09:21:59 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 |
On 09/16/2015 05:06 AM, Markus Armbruster wrote:
> The visitor will help keeping the code generation code simple and
> reasonably separated from QAPISchema details.
>
> Signed-off-by: Markus Armbruster <address@hidden>
> ---
> scripts/qapi.py | 64
> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 64 insertions(+)
>
> @@ -840,6 +876,10 @@ class QAPISchemaEnumType(QAPISchemaType):
> def json_type(self):
> return 'string'
>
> + def visit(self, visitor):
> + visitor.visit_enum_type(self.name, self.info,
> + self.values, self.prefix)
Thinking aloud: Should this visit 'self.prefix or self.name', rather
than letting callers see None? If we did that, we could simplify
c_enum_const() back to 2 parameters, and update all callers to just
blindly pass the prefix instead of the enum name. On the other hand, I
think that's a bit too much churn, and I don't see what it would buy us
that we don't already have with a 3-arg c_enum_const().
So I'm fine with the version you have here as-is (modulo any obvious
rebase to pass self._prefix based on my comments on 2).
Reviewed-by: Eric Blake <address@hidden>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature