Commit 16d9b135 authored by Stefan Behnel's avatar Stefan Behnel

use more descriptive C label names for yield/yield-from/await

parent eda7bca9
...@@ -632,8 +632,8 @@ class FunctionState(object): ...@@ -632,8 +632,8 @@ class FunctionState(object):
label += '_' + name label += '_' + name
return label return label
def new_yield_label(self): def new_yield_label(self, expr_type='yield'):
label = self.new_label('resume_from_yield') label = self.new_label('resume_from_%s' % expr_type)
num_and_label = (len(self.yield_labels) + 1, label) num_and_label = (len(self.yield_labels) + 1, label)
self.yield_labels.append(num_and_label) self.yield_labels.append(num_and_label)
return num_and_label return num_and_label
...@@ -1628,7 +1628,7 @@ class CCodeWriter(object): ...@@ -1628,7 +1628,7 @@ class CCodeWriter(object):
# Functions delegated to function scope # Functions delegated to function scope
def new_label(self, name=None): return self.funcstate.new_label(name) def new_label(self, name=None): return self.funcstate.new_label(name)
def new_error_label(self): return self.funcstate.new_error_label() def new_error_label(self): return self.funcstate.new_error_label()
def new_yield_label(self): return self.funcstate.new_yield_label() def new_yield_label(self, *args): return self.funcstate.new_yield_label(*args)
def get_loop_labels(self): return self.funcstate.get_loop_labels() def get_loop_labels(self): return self.funcstate.get_loop_labels()
def set_loop_labels(self, labels): return self.funcstate.set_loop_labels(labels) def set_loop_labels(self, labels): return self.funcstate.set_loop_labels(labels)
def new_loop_labels(self): return self.funcstate.new_loop_labels() def new_loop_labels(self): return self.funcstate.new_loop_labels()
......
...@@ -9445,7 +9445,8 @@ class YieldExprNode(ExprNode): ...@@ -9445,7 +9445,8 @@ class YieldExprNode(ExprNode):
Generate the code to return the argument in 'Naming.retval_cname' Generate the code to return the argument in 'Naming.retval_cname'
and to continue at the yield label. and to continue at the yield label.
""" """
label_num, label_name = code.new_yield_label() label_num, label_name = code.new_yield_label(
self.expr_keyword.replace(' ', '_'))
code.use_label(label_name) code.use_label(label_name)
saved = [] saved = []
......
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