Commit 72b28f1e authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto Committed by GitHub

Merge pull request #3174 from ksss/local-jump-error

Should raise LocalJumpError when no block given
parents d4d807b7 9dc82059
......@@ -1732,6 +1732,10 @@ RETRY_TRY_BLOCK:
}
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];
NEXT;
}
......
......@@ -38,6 +38,13 @@ assert('yield', '11.3.5') do
assert_raise LocalJumpError do
yield
end
assert_raise LocalJumpError do
o = Object.new
def o.foo
yield
end
o.foo
end
end
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