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 <arm...@redhat.com>
> ---
>  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 <ebl...@redhat.com>

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to