diff options
| author | Jemma Issroff <jemmaissroff@gmail.com> | 2023-09-01 11:02:37 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-09-01 08:02:37 -0700 |
| commit | 4f290bc3283accbec70ed2bbd613e40d88131220 (patch) | |
| tree | 255779ab795daca8e0f147861b5366554498a8b3 | |
| parent | 771576f02185b1044f23a451e3ac6b58494844dc (diff) | |
[YARP] Small fixes for existing ConstantNodes (#8346)
Popped was slightly inaccurate for ConstantNodes and leading to issues
if there was content after a ConstantNode. This fix doesn't pop
any ConstantWriteNode values.
Notes
Notes:
Merged-By: jemmaissroff
| -rw-r--r-- | yarp/yarp_compiler.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/yarp/yarp_compiler.c b/yarp/yarp_compiler.c index f8fc004ce7..07959b663c 100644 --- a/yarp/yarp_compiler.c +++ b/yarp/yarp_compiler.c @@ -624,11 +624,14 @@ yp_compile_node(rb_iseq_t *iseq, const yp_node_t *node, LINK_ANCHOR *const ret, ADD_INSN(ret, &dummy_line_node, putnil); ADD_INSN1(ret, &dummy_line_node, putobject, Qtrue); ADD_INSN1(ret, &dummy_line_node, getconstant, ID2SYM(parse_node_symbol((yp_node_t *)constant_read_node))); + if (popped) { + ADD_INSN(ret, &dummy_line_node, pop); + } return; } case YP_NODE_CONSTANT_WRITE_NODE: { yp_constant_write_node_t *constant_write_node = (yp_constant_write_node_t *) node; - yp_compile_node(iseq, constant_write_node->value, ret, src, popped, compile_context); + yp_compile_node(iseq, constant_write_node->value, ret, src, false, compile_context); if (!popped) { ADD_INSN(ret, &dummy_line_node, dup); |
