cdef class BasicVisitor:
cdef dict dispatch_table
cpdef visit(self, obj)
- cpdef find_handler(self, obj)
+ cdef _visit(self, obj)
+ cdef find_handler(self, obj)
cdef class TreeVisitor(BasicVisitor):
cdef public list access_path
cpdef visitchild(self, child, parent, attrname, idx)
@cython.locals(idx=int)
cdef dict _visitchildren(self, parent, attrs)
-# cpdef visitchildren(self, parent, attrs=*)
+ cpdef visitchildren(self, parent, attrs=*)
cdef class VisitorTransform(TreeVisitor):
cpdef visitchildren(self, parent, attrs=*)
self.dispatch_table = {}
def visit(self, obj):
+ return self._visit(obj)
+
+ def _visit(self, obj):
try:
handler_method = self.dispatch_table[type(obj)]
except KeyError:
def visitchild(self, child, parent, attrname, idx):
self.access_path.append((parent, attrname, idx))
try:
- result = self.visit(child)
+ result = self._visit(child)
except Errors.CompileError:
raise
except Exception, e:
return node
def __call__(self, root):
- return self.visit(root)
+ return self._visit(root)
class CythonTransform(VisitorTransform):
"""
def __call__(self, tree, phase=None):
print("Parse tree dump at phase '%s'" % phase)
- self.visit(tree)
+ self._visit(tree)
return tree
# Don't do anything about process_list, the defaults gives