summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Newton <kddnewton@gmail.com>2024-07-18 13:46:52 -0400
committerKevin Newton <kddnewton@gmail.com>2024-07-18 15:30:45 -0400
commit1fd1fb2aa5daa604464df94735dd234ecb170b7b (patch)
tree08b511c6b4f37f2fe0c61c32749bd6eb3d921e42
parent53710be557105826440fc705415af37856e19db5 (diff)
[PRISM] Use KW_SPLAT_MUT when possible for method calls
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/11200
-rw-r--r--prism_compile.c8
1 files changed, 8 insertions, 0 deletions
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 {