1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

forwardable.rb: adjust backtrace by tail call

* lib/forwardable.rb (def_instance_delegator): adjust backtrace of
  method body by tail call optimization.  adjusting the delegated
  target is still done by deleting backtrace.
* lib/forwardable.rb (def_single_delegator): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53383 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2015-12-30 02:28:59 +00:00
parent d8eb5ade4f
commit 6fd18ca51b
3 changed files with 38 additions and 18 deletions

View file

@ -187,6 +187,7 @@ class TestForwardable < Test::Unit::TestCase
extend Forwardable
def_delegator :bar, :baz
def_delegator :caller, :itself, :c
class Exception
end
@ -197,6 +198,7 @@ class TestForwardable < Test::Unit::TestCase
Foo.new.baz
}
assert_not_match(/\/forwardable\.rb/, e.backtrace[0])
assert_equal(caller(0, 1)[0], Foo.new.c[0])
end
class Foo2 < BasicObject