Permalink
Browse files

Should raise LocalJumpError when no block given

  • Loading branch information...
ksss committed Jul 14, 2016
1 parent d4d807b commit 9dc820590f226e5d30c04af7eedb3dff9f5c16e7
Showing with 11 additions and 0 deletions.
  1. +4 −0 src/vm.c
  2. +7 −0 test/t/syntax.rb
View
@@ -1732,6 +1732,10 @@ mrb_vm_exec(mrb_state *mrb, struct RProc *proc, mrb_code *pc)
}
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;
}
View
@@ -38,6 +38,13 @@ def bar(*a)
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

0 comments on commit 9dc8205

Please sign in to comment.