'Generate the code to return the argument in \'Naming.retval_cname\'
and to continue at the yield label.'

def generate_yield_code(self, code):

    (label_num, label_name) = code.new_yield_label(self.expr_keyword.replace('    ', '_'))
    code.use_label(label_name)
    saved = []
    code.funcstate.closure_temps.reset()
    for (cname, type, manage_ref) in code.funcstate.temps_in_use():
        save_cname = code.funcstate.closure_temps.allocate_temp(type)
        saved.append((cname, save_cname, type))
        if type.is_pyobject:
            code.put_xgiveref(cname)
        code.putln(('%s->%s    =    %s;' % (Naming.cur_scope_cname, save_cname, cname)))
    code.put_xgiveref(Naming.retval_cname)
    profile = code.globalstate.directives['profile']
    linetrace = code.globalstate.directives['linetrace']
    if (profile or linetrace):
        code.put_trace_return(Naming.retval_cname, nogil=(not code.funcstate.gil_owned))
    code.put_finish_refcount_context()
    code.putln(('/*    return    from    %sgenerator,    %sing    value    */' % (('async    ' if self.in_async_gen else ''), ('await' if self.is_await else 'yield'))))
    code.putln(('%s->resume_label    =    %d;' % (Naming.generator_cname, label_num)))
    if (self.in_async_gen and (not self.is_await)):
        code.putln(('return    __Pyx__PyAsyncGenValueWrapperNew(%s);' % Naming.retval_cname))
    else:
        code.putln(('return    %s;' % Naming.retval_cname))
    code.put_label(label_name)
    for (cname, save_cname, type) in saved:
        code.putln(('%s    =    %s->%s;' % (cname, Naming.cur_scope_cname, save_cname)))
        if type.is_pyobject:
            code.putln(('%s->%s    =    0;' % (Naming.cur_scope_cname, save_cname)))
            code.put_xgotref(cname)
    self.generate_sent_value_handling_code(code, Naming.sent_value_cname)
    if self.result_is_used:
        self.allocate_temp_result(code)
        code.put(('%s    =    %s;    ' % (self.result(), Naming.sent_value_cname)))
        code.put_incref(self.result(), py_object_type)
