mirror of
https://github.com/ruby/ruby.git
synced 2025-09-16 09:04:05 +02:00
compile.c: disable tco with rescue
* compile.c (iseq_optimize): disable tail call optimization in rescued, rescue, and ensure blocks. [ruby-core:73871] [Bug #12082] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54542 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
0ebf3849e4
commit
f0226f0a3c
3 changed files with 75 additions and 2 deletions
|
@ -295,6 +295,30 @@ class TestRubyOptimization < Test::Unit::TestCase
|
|||
assert_equal(:ok, yield_result)
|
||||
end
|
||||
|
||||
def do_raise
|
||||
raise "should be rescued"
|
||||
end
|
||||
|
||||
def errinfo
|
||||
$!
|
||||
end
|
||||
|
||||
def test_tailcall_inhibited_by_rescue
|
||||
bug12082 = '[ruby-core:73871] [Bug #12082]'
|
||||
|
||||
tailcall(<<-'end;')
|
||||
def to_be_rescued
|
||||
return do_raise
|
||||
1 + 2
|
||||
rescue
|
||||
errinfo
|
||||
end
|
||||
end;
|
||||
result = to_be_rescued
|
||||
assert_instance_of(RuntimeError, result, bug12082)
|
||||
assert_equal("should be rescued", result.message, bug12082)
|
||||
end
|
||||
|
||||
class Bug10557
|
||||
def [](_)
|
||||
block_given?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue