Skip to content

Commit 148db9c

Browse files
committed
Fix flipflop line numbers
[ruby-core:121605]
1 parent 2650596 commit 148db9c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

prism_compile.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -887,7 +887,7 @@ pm_compile_logical(rb_iseq_t *iseq, LINK_ANCHOR *const ret, pm_node_t *cond, LAB
887887
static void
888888
pm_compile_flip_flop_bound(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret, bool popped, pm_scope_node_t *scope_node)
889889
{
890-
const pm_node_location_t location = { .line = ISEQ_BODY(iseq)->location.first_lineno, .node_id = -1 };
890+
const pm_node_location_t location = PM_NODE_START_LOCATION(scope_node->parser, node);
891891

892892
if (PM_NODE_TYPE_P(node, PM_INTEGER_NODE)) {
893893
PM_COMPILE_NOT_POPPED(node);
@@ -906,7 +906,7 @@ pm_compile_flip_flop_bound(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *
906906
static void
907907
pm_compile_flip_flop(const pm_flip_flop_node_t *flip_flop_node, LABEL *else_label, LABEL *then_label, rb_iseq_t *iseq, const int lineno, LINK_ANCHOR *const ret, bool popped, pm_scope_node_t *scope_node)
908908
{
909-
const pm_node_location_t location = { .line = ISEQ_BODY(iseq)->location.first_lineno, .node_id = -1 };
909+
const pm_node_location_t location = { .line = lineno, .node_id = -1 };
910910
LABEL *lend = NEW_LABEL(location.line);
911911

912912
int again = !(flip_flop_node->base.flags & PM_RANGE_FLAGS_EXCLUDE_END);

0 commit comments

Comments
 (0)