Commit 96819cf8 authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto

Merge pull request #117 from k-tsj/toplevel-return

Raise LocalJumpError when returning from top-level
parents 04f8ec75 66df0ad0
......@@ -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:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment