mirror of
https://github.com/ruby/ruby.git
synced 2025-08-27 15:06:10 +02:00
fix return in toplevel rescue/ensure
* compile.c (iseq_compile_each0): throw TAG_RETURN at return in toplevel rescue/ensure to adjust VM stack properly. [ruby-core:81777] [Bug #13682] * vm_insnhelper.c (vm_throw_start): allow return in toplevel rescue/ensure. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59183 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
c95cbf6aab
commit
1474acff3c
4 changed files with 39 additions and 4 deletions
|
@ -525,4 +525,14 @@ class TestEval < Test::Unit::TestCase
|
|||
b.eval('yield')
|
||||
}, '[Bug #10368]'
|
||||
end
|
||||
|
||||
def test_return_in_eval_proc
|
||||
x = proc {eval("return :ng")}
|
||||
assert_raise(LocalJumpError) {x.call}
|
||||
end
|
||||
|
||||
def test_return_in_eval_lambda
|
||||
x = lambda {eval("return :ok")}
|
||||
assert_equal(:ok, x.call)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue