Skip to content

Commit

Permalink
Check if a block is a lambda before marking it orphan; ref #3640
Browse files Browse the repository at this point in the history
  • Loading branch information
matz committed Jun 3, 2017
1 parent c041206 commit 935649b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/vm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down Expand Up @@ -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;
}
}
Expand Down

0 comments on commit 935649b

Please sign in to comment.