Skip to content
Browse files

should raise error on return in block in top-level; close #664

  • Loading branch information...
1 parent e48ed9c commit 40ea525d1e5a94771a5b1e57f001267dfe8da046 @matz matz committed Dec 21, 2012
Showing with 4 additions and 0 deletions.
  1. +4 −0 src/vm.c
View
4 src/vm.c
@@ -1199,6 +1199,10 @@ mrb_run(mrb_state *mrb, struct RProc *proc, mrb_value self)
goto L_RAISE;
}
ci = mrb->ci = mrb->cibase + e->cioff;
+ if (ci == mrb->cibase) {
+ localjump_error(mrb, "return");
+ goto L_RAISE;
+ }
break;
}
case OP_R_NORMAL:

0 comments on commit 40ea525

Please sign in to comment.
Something went wrong with that request. Please try again.