Permalink
Browse files

shuld handle return in rescue; close #487

  • Loading branch information...
1 parent 651e8b7 commit 2f5f853111dd5d73cb7a85c5306aa1e41d3d7fc4 @matz matz committed Oct 19, 2012
Showing with 3 additions and 0 deletions.
  1. +3 −0 src/vm.c
View
@@ -1126,20 +1126,23 @@ mrb_run(mrb_state *mrb, struct RProc *proc, mrb_value self)
switch (GETARG_B(i)) {
case OP_R_NORMAL:
+ NORMAL_RETURN:
if (ci == mrb->cibase) {
localjump_error(mrb, "return");
goto L_RAISE;
}
ci = mrb->ci;
break;
case OP_R_BREAK:
+ if (!proc->env) goto NORMAL_RETURN;
if (proc->env->cioff < 0) {
localjump_error(mrb, "break");
goto L_RAISE;
}
ci = mrb->ci = mrb->cibase + proc->env->cioff + 1;
break;
case OP_R_RETURN:
+ if (!proc->env) goto NORMAL_RETURN;
if (proc->env->cioff < 0) {
localjump_error(mrb, "return");
goto L_RAISE;

0 comments on commit 2f5f853

Please sign in to comment.