mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
adjust proc->target_class according to surrounding proc->target_class; based on a patch from @Fleurer; close #1627
This commit is contained in:
+8
-1
@@ -17,9 +17,16 @@ struct RProc *
|
||||
mrb_proc_new(mrb_state *mrb, mrb_irep *irep)
|
||||
{
|
||||
struct RProc *p;
|
||||
mrb_callinfo *ci = mrb->c->ci;
|
||||
|
||||
p = (struct RProc*)mrb_obj_alloc(mrb, MRB_TT_PROC, mrb->proc_class);
|
||||
p->target_class = (mrb->c->ci) ? mrb->c->ci->target_class : 0;
|
||||
p->target_class = 0;
|
||||
if (ci) {
|
||||
if (ci->proc)
|
||||
p->target_class = ci->proc->target_class;
|
||||
if (!p->target_class)
|
||||
p->target_class = ci->target_class;
|
||||
}
|
||||
p->body.irep = irep;
|
||||
p->env = 0;
|
||||
mrb_irep_incref(mrb, irep);
|
||||
|
||||
Reference in New Issue
Block a user