summaryrefslogtreecommitdiff
path: root/prism_compile.c
diff options
context:
space:
mode:
authorAaron Patterson <[email protected]>2025-01-07 16:14:18 -0800
committerAaron Patterson <[email protected]>2025-01-07 17:08:43 -0800
commit63723c8d5908569918fb27e070ae5bc9de33c8bd ()
treea3682babb44b878ea1f074b106efbcd8392e82fd /prism_compile.c
parent4a78d74039df3fc6870800596667a7b42522b032 (diff)
Correctly set node_id on iseq location
The iseq location object has a slot for node ids. parse.y was correctly populating that field but Prism was not. This commit populates the field with the ast node id for that iseq [Bug #21014]
Notes: Merged: https://.com/ruby/ruby/pull/12527
-rw-r--r--prism_compile.c4
1 files changed, 2 insertions, 2 deletions
@@ -6486,7 +6486,7 @@ pm_compile_scope_node(rb_iseq_t *iseq, pm_scope_node_t *scope_node, const pm_nod
case ISEQ_TYPE_BLOCK: {
LABEL *start = ISEQ_COMPILE_DATA(iseq)->start_label = NEW_LABEL(0);
LABEL *end = ISEQ_COMPILE_DATA(iseq)->end_label = NEW_LABEL(0);
- const pm_node_location_t block_location = { .line = body->location.first_lineno, .node_id = -1 };
start->rescued = LABEL_RESCUE_BEG;
end->rescued = LABEL_RESCUE_END;
@@ -6612,7 +6612,7 @@ pm_compile_scope_node(rb_iseq_t *iseq, pm_scope_node_t *scope_node, const pm_nod
}
if (!PM_NODE_TYPE_P(scope_node->ast_node, PM_ENSURE_NODE)) {
- const pm_node_location_t location = { .line = ISEQ_COMPILE_DATA(iseq)->last_line, .node_id = -1 };
PUSH_INSN(ret, location, leave);
}
}