NameNode to new temps
authorDag Sverre Seljebotn <dagss@student.matnat.uio.no>
Fri, 27 Mar 2009 13:37:43 +0000 (14:37 +0100)
committerDag Sverre Seljebotn <dagss@student.matnat.uio.no>
Fri, 27 Mar 2009 13:37:43 +0000 (14:37 +0100)
Cython/Compiler/ExprNodes.py

index 5dcc74000ac8007926c618b40a285c5ff0d7a90c..36145a9df9fa5ee17bf255026cb19d1c5e22a8a0 100644 (file)
@@ -1072,7 +1072,7 @@ class ImagNode(AtomicNewTempExprNode):
         
 
 
-class NameNode(AtomicExprNode):
+class NameNode(AtomicNewTempExprNode):
     #  Reference to a local or global variable name.
     #
     #  name            string    Python name of the variable
@@ -1118,7 +1118,7 @@ class NameNode(AtomicExprNode):
                     node.entry = var_entry
                     node.analyse_rvalue_entry(env)
                     return node
-        return AtomicExprNode.coerce_to(self, dst_type, env)
+        return super(NameNode, self).coerce_to(dst_type, env)
     
     def analyse_as_module(self, env):
         # Try to interpret this as a reference to a cimported module.
@@ -1174,6 +1174,14 @@ class NameNode(AtomicExprNode):
         if not self.entry:
             self.type = PyrexTypes.error_type
             return
+        entry = self.entry
+        if entry:
+            entry.used = 1
+            if entry.type.is_buffer:
+                import Buffer
+                Buffer.used_buffer_aux_vars(entry)
+            if entry.utility_code:
+                env.use_utility_code(entry.utility_code)
         self.analyse_rvalue_entry(env)
         
     def analyse_target_types(self, env):
@@ -1260,17 +1268,6 @@ class NameNode(AtomicExprNode):
         #  result is in a temporary.
         return 0
     
-    def allocate_temp(self, env, result = None):
-        AtomicExprNode.allocate_temp(self, env, result)
-        entry = self.entry
-        if entry:
-            entry.used = 1
-            if entry.type.is_buffer:
-                import Buffer
-                Buffer.used_buffer_aux_vars(entry)
-            if entry.utility_code:
-                env.use_utility_code(entry.utility_code)
-        
     def calculate_result_code(self):
         entry = self.entry
         if not entry: