From: "kddnewton (Kevin Newton) via ruby-core" Date: 2024-05-09T19:39:47+00:00 Subject: [ruby-core:117823] [Ruby master Bug#20479] Ensure line number in begin...end in method Issue #20479 has been updated by kddnewton (Kevin Newton). It's only visible if you manually `RubyVM::InstructionSequence.compile` and then specifically ask an ensure ISEQ for `first_lineno`. This doesn't seem likely, and since RubyVM::ISEQ is private, it should be okay? ---------------------------------------- Bug #20479: Ensure line number in begin...end in method https://bugs.ruby-lang.org/issues/20479#change-108232 * Author: kddnewton (Kevin Newton) * Status: Open * Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN ---------------------------------------- In the following example: ```ruby def foo begin rescue p :rescue ensure p :ensure end end ``` the ISEQ has the label: `#`, 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? -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/