From d91bbba89d214d809d355ded386363cf6ee29f15 Mon Sep 17 00:00:00 2001 From: Jeremy Hylton Date: Wed, 11 Apr 2001 16:26:05 +0000 Subject: Add support for extra (*) arguments to preorder. Change default dispatch to use extended call syntax in place of apply. --- Lib/compiler/visitor.py | 6 +++--- Tools/compiler/compiler/visitor.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Lib/compiler/visitor.py b/Lib/compiler/visitor.py index a6604f4..dfeda32 100644 --- a/Lib/compiler/visitor.py +++ b/Lib/compiler/visitor.py @@ -61,13 +61,13 @@ class ASTVisitor: print "dispatch", className else: print "dispatch", className, (meth and meth.__name__ or '') - return apply(meth, (node,) + args) + return meth(node, *args) - def preorder(self, tree, visitor): + def preorder(self, tree, visitor, *args): """Do preorder walk of tree using visitor""" self.visitor = visitor visitor.visit = self._preorder - self._preorder(tree) + self._preorder(tree, *args) # XXX *args make sense? _preorder = dispatch diff --git a/Tools/compiler/compiler/visitor.py b/Tools/compiler/compiler/visitor.py index a6604f4..dfeda32 100644 --- a/Tools/compiler/compiler/visitor.py +++ b/Tools/compiler/compiler/visitor.py @@ -61,13 +61,13 @@ class ASTVisitor: print "dispatch", className else: print "dispatch", className, (meth and meth.__name__ or '') - return apply(meth, (node,) + args) + return meth(node, *args) - def preorder(self, tree, visitor): + def preorder(self, tree, visitor, *args): """Do preorder walk of tree using visitor""" self.visitor = visitor visitor.visit = self._preorder - self._preorder(tree) + self._preorder(tree, *args) # XXX *args make sense? _preorder = dispatch -- cgit v0.12