summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Newton <kddnewton@gmail.com>2024-04-04 10:11:42 -0400
committerKevin Newton <kddnewton@gmail.com>2024-04-04 14:14:55 -0400
commit449384f33737edadeacd79872f21217288913130 (patch)
tree4b50eaffebef6f2f9c5f9d9d8162d70333272163
parent5e8546e8a9565c1ddd628e396ed2d2fdc1515ad7 (diff)
[PRISM] Remove dummy_line_node usage for multi write node
-rw-r--r--prism_compile.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/prism_compile.c b/prism_compile.c
index 833451f7e7..dcc816042d 100644
--- a/prism_compile.c
+++ b/prism_compile.c
@@ -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
@@ -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: {