summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Hylton <jeremy@alum.mit.edu>2001-04-11 16:26:05 (GMT)
committerJeremy Hylton <jeremy@alum.mit.edu>2001-04-11 16:26:05 (GMT)
commitd91bbba89d214d809d355ded386363cf6ee29f15 (patch)
treea93a96d0f7cb9aa27fd88180ad73c15bcfeb692d
parent9ab019bee7ccc79b15a24ab3043cb1f05b15d7bb (diff)
downloadcpython-d91bbba89d214d809d355ded386363cf6ee29f15.zip
cpython-d91bbba89d214d809d355ded386363cf6ee29f15.tar.gz
cpython-d91bbba89d214d809d355ded386363cf6ee29f15.tar.bz2
Add support for extra (*) arguments to preorder.
Change default dispatch to use extended call syntax in place of apply.
-rw-r--r--Lib/compiler/visitor.py6
-rw-r--r--Tools/compiler/compiler/visitor.py6
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