Skip to content

Commit

Permalink
Do not raise an exception for living closure; ref #3359
Browse files Browse the repository at this point in the history
  • Loading branch information
matz committed Apr 20, 2017
1 parent 6a0b68f commit edd9fc6
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/vm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1828,7 +1828,7 @@ mrb_vm_exec(mrb_state *mrb, struct RProc *proc, mrb_code *pc)
ci = mrb->c->ci;
break;
case OP_R_BREAK:
if (ci->acc < 0 || !proc->env || !MRB_ENV_STACK_SHARED_P(proc->env)) {
if (!proc->env || !MRB_ENV_STACK_SHARED_P(proc->env)) {
mrb_value exc;

L_BREAK_ERROR:
Expand All @@ -1843,8 +1843,16 @@ mrb_vm_exec(mrb_state *mrb, struct RProc *proc, mrb_code *pc)

mrb->c = c->prev;
c->prev = NULL;
ci = mrb->c->ci;
}
if (ci->acc < 0) {
while (eidx > mrb->c->ci[-1].eidx) {
ecall(mrb, --eidx);
}
mrb->c->vmexec = FALSE;
mrb->jmp = prev_jmp;
return v;
}
ci = mrb->c->ci;
mrb->c->stack = ci->stackent;
mrb->c->ci = mrb->c->cibase + proc->env->cioff + 1;
while (ci > mrb->c->ci) {
Expand Down

0 comments on commit edd9fc6

Please sign in to comment.