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
This commit is contained in:
nobu 2017-04-28 08:06:33 +00:00
parent efdc6d78ac
commit 7d085cca4b
2 changed files with 30 additions and 3 deletions

View file

@ -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")}}