On 08/04/2015 09:57 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> > Reviewed-by: Eric Blake <ebl...@redhat.com> > --- > scripts/qapi.py | 46 ++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 46 insertions(+) > > diff --git a/scripts/qapi.py b/scripts/qapi.py > index 3c596c3..019d22c 100644 > --- a/scripts/qapi.py > +++ b/scripts/qapi.py > @@ -771,6 +771,29 @@ class QAPISchemaEntity(object): > return c_name(self.name) > def check(self, schema): > pass > + def visit(self, visitor): > + pass > + > +class QAPISchemaVisitor(object): > + def visit_begin(self): > + pass
Don't know if you wanted to hoist from later patches, and write this as: def visit_begin(self, schema): > @@ -1166,6 +1206,12 @@ class QAPISchema(object): > for ent in self.entity_dict.values(): > ent.check(self) > > + def visit(self, visitor): > + visitor.visit_begin() and this as visitor.visit_begin(self) up front, for less churn later on. Not the end of the world to leave it as is, so my R-b stands either way. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature