diff options
author | Jemma Issroff <jemmaissroff@gmail.com> | 2023-11-29 14:58:26 -0500 |
---|---|---|
committer | Jemma Issroff <jemmaissroff@gmail.com> | 2023-11-29 16:19:14 -0500 |
commit | 853fd44745241398d182d2af3ebdea10640ebf2e (patch) | |
tree | 803ec29c351b0b740fc995a2538a5119d988bd9f /prism_compile.c | |
parent | 2233204cc17521b960dad8b3758e6e0631a13672 (diff) | |
download | ruby-853fd44745241398d182d2af3ebdea10640ebf2e.tar.gz |
[PRISM] Implement CallNodes with splat followed by args
Diffstat (limited to 'prism_compile.c')
-rw-r--r-- | prism_compile.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/prism_compile.c b/prism_compile.c index ca416547bb..79d5267667 100644 --- a/prism_compile.c +++ b/prism_compile.c @@ -1022,8 +1022,16 @@ pm_setup_args(pm_arguments_node_t *arguments_node, int *flags, struct rb_callinf } // If it's the final node else if (index == arguments_node_list.size - 1) { - ADD_INSN1(ret, &dummy_line_node, newarray, INT2FIX(post_splat_counter)); - ADD_INSN(ret, &dummy_line_node, concatarray); + if (post_splat_counter > 1) { + ADD_INSN1(ret, &dummy_line_node, newarray, INT2FIX(post_splat_counter)); + ADD_INSN1(ret, &dummy_line_node, splatarray, Qfalse); + ADD_INSN(ret, &dummy_line_node, concatarray); + } + else { + ADD_INSN1(ret, &dummy_line_node, newarray, INT2FIX(post_splat_counter)); + ADD_INSN(ret, &dummy_line_node, concatarray); + } + orig_argc = 1; } } } |