Unverified Commit 9dc82059 authored by ksss's avatar ksss

Should raise LocalJumpError when no block given

parent d4d807b7
...@@ -1732,6 +1732,10 @@ RETRY_TRY_BLOCK: ...@@ -1732,6 +1732,10 @@ RETRY_TRY_BLOCK:
} }
stack = e->stack + 1; stack = e->stack + 1;
} }
if (mrb_nil_p(stack[m1+r+m2])) {
localjump_error(mrb, LOCALJUMP_ERROR_YIELD);
goto L_RAISE;
}
regs[a] = stack[m1+r+m2]; regs[a] = stack[m1+r+m2];
NEXT; NEXT;
} }
......
...@@ -38,6 +38,13 @@ assert('yield', '11.3.5') do ...@@ -38,6 +38,13 @@ assert('yield', '11.3.5') do
assert_raise LocalJumpError do assert_raise LocalJumpError do
yield yield
end end
assert_raise LocalJumpError do
o = Object.new
def o.foo
yield
end
o.foo
end
end end
assert('Abbreviated variable assignment', '11.4.2.3.2') do assert('Abbreviated variable assignment', '11.4.2.3.2') do
......
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