Project

General

Profile

Actions

Bug #20479

closed

Ensure line number in begin...end in method

Added by kddnewton (Kevin Newton) about 2 months ago. Updated 29 days ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:117813]

Description

In the following example:

def foo
  begin
  rescue
    p :rescue
  ensure
    p :ensure
  end
end

the ISEQ has the label: #<ISeq:ensure in foo@test.rb:6 (6,4)-(6,13)>, but tracepoint reports that first_lineno is 1. This is coming straight from the AST, which says @ NODE_ENSURE (id: 12, line: 1, location: (2,7)-(6,13)).

This seems incorrect. The rescue knows that its line starts on line 3, but ensure says it starts on line 1. Could we change that to reflect the actual line it's on?

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0