Add no_assignment_synthesis flag to DefNode
authorVitja Makarov <vitja.makarov@gmail.com>
Wed, 12 Jan 2011 09:29:47 +0000 (12:29 +0300)
committerVitja Makarov <vitja.makarov@gmail.com>
Wed, 12 Jan 2011 09:29:47 +0000 (12:29 +0300)
Cython/Compiler/ExprNodes.py
Cython/Compiler/Nodes.py

index 82c54836d290149d8a902de394c75aa3f0b032de..8e19c3974745e56d6564e0854af60d9c896fa1c0 100755 (executable)
@@ -4955,10 +4955,8 @@ class GeneratorExpressionNode(LambdaNode):
     binding = False
 
     def analyse_declarations(self, env):
-        # XXX: dirty hack to disable assignment synthesis
-        self.def_node.needs_assignment_synthesis = lambda *args, **kwargs: False
+        self.def_node.no_assignment_synthesis = True
         self.def_node.analyse_declarations(env)
-        #super(GeneratorExpressionNode, self).analyse_declarations(env)
         env.add_lambda_def(self.def_node)
 
     def generate_result_code(self, code):
index b23b81fbf0680ad1544a841b02519c9167c96321..d71bb599b15d0e3ac03a7bf11796b340652147f3 100644 (file)
@@ -1892,6 +1892,7 @@ class DefNode(FuncDefNode):
     num_required_kw_args = 0
     reqd_kw_flags_cname = "0"
     is_wrapper = 0
+    no_assignment_synthesis = 0
     decorators = None
     return_type_annotation = None
     entry = None
@@ -2227,6 +2228,8 @@ class DefNode(FuncDefNode):
             self.synthesize_assignment_node(env)
 
     def needs_assignment_synthesis(self, env, code=None):
+        if self.no_assignment_synthesis:
+            return False
         # Should enable for module level as well, that will require more testing...
         if self.entry.is_anonymous:
             return True