[Checkins] SVN: Sandbox/malthe/chameleon.core/ Fixed assignment	issue where an assignment that involves the assigned variable	name would fail,	because dynamic scope would not be enabled due to an ordering issue.
    Malthe Borch 
    mborch at gmail.com
       
    Sun Nov 16 22:05:22 EST 2008
    
    
  
Log message for revision 93031:
  Fixed assignment issue where an assignment that involves the assigned variable name would fail, because dynamic scope would not be enabled due to an ordering issue.
Changed:
  U   Sandbox/malthe/chameleon.core/CHANGES.txt
  U   Sandbox/malthe/chameleon.core/src/chameleon/core/transformer.py
-=-
Modified: Sandbox/malthe/chameleon.core/CHANGES.txt
===================================================================
--- Sandbox/malthe/chameleon.core/CHANGES.txt	2008-11-17 01:57:13 UTC (rev 93030)
+++ Sandbox/malthe/chameleon.core/CHANGES.txt	2008-11-17 03:05:21 UTC (rev 93031)
@@ -4,6 +4,9 @@
 HEAD
 ~~~~
 
+- Visit evaluation before assignment in order to support assignments
+  that rely on the same name in the dynamic variable scope. [malthe]
+
 - Conditions may now be inverted; this facilitates the bug-fix of an
   issue where omit conditions were multi-part. [malthe]
 
Modified: Sandbox/malthe/chameleon.core/src/chameleon/core/transformer.py
===================================================================
--- Sandbox/malthe/chameleon.core/src/chameleon/core/transformer.py	2008-11-17 01:57:13 UTC (rev 93030)
+++ Sandbox/malthe/chameleon.core/src/chameleon/core/transformer.py	2008-11-17 03:05:21 UTC (rev 93031)
@@ -11,7 +11,7 @@
         if node is None:
             return None
         if type(node) is tuple:
-            return tuple([self.visit(n) for n in node])
+            return tuple(self.visit(n) for n in node)
         visitor = getattr(self, 'visit%s' % node.__class__.__name__,
                           self._visitDefault)
         return visitor(node)
@@ -85,9 +85,9 @@
         return self._clone(node, self.visit(node.test), self.visit(node.fail))
 
     def visitAssign(self, node):
-        return self._clone(node, [self.visit(x) for x in node.nodes],
-            self.visit(node.expr)
-        )
+        expr = self.visit(node.expr)
+        return self._clone(
+            node, [self.visit(x) for x in node.nodes], expr)
 
     def visitAssAttr(self, node):
         return self._clone(node, self.visit(node.expr), node.attrname,
    
    
More information about the Checkins
mailing list