mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Set the ORPHAN flag in Proc.new; fix #3798
This commit is contained in:
+5
-1
@@ -163,7 +163,11 @@ mrb_proc_s_new(mrb_state *mrb, mrb_value proc_class)
|
||||
p = (struct RProc *)mrb_obj_alloc(mrb, MRB_TT_PROC, mrb_class_ptr(proc_class));
|
||||
mrb_proc_copy(p, mrb_proc_ptr(blk));
|
||||
proc = mrb_obj_value(p);
|
||||
mrb_funcall_with_block(mrb, proc, mrb_intern_lit(mrb, "initialize"), 0, NULL, blk);
|
||||
mrb_funcall_with_block(mrb, proc, mrb_intern_lit(mrb, "initialize"), 0, NULL, proc);
|
||||
if (!MRB_PROC_STRICT_P(p) &&
|
||||
mrb->c->ci > mrb->c->cibase && p->env == mrb->c->ci[-1].env) {
|
||||
p->flags |= MRB_PROC_ORPHAN;
|
||||
}
|
||||
return proc;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user