cdef class BasicVisitor:
- cdef object dispatch_table
+ cdef dict dispatch_table
cpdef visit(self, obj)
cdef class TreeVisitor(BasicVisitor):
- cdef public access_path
+ cdef public list access_path
cpdef visitchild(self, child, parent, attrname, idx)
cdef class VisitorTransform(TreeVisitor):
+ cdef object _super_visitchildren
cpdef visitchildren(self, parent, attrs=*)
cpdef recurse_to_children(self, node)
was not, an exception will be raised. (Typically you want to ensure that you
are within a StatListNode or similar before doing this.)
"""
+ def __init__(self):
+ super(VisitorTransform, self).__init__()
+ self._super_visitchildren = super(VisitorTransform, self).visitchildren
+
def visitchildren(self, parent, attrs=None):
-# result = super(VisitorTransform, self).visitchildren(parent, attrs)
- result = TreeVisitor.visitchildren(self, parent, attrs)
+ result = self._super_visitchildren(parent, attrs)
for attr, newnode in result.iteritems():
if not isinstance(newnode, list):
setattr(parent, attr, newnode)