diff options
author | Kevin Newton <[email protected]> | 2024-05-28 12:21:25 -0400 |
---|---|---|
committer | Kevin Newton <[email protected]> | 2024-05-28 13:12:21 -0400 |
commit | fd95ba255a413ff02cdc542dd16a2e2901387fc6 (patch) | |
tree | 535c07117e2d4632ad3779383ba7465a60926470 /compile.c | |
parent | 8f84fbbf968a43c44b34ada601cf2b4a0bfa9d54 (diff) |
Make ensure first lineno the first line of the ensure
Previously, ensure ISEQs took their first line number from the
line number coming from the AST. However, if this is coming from
an empty `begin`..`end` inside of a method, this can be all of the
way back to the method declaration. Instead, this commit changes
it to be the first line number of the ensure block itself.
The first_lineno field is only accessible through manual ISEQ
compilation or through tracepoint. Either way, this will be more
accurate for targeting going forward.
Diffstat (limited to 'compile.c')
-rw-r--r-- | compile.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -8343,7 +8343,7 @@ compile_resbody(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, static int compile_ensure(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, int popped) { - const int line = nd_line(node); + const int line = nd_line(RNODE_ENSURE(node)->nd_ensr); const NODE *line_node = node; DECL_ANCHOR(ensr); const rb_iseq_t *ensure = NEW_CHILD_ISEQ(RNODE_ENSURE(node)->nd_ensr, |