[前][次][番号順一覧][スレッド一覧]

ruby-changes:57578

From: Jeremy <ko1@a...>
Date: Fri, 6 Sep 2019 09:51:01 +0900 (JST)
Subject: [ruby-changes:57578] 38dae1d510 (master): If removing an empty keyword splat hash, unset the kw_splat flag

https://git.ruby-lang.org/ruby.git/commit/?id=38dae1d510

From 38dae1d510b931516ba1229a1ffbe5f6e470e292 Mon Sep 17 00:00:00 2001
From: Jeremy Evans <code@j...>
Date: Tue, 3 Sep 2019 14:53:16 -0700
Subject: If removing an empty keyword splat hash, unset the kw_splat flag

Otherwise the last positional hash could be considered as the
keyword arguments.

diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index de5a192..7895c8a 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -2192,6 +2192,7 @@ vm_call_cfunc_with_frame(rb_execution_context_t *ec, rb_control_frame_t *reg_cfp https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L2192
     if (UNLIKELY(calling->kw_splat)) {
         if (RHASH_EMPTY_P(*(GET_SP()-1))) {
             argc--;
+            calling->kw_splat = 0;
         }
     }
     if (UNLIKELY(IS_ARGS_KW_OR_KW_SPLAT(ci))) {
@@ -2927,6 +2928,7 @@ vm_callee_setup_block_arg(rb_execution_context_t *ec, struct rb_calling_info *ca https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L2928
         if (UNLIKELY(calling->kw_splat)) {
             if (RHASH_EMPTY_P(argv[calling->argc-1])) {
                 calling->argc--;
+                calling->kw_splat = 0;
             }
         }
 
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]