1.1 --- a/simplify.py Fri Jul 28 00:20:57 2006 +0200
1.2 +++ b/simplify.py Sun Jul 30 02:00:33 2006 +0200
1.3 @@ -415,6 +415,17 @@
1.4 def visitInvert(self, invert):
1.5 return Invoke(invert, expr=LoadAttr(expr=self.dispatch(invert.expr), name="__invert__"), args=[])
1.6
1.7 + def visitAdd(self, add):
1.8 +
1.9 + # NOTE: Strictly one of the choices must be evaluated, never more than one.
1.10 +
1.11 + result = Choice(add)
1.12 + result.choices = [
1.13 + Invoke(expr=LoadAttr(expr=self.dispatch(add.left), name="__add__"), args=[self.dispatch(add.right)]),
1.14 + Invoke(expr=LoadAttr(expr=self.dispatch(add.right), name="__radd__"), args=[self.dispatch(add.left)])
1.15 + ]
1.16 + return result
1.17 +
1.18 # Assignments.
1.19
1.20 augassign_methods = {
1.21 @@ -776,7 +787,7 @@
1.22 # Exception node transformations.
1.23
1.24 def visitTryFinally(self, tryfinally):
1.25 - result = Try(tryfinally, body=[], handlers=[], else_=[], finally_=[])
1.26 + result = Try(tryfinally, body=[], else_=[], finally_=[])
1.27 if tryfinally.body is not None:
1.28 result.body = self.dispatch(tryfinally.body)
1.29 if tryfinally.final is not None: