Commits

Victor Stinner  committed 9032d88

Fix Optimizer.replace_var()

  • Participants
  • Parent commits 66191d2

Comments (0)

Files changed (1)

File astoptimizer/optimizer.py

         self.is_conditional = False
         return self.visit(tree)
 
-    def optimize(self, tree, filename=None):
+    def optimize(self, tree, filename):
         namespace = Namespace()
         self.filename = filename
         return self._optimize(tree, namespace)
 
     def replace_var(self, node, name, value):
         replace = ReplaceVariable(self.config, name, value)
-        return replace.visit(node)
+        return replace.optimize(node, self.filename)
 
     def try_unroll_listcomp(self, node):
         if self.config.unroll_limit <= 0:
         if node.id == self.name:
             return self.value
 
-        return Optimizer.visit_Name(node)
+        return Optimizer.visit_Name(self, node)