summaryrefslogtreecommitdiff
path: root/prism_compile.c
diff options
context:
space:
mode:
authorLuke Gruber <[email protected]>2024-09-07 12:17:08 -0400
committerKevin Newton <[email protected]>2024-09-11 16:41:46 -0400
commit5d358b660d41e64de301f428dc0300a52a6f9566 ()
tree69e684e87941e0001e1446664b2a7e53af49fd25 /prism_compile.c
parentd4d6f1de83628b12e4a27d273edace7762f69860 (diff)
Fix issue with super and forwarding arguments in prism_compile.c
Fixes [Bug #20720]
Notes: Merged: https://.com/ruby/ruby/pull/11565
-rw-r--r--prism_compile.c10
1 files changed, 6 insertions, 4 deletions
@@ -1708,7 +1708,7 @@ pm_setup_args_core(const pm_arguments_node_t *arguments_node, const pm_node_t *b
break;
}
- case PM_FORWARDING_ARGUMENTS_NODE: {
if (ISEQ_BODY(ISEQ_BODY(iseq)->local_iseq)->param.flags.forwardable) {
*flags |= VM_CALL_FORWARDING;
@@ -9628,9 +9628,10 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret,
}
return;
}
- case PM_SUPER_NODE: {
// super(foo)
- // ^^^^^^^^^^
const pm_super_node_t *cast = (const pm_super_node_t *) node;
DECL_ANCHOR(args);
@@ -9649,6 +9650,7 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret,
int flags = 0;
struct rb_callinfo_kwarg *keywords = NULL;
int argc = pm_setup_args(cast->arguments, cast->block, &flags, &keywords, iseq, ret, scope_node, &location);
flags |= VM_CALL_SUPER | VM_CALL_FCALL;
if (cast->block && PM_NODE_TYPE_P(cast->block, PM_BLOCK_NODE)) {
@@ -9668,7 +9670,7 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret,
}
PUSH_SEQ(ret, args);
- if (ISEQ_BODY(ISEQ_BODY(iseq)->local_iseq)->param.flags.forwardable) {
flags |= VM_CALL_FORWARDING;
PUSH_INSN2(ret, location, invokesuperforward, new_callinfo(iseq, 0, argc, flags, keywords, current_block != NULL), current_block);
}