From 1fd1fb2aa5daa604464df94735dd234ecb170b7b Mon Sep 17 00:00:00 2001 From: Kevin Newton Date: Thu, 18 Jul 2024 13:46:52 -0400 Subject: [PRISM] Use KW_SPLAT_MUT when possible for method calls --- prism_compile.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/prism_compile.c b/prism_compile.c index 799ef636ef..7c9f9ad1f2 100644 --- a/prism_compile.c +++ b/prism_compile.c @@ -1562,6 +1562,14 @@ pm_setup_args_core(const pm_arguments_node_t *arguments_node, const pm_node_t *b if (has_keyword_splat || has_splat) { *flags |= VM_CALL_KW_SPLAT; has_keyword_splat = true; + + if (elements->size > 1) { + // A new hash will be created for the keyword arguments + // in this case, so mark the method as passing mutable + // keyword splat. + *flags |= VM_CALL_KW_SPLAT_MUT; + } + pm_compile_hash_elements(iseq, argument, elements, true, ret, scope_node); } else { -- cgit v1.2.3