From: Vitja Makarov Date: Sun, 19 Dec 2010 08:32:43 +0000 (+0300) Subject: Remove OldYieldExprNode X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=3c2d9b378707b67aeaf8dc3bf11b9a4585b24546;p=cython.git Remove OldYieldExprNode --- diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py index 88548fec..457684b5 100755 --- a/Cython/Compiler/ExprNodes.py +++ b/Cython/Compiler/ExprNodes.py @@ -4947,32 +4947,6 @@ class LambdaNode(InnerFunctionNode): env.add_lambda_def(self.def_node) -class OldYieldExprNode(ExprNode): - # XXX: remove me someday - # - # arg ExprNode the value to return from the generator - # label_name string name of the C label used for this yield - - subexprs = ['arg'] - type = py_object_type - - def analyse_types(self, env): - self.is_temp = 1 - if self.arg is not None: - self.arg.analyse_types(env) - if not self.arg.type.is_pyobject: - self.arg = self.arg.coerce_to_pyobject(env) - error(self.pos, "Generators are not supported") - - def generate_result_code(self, code): - self.label_name = code.new_label('resume_from_yield') - code.use_label(self.label_name) - code.putln("/* FIXME: save temporary variables */") - code.putln("/* FIXME: return from function, yielding value */") - code.put_label(self.label_name) - code.putln("/* FIXME: restore temporary variables and */") - code.putln("/* FIXME: extract sent value from closure */") - class YieldExprNode(ExprNode): # Yield expression node # diff --git a/Cython/Compiler/Optimize.py b/Cython/Compiler/Optimize.py index 9594b63f..28ed19ff 100644 --- a/Cython/Compiler/Optimize.py +++ b/Cython/Compiler/Optimize.py @@ -1167,7 +1167,7 @@ class EarlyReplaceBuiltinCalls(Visitor.EnvTransform): self.yield_nodes = [] visit_Node = Visitor.TreeVisitor.visitchildren - def visit_OldYieldExprNode(self, node): + def visit_YieldExprNode(self, node): self.yield_nodes.append(node) self.visitchildren(node) diff --git a/Cython/Compiler/ParseTreeTransforms.py b/Cython/Compiler/ParseTreeTransforms.py index 584ca201..73e72565 100644 --- a/Cython/Compiler/ParseTreeTransforms.py +++ b/Cython/Compiler/ParseTreeTransforms.py @@ -1332,6 +1332,9 @@ class YieldNodeCollector(TreeVisitor): def visit_DefNode(self, node): pass + def visit_GeneratorExpressionNode(self, node): + pass + class MarkClosureVisitor(CythonTransform): def visit_ModuleNode(self, node): @@ -1374,7 +1377,6 @@ class MarkClosureVisitor(CythonTransform): self.needs_closure = True return node - class CreateClosureClasses(CythonTransform): # Output closure classes in module scope for all functions # that really need it. diff --git a/Cython/Compiler/Parsing.py b/Cython/Compiler/Parsing.py index d27ed4af..3543ec7e 100644 --- a/Cython/Compiler/Parsing.py +++ b/Cython/Compiler/Parsing.py @@ -1029,7 +1029,7 @@ def p_testlist_comp(s): def p_genexp(s, expr): # s.sy == 'for' loop = p_comp_for(s, Nodes.ExprStatNode( - expr.pos, expr = ExprNodes.OldYieldExprNode(expr.pos, arg=expr))) + expr.pos, expr = ExprNodes.YieldExprNode(expr.pos, arg=expr))) return ExprNodes.GeneratorExpressionNode(expr.pos, loop=loop) expr_terminators = (')', ']', '}', ':', '=', 'NEWLINE')