Skip to content

Commit

Permalink
[PRISM] Remove dummy_line_node usage for multi write node
Browse files Browse the repository at this point in the history
  • Loading branch information
kddnewton committed Apr 4, 2024
1 parent 5e8546e commit 449384f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions prism_compile.c
Expand Up @@ -6641,6 +6641,9 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret,
return;
}
case PM_MULTI_WRITE_NODE: {
// foo, bar = baz
// ^^^^^^^^^^^^^^
//
// A multi write node represents writing to multiple values using an =
// operator. Importantly these nodes are only parsed when the left-hand
// side of the operator has multiple targets. The right-hand side of the
Expand All @@ -6659,17 +6662,16 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret,
size_t stack_size = pm_compile_multi_target_node(iseq, node, ret, writes, cleanup, scope_node, &state);

PM_COMPILE_NOT_POPPED(cast->value);
PM_DUP_UNLESS_POPPED;
if (!popped) PUSH_INSN(ret, location, dup);

ADD_SEQ(ret, writes);
if (!popped && stack_size >= 1) {
// Make sure the value on the right-hand side of the = operator is
// being returned before we pop the parent expressions.
ADD_INSN1(ret, &dummy_line_node, setn, INT2FIX(stack_size));
PUSH_INSN1(ret, location, setn, INT2FIX(stack_size));
}

ADD_SEQ(ret, cleanup);

return;
}
case PM_NEXT_NODE: {
Expand Down

0 comments on commit 449384f

Please sign in to comment.