From 7d085cca4be9c7292fbf58c75b2c49d7d06f79fe Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 28 Apr 2017 08:06:33 +0000 Subject: parse.y: fix line in rescue * parse.y (set_line_body, primary): fix line number of bodystmt as the beginning of the block. [ruby-core:79388] [Bug #13181] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58499 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_parse.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'test') diff --git a/test/ruby/test_parse.rb b/test/ruby/test_parse.rb index c2ee56ae52..09cb0cf2a5 100644 --- a/test/ruby/test_parse.rb +++ b/test/ruby/test_parse.rb @@ -965,6 +965,19 @@ x = __ENCODING__ end; end + def test_method_location_in_rescue + bug = '[ruby-core:79388] [Bug #13181]' + obj, line = Object.new, __LINE__+1 + def obj.location + # + raise + rescue + caller_locations(1, 1)[0] + end + + assert_equal(line, obj.location.lineno, bug) + end + =begin def test_past_scope_variable assert_warning(/past scope/) {catch {|tag| eval("BEGIN{throw tag}; tap {a = 1}; a")}} -- cgit v1.2.3