Skip to content

Commit

Permalink
[PRISM] Remove dummy_line_node usage for block argument nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
kddnewton committed Apr 4, 2024
1 parent c15c611 commit ffd9402
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions prism_compile.c
Expand Up @@ -4622,15 +4622,17 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret,
return;
}
case PM_BLOCK_ARGUMENT_NODE: {
pm_block_argument_node_t *cast = (pm_block_argument_node_t *) node;
// foo(&bar)
// ^^^^
const pm_block_argument_node_t *cast = (const pm_block_argument_node_t *) node;

if (cast->expression) {
if (cast->expression != NULL) {
PM_COMPILE(cast->expression);
}
else {
// If there's no expression, this must be block forwarding.
pm_local_index_t local_index = pm_lookup_local_index(iseq, scope_node, PM_CONSTANT_AND, 0);
ADD_INSN2(ret, &dummy_line_node, getblockparamproxy, INT2FIX(local_index.index + VM_ENV_DATA_SIZE - 1), INT2FIX(local_index.level));
PUSH_INSN2(ret, location, getblockparamproxy, INT2FIX(local_index.index + VM_ENV_DATA_SIZE - 1), INT2FIX(local_index.level));
}
return;
}
Expand Down

0 comments on commit ffd9402

Please sign in to comment.