Permalink
Browse files

Check if a block is a lambda before marking it orphan; ref #3640

  • Loading branch information...
matz committed Jun 3, 2017
1 parent c041206 commit 935649b8447053e94ea92375fc9f5a71aed1053e
Showing with 3 additions and 2 deletions.
  1. +3 −2 src/vm.c
View
@@ -1335,7 +1335,7 @@ mrb_vm_exec(mrb_state *mrb, struct RProc *proc, mrb_code *pc)
if (mrb_type(blk) == MRB_TT_PROC) {
struct RProc *p = mrb_proc_ptr(blk);
if (p && p->env == ci[-1].env) {
if (p && !MRB_PROC_STRICT_P(p) && p->env == ci[-1].env) {
p->flags |= MRB_PROC_ORPHAN;
}
}
@@ -1775,7 +1775,8 @@ mrb_vm_exec(mrb_state *mrb, struct RProc *proc, mrb_code *pc)
if (mrb_type(blk) == MRB_TT_PROC) {
struct RProc *p = mrb_proc_ptr(blk);
if (ci > mrb->c->cibase && p->env == ci[-1].env) {
if (!MRB_PROC_STRICT_P(proc) &&
ci > mrb->c->cibase && p->env == ci[-1].env) {
p->flags |= MRB_PROC_ORPHAN;
}
}

0 comments on commit 935649b

Please sign in to comment.