[pypy-svn] r66447 - pypy/branch/parser-compiler/pypy/interpreter/astcompiler

benjamin at codespeak.net benjamin at codespeak.net
Mon Jul 20 18:15:52 CEST 2009


Author: benjamin
Date: Mon Jul 20 18:15:51 2009
New Revision: 66447

Modified:
   pypy/branch/parser-compiler/pypy/interpreter/astcompiler/codegen.py
Log:
allow this to be folded into a switch

Modified: pypy/branch/parser-compiler/pypy/interpreter/astcompiler/codegen.py
==============================================================================
--- pypy/branch/parser-compiler/pypy/interpreter/astcompiler/codegen.py	(original)
+++ pypy/branch/parser-compiler/pypy/interpreter/astcompiler/codegen.py	Mon Jul 20 18:15:51 2009
@@ -1007,19 +1007,20 @@
     def visit_Attribute(self, attr):
         self.update_position(attr.lineno)
         names = self.names
-        if attr.ctx != ast.AugStore:
+        ctx = attr.ctx
+        if ctx != ast.AugStore:
             attr.value.walkabout(self)
-        if attr.ctx == ast.AugLoad:
+        if ctx == ast.AugLoad:
             self.emit_op(ops.DUP_TOP)
             self.emit_op_name(ops.LOAD_ATTR, names, attr.attr)
-        elif attr.ctx == ast.Load:
+        elif ctx == ast.Load:
             self.emit_op_name(ops.LOAD_ATTR, names, attr.attr)
-        elif attr.ctx == ast.AugStore:
+        elif ctx == ast.AugStore:
             self.emit_op(ops.ROT_TWO)
             self.emit_op_name(ops.STORE_ATTR, names, attr.attr)
-        elif attr.ctx == ast.Store:
+        elif ctx == ast.Store:
             self.emit_op_name(ops.STORE_ATTR, names, attr.attr)
-        elif attr.ctx == ast.Del:
+        elif ctx == ast.Del:
             self.emit_op_name(ops.DELETE_ATTR, names, attr.attr)
         else:
             raise AssertionError("unknown context")



More information about the Pypy-commit mailing list