From 4c2fc88b2114045f496a0cd2743b7984d113e274 Mon Sep 17 00:00:00 2001 From: Jemma Issroff Date: Wed, 20 Sep 2023 11:05:45 -0400 Subject: [PATCH] [YARP] Pop AliasNode when appropriate (#8466) --- yarp/yarp_compiler.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/yarp/yarp_compiler.c b/yarp/yarp_compiler.c index 51c769d30d..b6f453c906 100644 --- a/yarp/yarp_compiler.c +++ b/yarp/yarp_compiler.c @@ -541,10 +541,15 @@ yp_compile_node(rb_iseq_t *iseq, const yp_node_t *node, LINK_ANCHOR *const ret, ADD_INSN1(ret, &dummy_line_node, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE)); ADD_INSN1(ret, &dummy_line_node, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_CBASE)); - YP_COMPILE(alias_node->new_name); - YP_COMPILE(alias_node->old_name); + YP_COMPILE_NOT_POPPED(alias_node->new_name); + YP_COMPILE_NOT_POPPED(alias_node->old_name); ADD_SEND(ret, &dummy_line_node, id_core_set_method_alias, INT2FIX(3)); + + if (popped) { + ADD_INSN(ret, &dummy_line_node, pop); + } + return; } case YP_AND_NODE: {