Commit 3c2d9b37 authored by Vitja Makarov's avatar Vitja Makarov

Remove OldYieldExprNode

parent 1edfca8d
......@@ -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
#
......
......@@ -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)
......
......@@ -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.
......
......@@ -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')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment