1.1 --- a/compiler/ast.py Wed May 16 00:45:58 2012 +0200
1.2 +++ b/compiler/ast.py Thu May 17 20:22:53 2012 +0200
1.3 @@ -31,6 +31,8 @@
1.4 return self.getChildren()
1.5 def getChildNodes(self):
1.6 pass # implemented by subclasses
1.7 + def visit(self, visitor, *args):
1.8 + visitor.default(self, *args)
1.9
1.10 class EmptyNode(Node):
1.11 pass
1.12 @@ -50,8 +52,8 @@
1.13 def __repr__(self):
1.14 return "Expression(%s)" % (repr(self.node))
1.15
1.16 - def visit(self, visitor):
1.17 - return visitor.visitExpression(self)
1.18 + def visit(self, visitor, *args):
1.19 + return visitor.visitExpression(self, *args)
1.20
1.21 class Add(Node):
1.22 def __init__(self, (left, right), lineno=None):
1.23 @@ -68,8 +70,8 @@
1.24 def __repr__(self):
1.25 return "Add((%s, %s))" % (repr(self.left), repr(self.right))
1.26
1.27 - def visit(self, visitor):
1.28 - return visitor.visitAdd(self)
1.29 + def visit(self, visitor, *args):
1.30 + return visitor.visitAdd(self, *args)
1.31
1.32 class And(Node):
1.33 def __init__(self, nodes, lineno=None):
1.34 @@ -87,8 +89,8 @@
1.35 def __repr__(self):
1.36 return "And(%s)" % (repr(self.nodes),)
1.37
1.38 - def visit(self, visitor):
1.39 - return visitor.visitAnd(self)
1.40 + def visit(self, visitor, *args):
1.41 + return visitor.visitAnd(self, *args)
1.42
1.43 class AssAttr(Node):
1.44 def __init__(self, expr, attrname, flags, lineno=None):
1.45 @@ -106,8 +108,8 @@
1.46 def __repr__(self):
1.47 return "AssAttr(%s, %s, %s)" % (repr(self.expr), repr(self.attrname), repr(self.flags))
1.48
1.49 - def visit(self, visitor):
1.50 - return visitor.visitAssAttr(self)
1.51 + def visit(self, visitor, *args):
1.52 + return visitor.visitAssAttr(self, *args)
1.53
1.54 class AssList(Node):
1.55 def __init__(self, nodes, lineno=None):
1.56 @@ -125,8 +127,8 @@
1.57 def __repr__(self):
1.58 return "AssList(%s)" % (repr(self.nodes),)
1.59
1.60 - def visit(self, visitor):
1.61 - return visitor.visitAssList(self)
1.62 + def visit(self, visitor, *args):
1.63 + return visitor.visitAssList(self, *args)
1.64
1.65 class AssName(Node):
1.66 def __init__(self, name, flags, lineno=None):
1.67 @@ -143,8 +145,8 @@
1.68 def __repr__(self):
1.69 return "AssName(%s, %s)" % (repr(self.name), repr(self.flags))
1.70
1.71 - def visit(self, visitor):
1.72 - return visitor.visitAssName(self)
1.73 + def visit(self, visitor, *args):
1.74 + return visitor.visitAssName(self, *args)
1.75
1.76 class AssTuple(Node):
1.77 def __init__(self, nodes, lineno=None):
1.78 @@ -162,8 +164,8 @@
1.79 def __repr__(self):
1.80 return "AssTuple(%s)" % (repr(self.nodes),)
1.81
1.82 - def visit(self, visitor):
1.83 - return visitor.visitAssTuple(self)
1.84 + def visit(self, visitor, *args):
1.85 + return visitor.visitAssTuple(self, *args)
1.86
1.87 class Assert(Node):
1.88 def __init__(self, test, fail, lineno=None):
1.89 @@ -187,8 +189,8 @@
1.90 def __repr__(self):
1.91 return "Assert(%s, %s)" % (repr(self.test), repr(self.fail))
1.92
1.93 - def visit(self, visitor):
1.94 - return visitor.visitAssert(self)
1.95 + def visit(self, visitor, *args):
1.96 + return visitor.visitAssert(self, *args)
1.97
1.98 class Assign(Node):
1.99 def __init__(self, nodes, expr, lineno=None):
1.100 @@ -211,8 +213,8 @@
1.101 def __repr__(self):
1.102 return "Assign(%s, %s)" % (repr(self.nodes), repr(self.expr))
1.103
1.104 - def visit(self, visitor):
1.105 - return visitor.visitAssign(self)
1.106 + def visit(self, visitor, *args):
1.107 + return visitor.visitAssign(self, *args)
1.108
1.109 class AugAssign(Node):
1.110 def __init__(self, node, op, expr, lineno=None):
1.111 @@ -230,8 +232,8 @@
1.112 def __repr__(self):
1.113 return "AugAssign(%s, %s, %s)" % (repr(self.node), repr(self.op), repr(self.expr))
1.114
1.115 - def visit(self, visitor):
1.116 - return visitor.visitAugAssign(self)
1.117 + def visit(self, visitor, *args):
1.118 + return visitor.visitAugAssign(self, *args)
1.119
1.120 class Backquote(Node):
1.121 def __init__(self, expr, lineno=None):
1.122 @@ -247,8 +249,8 @@
1.123 def __repr__(self):
1.124 return "Backquote(%s)" % (repr(self.expr),)
1.125
1.126 - def visit(self, visitor):
1.127 - return visitor.visitBackquote(self)
1.128 + def visit(self, visitor, *args):
1.129 + return visitor.visitBackquote(self, *args)
1.130
1.131 class Bitand(Node):
1.132 def __init__(self, nodes, lineno=None):
1.133 @@ -266,8 +268,8 @@
1.134 def __repr__(self):
1.135 return "Bitand(%s)" % (repr(self.nodes),)
1.136
1.137 - def visit(self, visitor):
1.138 - return visitor.visitBitand(self)
1.139 + def visit(self, visitor, *args):
1.140 + return visitor.visitBitand(self, *args)
1.141
1.142 class Bitor(Node):
1.143 def __init__(self, nodes, lineno=None):
1.144 @@ -285,8 +287,8 @@
1.145 def __repr__(self):
1.146 return "Bitor(%s)" % (repr(self.nodes),)
1.147
1.148 - def visit(self, visitor):
1.149 - return visitor.visitBitor(self)
1.150 + def visit(self, visitor, *args):
1.151 + return visitor.visitBitor(self, *args)
1.152
1.153 class Bitxor(Node):
1.154 def __init__(self, nodes, lineno=None):
1.155 @@ -304,8 +306,8 @@
1.156 def __repr__(self):
1.157 return "Bitxor(%s)" % (repr(self.nodes),)
1.158
1.159 - def visit(self, visitor):
1.160 - return visitor.visitBitxor(self)
1.161 + def visit(self, visitor, *args):
1.162 + return visitor.visitBitxor(self, *args)
1.163
1.164 class Break(Node):
1.165 def __init__(self, lineno=None):
1.166 @@ -320,8 +322,8 @@
1.167 def __repr__(self):
1.168 return "Break()"
1.169
1.170 - def visit(self, visitor):
1.171 - return visitor.visitBreak(self)
1.172 + def visit(self, visitor, *args):
1.173 + return visitor.visitBreak(self, *args)
1.174
1.175 class CallFunc(Node):
1.176 def __init__(self, node, args, star_args = None, dstar_args = None, lineno=None):
1.177 @@ -352,8 +354,8 @@
1.178 def __repr__(self):
1.179 return "CallFunc(%s, %s, %s, %s)" % (repr(self.node), repr(self.args), repr(self.star_args), repr(self.dstar_args))
1.180
1.181 - def visit(self, visitor):
1.182 - return visitor.visitCallFunc(self)
1.183 + def visit(self, visitor, *args):
1.184 + return visitor.visitCallFunc(self, *args)
1.185
1.186 class Class(Node):
1.187 def __init__(self, name, bases, doc, code, lineno=None):
1.188 @@ -380,8 +382,8 @@
1.189 def __repr__(self):
1.190 return "Class(%s, %s, %s, %s)" % (repr(self.name), repr(self.bases), repr(self.doc), repr(self.code))
1.191
1.192 - def visit(self, visitor):
1.193 - return visitor.visitClass(self)
1.194 + def visit(self, visitor, *args):
1.195 + return visitor.visitClass(self, *args)
1.196
1.197 class Compare(Node):
1.198 def __init__(self, expr, ops, lineno=None):
1.199 @@ -404,8 +406,8 @@
1.200 def __repr__(self):
1.201 return "Compare(%s, %s)" % (repr(self.expr), repr(self.ops))
1.202
1.203 - def visit(self, visitor):
1.204 - return visitor.visitCompare(self)
1.205 + def visit(self, visitor, *args):
1.206 + return visitor.visitCompare(self, *args)
1.207
1.208 class Const(Node):
1.209 def __init__(self, value, lineno=None):
1.210 @@ -421,8 +423,8 @@
1.211 def __repr__(self):
1.212 return "Const(%s)" % (repr(self.value),)
1.213
1.214 - def visit(self, visitor):
1.215 - return visitor.visitConst(self)
1.216 + def visit(self, visitor, *args):
1.217 + return visitor.visitConst(self, *args)
1.218
1.219 class Continue(Node):
1.220 def __init__(self, lineno=None):
1.221 @@ -437,8 +439,8 @@
1.222 def __repr__(self):
1.223 return "Continue()"
1.224
1.225 - def visit(self, visitor):
1.226 - return visitor.visitContinue(self)
1.227 + def visit(self, visitor, *args):
1.228 + return visitor.visitContinue(self, *args)
1.229
1.230 class Decorators(Node):
1.231 def __init__(self, nodes, lineno=None):
1.232 @@ -456,8 +458,8 @@
1.233 def __repr__(self):
1.234 return "Decorators(%s)" % (repr(self.nodes),)
1.235
1.236 - def visit(self, visitor):
1.237 - return visitor.visitDecorators(self)
1.238 + def visit(self, visitor, *args):
1.239 + return visitor.visitDecorators(self, *args)
1.240
1.241 class Dict(Node):
1.242 def __init__(self, items, lineno=None):
1.243 @@ -475,8 +477,8 @@
1.244 def __repr__(self):
1.245 return "Dict(%s)" % (repr(self.items),)
1.246
1.247 - def visit(self, visitor):
1.248 - return visitor.visitDict(self)
1.249 + def visit(self, visitor, *args):
1.250 + return visitor.visitDict(self, *args)
1.251
1.252 class Discard(Node):
1.253 def __init__(self, expr, lineno=None):
1.254 @@ -492,8 +494,8 @@
1.255 def __repr__(self):
1.256 return "Discard(%s)" % (repr(self.expr),)
1.257
1.258 - def visit(self, visitor):
1.259 - return visitor.visitDiscard(self)
1.260 + def visit(self, visitor, *args):
1.261 + return visitor.visitDiscard(self, *args)
1.262
1.263 class Div(Node):
1.264 def __init__(self, (left, right), lineno=None):
1.265 @@ -510,8 +512,8 @@
1.266 def __repr__(self):
1.267 return "Div((%s, %s))" % (repr(self.left), repr(self.right))
1.268
1.269 - def visit(self, visitor):
1.270 - return visitor.visitDiv(self)
1.271 + def visit(self, visitor, *args):
1.272 + return visitor.visitDiv(self, *args)
1.273
1.274 class Ellipsis(Node):
1.275 def __init__(self, lineno=None):
1.276 @@ -526,8 +528,8 @@
1.277 def __repr__(self):
1.278 return "Ellipsis()"
1.279
1.280 - def visit(self, visitor):
1.281 - return visitor.visitEllipsis(self)
1.282 + def visit(self, visitor, *args):
1.283 + return visitor.visitEllipsis(self, *args)
1.284
1.285 class Exec(Node):
1.286 def __init__(self, expr, locals, globals, lineno=None):
1.287 @@ -555,8 +557,8 @@
1.288 def __repr__(self):
1.289 return "Exec(%s, %s, %s)" % (repr(self.expr), repr(self.locals), repr(self.globals))
1.290
1.291 - def visit(self, visitor):
1.292 - return visitor.visitExec(self)
1.293 + def visit(self, visitor, *args):
1.294 + return visitor.visitExec(self, *args)
1.295
1.296 class FloorDiv(Node):
1.297 def __init__(self, (left, right), lineno=None):
1.298 @@ -573,8 +575,8 @@
1.299 def __repr__(self):
1.300 return "FloorDiv((%s, %s))" % (repr(self.left), repr(self.right))
1.301
1.302 - def visit(self, visitor):
1.303 - return visitor.visitFloorDiv(self)
1.304 + def visit(self, visitor, *args):
1.305 + return visitor.visitFloorDiv(self, *args)
1.306
1.307 class For(Node):
1.308 def __init__(self, assign, list, body, else_, lineno=None):
1.309 @@ -604,8 +606,8 @@
1.310 def __repr__(self):
1.311 return "For(%s, %s, %s, %s)" % (repr(self.assign), repr(self.list), repr(self.body), repr(self.else_))
1.312
1.313 - def visit(self, visitor):
1.314 - return visitor.visitFor(self)
1.315 + def visit(self, visitor, *args):
1.316 + return visitor.visitFor(self, *args)
1.317
1.318 class From(Node):
1.319 def __init__(self, modname, names, level, lineno=None):
1.320 @@ -623,8 +625,8 @@
1.321 def __repr__(self):
1.322 return "From(%s, %s, %s)" % (repr(self.modname), repr(self.names), repr(self.level))
1.323
1.324 - def visit(self, visitor):
1.325 - return visitor.visitFrom(self)
1.326 + def visit(self, visitor, *args):
1.327 + return visitor.visitFrom(self, *args)
1.328
1.329 class Function(Node):
1.330 def __init__(self, decorators, name, argnames, defaults, flags, doc, code, lineno=None):
1.331 @@ -666,8 +668,8 @@
1.332 def __repr__(self):
1.333 return "Function(%s, %s, %s, %s, %s, %s, %s)" % (repr(self.decorators), repr(self.name), repr(self.argnames), repr(self.defaults), repr(self.flags), repr(self.doc), repr(self.code))
1.334
1.335 - def visit(self, visitor):
1.336 - return visitor.visitFunction(self)
1.337 + def visit(self, visitor, *args):
1.338 + return visitor.visitFunction(self, *args)
1.339
1.340 class GenExpr(Node):
1.341 def __init__(self, code, lineno=None):
1.342 @@ -685,8 +687,8 @@
1.343 def __repr__(self):
1.344 return "GenExpr(%s)" % (repr(self.code),)
1.345
1.346 - def visit(self, visitor):
1.347 - return visitor.visitGenExpr(self)
1.348 + def visit(self, visitor, *args):
1.349 + return visitor.visitGenExpr(self, *args)
1.350
1.351 class GenExprFor(Node):
1.352 def __init__(self, assign, iter, ifs, lineno=None):
1.353 @@ -714,8 +716,8 @@
1.354 def __repr__(self):
1.355 return "GenExprFor(%s, %s, %s)" % (repr(self.assign), repr(self.iter), repr(self.ifs))
1.356
1.357 - def visit(self, visitor):
1.358 - return visitor.visitGenExprFor(self)
1.359 + def visit(self, visitor, *args):
1.360 + return visitor.visitGenExprFor(self, *args)
1.361
1.362 class GenExprIf(Node):
1.363 def __init__(self, test, lineno=None):
1.364 @@ -731,8 +733,8 @@
1.365 def __repr__(self):
1.366 return "GenExprIf(%s)" % (repr(self.test),)
1.367
1.368 - def visit(self, visitor):
1.369 - return visitor.visitGenExprIf(self)
1.370 + def visit(self, visitor, *args):
1.371 + return visitor.visitGenExprIf(self, *args)
1.372
1.373 class GenExprInner(Node):
1.374 def __init__(self, expr, quals, lineno=None):
1.375 @@ -755,8 +757,8 @@
1.376 def __repr__(self):
1.377 return "GenExprInner(%s, %s)" % (repr(self.expr), repr(self.quals))
1.378
1.379 - def visit(self, visitor):
1.380 - return visitor.visitGenExprInner(self)
1.381 + def visit(self, visitor, *args):
1.382 + return visitor.visitGenExprInner(self, *args)
1.383
1.384 class Getattr(Node):
1.385 def __init__(self, expr, attrname, lineno=None):
1.386 @@ -773,8 +775,8 @@
1.387 def __repr__(self):
1.388 return "Getattr(%s, %s)" % (repr(self.expr), repr(self.attrname))
1.389
1.390 - def visit(self, visitor):
1.391 - return visitor.visitGetattr(self)
1.392 + def visit(self, visitor, *args):
1.393 + return visitor.visitGetattr(self, *args)
1.394
1.395 class Global(Node):
1.396 def __init__(self, names, lineno=None):
1.397 @@ -790,8 +792,8 @@
1.398 def __repr__(self):
1.399 return "Global(%s)" % (repr(self.names),)
1.400
1.401 - def visit(self, visitor):
1.402 - return visitor.visitGlobal(self)
1.403 + def visit(self, visitor, *args):
1.404 + return visitor.visitGlobal(self, *args)
1.405
1.406 class If(Node):
1.407 def __init__(self, tests, else_, lineno=None):
1.408 @@ -815,8 +817,8 @@
1.409 def __repr__(self):
1.410 return "If(%s, %s)" % (repr(self.tests), repr(self.else_))
1.411
1.412 - def visit(self, visitor):
1.413 - return visitor.visitIf(self)
1.414 + def visit(self, visitor, *args):
1.415 + return visitor.visitIf(self, *args)
1.416
1.417 class IfExp(Node):
1.418 def __init__(self, test, then, else_, lineno=None):
1.419 @@ -834,8 +836,8 @@
1.420 def __repr__(self):
1.421 return "IfExp(%s, %s, %s)" % (repr(self.test), repr(self.then), repr(self.else_))
1.422
1.423 - def visit(self, visitor):
1.424 - return visitor.visitIfExp(self)
1.425 + def visit(self, visitor, *args):
1.426 + return visitor.visitIfExp(self, *args)
1.427
1.428 class Import(Node):
1.429 def __init__(self, names, lineno=None):
1.430 @@ -851,8 +853,8 @@
1.431 def __repr__(self):
1.432 return "Import(%s)" % (repr(self.names),)
1.433
1.434 - def visit(self, visitor):
1.435 - return visitor.visitImport(self)
1.436 + def visit(self, visitor, *args):
1.437 + return visitor.visitImport(self, *args)
1.438
1.439 class Invert(Node):
1.440 def __init__(self, expr, lineno=None):
1.441 @@ -868,8 +870,8 @@
1.442 def __repr__(self):
1.443 return "Invert(%s)" % (repr(self.expr),)
1.444
1.445 - def visit(self, visitor):
1.446 - return visitor.visitInvert(self)
1.447 + def visit(self, visitor, *args):
1.448 + return visitor.visitInvert(self, *args)
1.449
1.450 class Keyword(Node):
1.451 def __init__(self, name, expr, lineno=None):
1.452 @@ -886,8 +888,8 @@
1.453 def __repr__(self):
1.454 return "Keyword(%s, %s)" % (repr(self.name), repr(self.expr))
1.455
1.456 - def visit(self, visitor):
1.457 - return visitor.visitKeyword(self)
1.458 + def visit(self, visitor, *args):
1.459 + return visitor.visitKeyword(self, *args)
1.460
1.461 class Lambda(Node):
1.462 def __init__(self, argnames, defaults, flags, code, lineno=None):
1.463 @@ -921,8 +923,8 @@
1.464 def __repr__(self):
1.465 return "Lambda(%s, %s, %s, %s)" % (repr(self.argnames), repr(self.defaults), repr(self.flags), repr(self.code))
1.466
1.467 - def visit(self, visitor):
1.468 - return visitor.visitLambda(self)
1.469 + def visit(self, visitor, *args):
1.470 + return visitor.visitLambda(self, *args)
1.471
1.472 class LeftShift(Node):
1.473 def __init__(self, (left, right), lineno=None):
1.474 @@ -939,8 +941,8 @@
1.475 def __repr__(self):
1.476 return "LeftShift((%s, %s))" % (repr(self.left), repr(self.right))
1.477
1.478 - def visit(self, visitor):
1.479 - return visitor.visitLeftShift(self)
1.480 + def visit(self, visitor, *args):
1.481 + return visitor.visitLeftShift(self, *args)
1.482
1.483 class List(Node):
1.484 def __init__(self, nodes, lineno=None):
1.485 @@ -958,8 +960,8 @@
1.486 def __repr__(self):
1.487 return "List(%s)" % (repr(self.nodes),)
1.488
1.489 - def visit(self, visitor):
1.490 - return visitor.visitList(self)
1.491 + def visit(self, visitor, *args):
1.492 + return visitor.visitList(self, *args)
1.493
1.494 class ListComp(Node):
1.495 def __init__(self, expr, quals, lineno=None):
1.496 @@ -982,8 +984,8 @@
1.497 def __repr__(self):
1.498 return "ListComp(%s, %s)" % (repr(self.expr), repr(self.quals))
1.499
1.500 - def visit(self, visitor):
1.501 - return visitor.visitListComp(self)
1.502 + def visit(self, visitor, *args):
1.503 + return visitor.visitListComp(self, *args)
1.504
1.505 class ListCompFor(Node):
1.506 def __init__(self, assign, list, ifs, lineno=None):
1.507 @@ -1009,8 +1011,8 @@
1.508 def __repr__(self):
1.509 return "ListCompFor(%s, %s, %s)" % (repr(self.assign), repr(self.list), repr(self.ifs))
1.510
1.511 - def visit(self, visitor):
1.512 - return visitor.visitListCompFor(self)
1.513 + def visit(self, visitor, *args):
1.514 + return visitor.visitListCompFor(self, *args)
1.515
1.516 class ListCompIf(Node):
1.517 def __init__(self, test, lineno=None):
1.518 @@ -1026,8 +1028,8 @@
1.519 def __repr__(self):
1.520 return "ListCompIf(%s)" % (repr(self.test),)
1.521
1.522 - def visit(self, visitor):
1.523 - return visitor.visitListCompIf(self)
1.524 + def visit(self, visitor, *args):
1.525 + return visitor.visitListCompIf(self, *args)
1.526
1.527 class Mod(Node):
1.528 def __init__(self, (left, right), lineno=None):
1.529 @@ -1044,8 +1046,8 @@
1.530 def __repr__(self):
1.531 return "Mod((%s, %s))" % (repr(self.left), repr(self.right))
1.532
1.533 - def visit(self, visitor):
1.534 - return visitor.visitMod(self)
1.535 + def visit(self, visitor, *args):
1.536 + return visitor.visitMod(self, *args)
1.537
1.538 class Module(Node):
1.539 def __init__(self, doc, node, lineno=None):
1.540 @@ -1062,8 +1064,8 @@
1.541 def __repr__(self):
1.542 return "Module(%s, %s)" % (repr(self.doc), repr(self.node))
1.543
1.544 - def visit(self, visitor):
1.545 - return visitor.visitModule(self)
1.546 + def visit(self, visitor, *args):
1.547 + return visitor.visitModule(self, *args)
1.548
1.549 class Mul(Node):
1.550 def __init__(self, (left, right), lineno=None):
1.551 @@ -1080,8 +1082,8 @@
1.552 def __repr__(self):
1.553 return "Mul((%s, %s))" % (repr(self.left), repr(self.right))
1.554
1.555 - def visit(self, visitor):
1.556 - return visitor.visitMul(self)
1.557 + def visit(self, visitor, *args):
1.558 + return visitor.visitMul(self, *args)
1.559
1.560 class Name(Node):
1.561 def __init__(self, name, lineno=None):
1.562 @@ -1097,8 +1099,8 @@
1.563 def __repr__(self):
1.564 return "Name(%s)" % (repr(self.name),)
1.565
1.566 - def visit(self, visitor):
1.567 - return visitor.visitName(self)
1.568 + def visit(self, visitor, *args):
1.569 + return visitor.visitName(self, *args)
1.570
1.571 class Not(Node):
1.572 def __init__(self, expr, lineno=None):
1.573 @@ -1114,8 +1116,8 @@
1.574 def __repr__(self):
1.575 return "Not(%s)" % (repr(self.expr),)
1.576
1.577 - def visit(self, visitor):
1.578 - return visitor.visitNot(self)
1.579 + def visit(self, visitor, *args):
1.580 + return visitor.visitNot(self, *args)
1.581
1.582 class Or(Node):
1.583 def __init__(self, nodes, lineno=None):
1.584 @@ -1133,8 +1135,8 @@
1.585 def __repr__(self):
1.586 return "Or(%s)" % (repr(self.nodes),)
1.587
1.588 - def visit(self, visitor):
1.589 - return visitor.visitOr(self)
1.590 + def visit(self, visitor, *args):
1.591 + return visitor.visitOr(self, *args)
1.592
1.593 class Pass(Node):
1.594 def __init__(self, lineno=None):
1.595 @@ -1149,8 +1151,8 @@
1.596 def __repr__(self):
1.597 return "Pass()"
1.598
1.599 - def visit(self, visitor):
1.600 - return visitor.visitPass(self)
1.601 + def visit(self, visitor, *args):
1.602 + return visitor.visitPass(self, *args)
1.603
1.604 class Power(Node):
1.605 def __init__(self, (left, right), lineno=None):
1.606 @@ -1167,8 +1169,8 @@
1.607 def __repr__(self):
1.608 return "Power((%s, %s))" % (repr(self.left), repr(self.right))
1.609
1.610 - def visit(self, visitor):
1.611 - return visitor.visitPower(self)
1.612 + def visit(self, visitor, *args):
1.613 + return visitor.visitPower(self, *args)
1.614
1.615 class Print(Node):
1.616 def __init__(self, nodes, dest, lineno=None):
1.617 @@ -1192,8 +1194,8 @@
1.618 def __repr__(self):
1.619 return "Print(%s, %s)" % (repr(self.nodes), repr(self.dest))
1.620
1.621 - def visit(self, visitor):
1.622 - return visitor.visitPrint(self)
1.623 + def visit(self, visitor, *args):
1.624 + return visitor.visitPrint(self, *args)
1.625
1.626 class Printnl(Node):
1.627 def __init__(self, nodes, dest, lineno=None):
1.628 @@ -1217,8 +1219,8 @@
1.629 def __repr__(self):
1.630 return "Printnl(%s, %s)" % (repr(self.nodes), repr(self.dest))
1.631
1.632 - def visit(self, visitor):
1.633 - return visitor.visitPrintnl(self)
1.634 + def visit(self, visitor, *args):
1.635 + return visitor.visitPrintnl(self, *args)
1.636
1.637 class Raise(Node):
1.638 def __init__(self, expr1, expr2, expr3, lineno=None):
1.639 @@ -1247,8 +1249,8 @@
1.640 def __repr__(self):
1.641 return "Raise(%s, %s, %s)" % (repr(self.expr1), repr(self.expr2), repr(self.expr3))
1.642
1.643 - def visit(self, visitor):
1.644 - return visitor.visitRaise(self)
1.645 + def visit(self, visitor, *args):
1.646 + return visitor.visitRaise(self, *args)
1.647
1.648 class Return(Node):
1.649 def __init__(self, value, lineno=None):
1.650 @@ -1264,8 +1266,8 @@
1.651 def __repr__(self):
1.652 return "Return(%s)" % (repr(self.value),)
1.653
1.654 - def visit(self, visitor):
1.655 - return visitor.visitReturn(self)
1.656 + def visit(self, visitor, *args):
1.657 + return visitor.visitReturn(self, *args)
1.658
1.659 class RightShift(Node):
1.660 def __init__(self, (left, right), lineno=None):
1.661 @@ -1282,8 +1284,8 @@
1.662 def __repr__(self):
1.663 return "RightShift((%s, %s))" % (repr(self.left), repr(self.right))
1.664
1.665 - def visit(self, visitor):
1.666 - return visitor.visitRightShift(self)
1.667 + def visit(self, visitor, *args):
1.668 + return visitor.visitRightShift(self, *args)
1.669
1.670 class Slice(Node):
1.671 def __init__(self, expr, flags, lower, upper, lineno=None):
1.672 @@ -1313,8 +1315,8 @@
1.673 def __repr__(self):
1.674 return "Slice(%s, %s, %s, %s)" % (repr(self.expr), repr(self.flags), repr(self.lower), repr(self.upper))
1.675
1.676 - def visit(self, visitor):
1.677 - return visitor.visitSlice(self)
1.678 + def visit(self, visitor, *args):
1.679 + return visitor.visitSlice(self, *args)
1.680
1.681 class Sliceobj(Node):
1.682 def __init__(self, nodes, lineno=None):
1.683 @@ -1332,8 +1334,8 @@
1.684 def __repr__(self):
1.685 return "Sliceobj(%s)" % (repr(self.nodes),)
1.686
1.687 - def visit(self, visitor):
1.688 - return visitor.visitSliceobj(self)
1.689 + def visit(self, visitor, *args):
1.690 + return visitor.visitSliceobj(self, *args)
1.691
1.692 class Stmt(Node):
1.693 def __init__(self, nodes, lineno=None):
1.694 @@ -1351,8 +1353,8 @@
1.695 def __repr__(self):
1.696 return "Stmt(%s)" % (repr(self.nodes),)
1.697
1.698 - def visit(self, visitor):
1.699 - return visitor.visitStmt(self)
1.700 + def visit(self, visitor, *args):
1.701 + return visitor.visitStmt(self, *args)
1.702
1.703 class Sub(Node):
1.704 def __init__(self, (left, right), lineno=None):
1.705 @@ -1369,8 +1371,8 @@
1.706 def __repr__(self):
1.707 return "Sub((%s, %s))" % (repr(self.left), repr(self.right))
1.708
1.709 - def visit(self, visitor):
1.710 - return visitor.visitSub(self)
1.711 + def visit(self, visitor, *args):
1.712 + return visitor.visitSub(self, *args)
1.713
1.714 class Subscript(Node):
1.715 def __init__(self, expr, flags, subs, lineno=None):
1.716 @@ -1395,8 +1397,8 @@
1.717 def __repr__(self):
1.718 return "Subscript(%s, %s, %s)" % (repr(self.expr), repr(self.flags), repr(self.subs))
1.719
1.720 - def visit(self, visitor):
1.721 - return visitor.visitSubscript(self)
1.722 + def visit(self, visitor, *args):
1.723 + return visitor.visitSubscript(self, *args)
1.724
1.725 class TryExcept(Node):
1.726 def __init__(self, body, handlers, else_, lineno=None):
1.727 @@ -1423,8 +1425,8 @@
1.728 def __repr__(self):
1.729 return "TryExcept(%s, %s, %s)" % (repr(self.body), repr(self.handlers), repr(self.else_))
1.730
1.731 - def visit(self, visitor):
1.732 - return visitor.visitTryExcept(self)
1.733 + def visit(self, visitor, *args):
1.734 + return visitor.visitTryExcept(self, *args)
1.735
1.736 class TryFinally(Node):
1.737 def __init__(self, body, final, lineno=None):
1.738 @@ -1441,8 +1443,8 @@
1.739 def __repr__(self):
1.740 return "TryFinally(%s, %s)" % (repr(self.body), repr(self.final))
1.741
1.742 - def visit(self, visitor):
1.743 - return visitor.visitTryFinally(self)
1.744 + def visit(self, visitor, *args):
1.745 + return visitor.visitTryFinally(self, *args)
1.746
1.747 class Tuple(Node):
1.748 def __init__(self, nodes, lineno=None):
1.749 @@ -1460,8 +1462,8 @@
1.750 def __repr__(self):
1.751 return "Tuple(%s)" % (repr(self.nodes),)
1.752
1.753 - def visit(self, visitor):
1.754 - return visitor.visitTuple(self)
1.755 + def visit(self, visitor, *args):
1.756 + return visitor.visitTuple(self, *args)
1.757
1.758 class UnaryAdd(Node):
1.759 def __init__(self, expr, lineno=None):
1.760 @@ -1477,8 +1479,8 @@
1.761 def __repr__(self):
1.762 return "UnaryAdd(%s)" % (repr(self.expr),)
1.763
1.764 - def visit(self, visitor):
1.765 - return visitor.visitUnaryAdd(self)
1.766 + def visit(self, visitor, *args):
1.767 + return visitor.visitUnaryAdd(self, *args)
1.768
1.769 class UnarySub(Node):
1.770 def __init__(self, expr, lineno=None):
1.771 @@ -1494,8 +1496,8 @@
1.772 def __repr__(self):
1.773 return "UnarySub(%s)" % (repr(self.expr),)
1.774
1.775 - def visit(self, visitor):
1.776 - return visitor.visitUnarySub(self)
1.777 + def visit(self, visitor, *args):
1.778 + return visitor.visitUnarySub(self, *args)
1.779
1.780 class While(Node):
1.781 def __init__(self, test, body, else_, lineno=None):
1.782 @@ -1522,8 +1524,8 @@
1.783 def __repr__(self):
1.784 return "While(%s, %s, %s)" % (repr(self.test), repr(self.body), repr(self.else_))
1.785
1.786 - def visit(self, visitor):
1.787 - return visitor.visitWhile(self)
1.788 + def visit(self, visitor, *args):
1.789 + return visitor.visitWhile(self, *args)
1.790
1.791 class With(Node):
1.792 def __init__(self, expr, vars, body, lineno=None):
1.793 @@ -1550,8 +1552,8 @@
1.794 def __repr__(self):
1.795 return "With(%s, %s, %s)" % (repr(self.expr), repr(self.vars), repr(self.body))
1.796
1.797 - def visit(self, visitor):
1.798 - return visitor.visitWith(self)
1.799 + def visit(self, visitor, *args):
1.800 + return visitor.visitWith(self, *args)
1.801
1.802 class Yield(Node):
1.803 def __init__(self, value, lineno=None):
1.804 @@ -1567,8 +1569,8 @@
1.805 def __repr__(self):
1.806 return "Yield(%s)" % (repr(self.value),)
1.807
1.808 - def visit(self, visitor):
1.809 - return visitor.visitYield(self)
1.810 + def visit(self, visitor, *args):
1.811 + return visitor.visitYield(self, *args)
1.812
1.813 for name, obj in globals().items():
1.814 if isinstance(obj, type) and issubclass(obj, Node):