Raise LocalJumpError when returning from top-level

This commit is contained in:
Kazuki Tsujimoto
2012-05-12 10:59:36 +09:00
parent e6631bf5af
commit 66df0ad0a8
+4
View File
@@ -1002,6 +1002,10 @@ mrb_run(mrb_state *mrb, struct RProc *proc, mrb_value self)
switch (GETARG_B(i)) {
case OP_R_NORMAL:
if (ci == mrb->cibase) {
localjump_error(mrb, "return");
goto L_RAISE;
}
ci = mrb->ci;
break;
case OP_R_BREAK: