ruby-changes:57602
From: Yusuke <ko1@a...>
Date: Fri, 6 Sep 2019 15:15:13 +0900 (JST)
Subject: [ruby-changes:57602] 252e299009 (master): vm_call_opt_send should not drop the empty keyword hash
https://git.ruby-lang.org/ruby.git/commit/?id=252e299009 From 252e2990099557a54577ad8915b689761117cd7a Mon Sep 17 00:00:00 2001 From: Yusuke Endoh <mame@r...> Date: Thu, 5 Sep 2019 18:54:26 +0900 Subject: vm_call_opt_send should not drop the empty keyword hash Now the mechanism that conveys kw_splat flag is gradually established, so the hack to drop the empty keyword hash is not needed for vm_call_opt_send. diff --git a/test/ruby/test_keyword.rb b/test/ruby/test_keyword.rb index 974a14f..3c486a4 100644 --- a/test/ruby/test_keyword.rb +++ b/test/ruby/test_keyword.rb @@ -465,7 +465,9 @@ class TestKeywordArguments < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_keyword.rb#L465 [arg, args] end assert_raise(ArgumentError) { c.send(:m, **{}) } - assert_raise(ArgumentError) { c.send(:m, **kw) } + assert_warn(/The keyword argument is passed as the last hash parameter.* for `m'/m) do + assert_equal([kw, kw], c.send(:m, **kw)) + end assert_warn(/The keyword argument is passed as the last hash parameter.* for `m'/m) do assert_equal([h, kw], c.send(:m, **h)) end @@ -640,7 +642,6 @@ class TestKeywordArguments < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_keyword.rb#L642 [arg, args] end assert_raise(ArgumentError) { c.m(**{}) } - assert_raise(ArgumentError) { c.send(:m, **kw) } # XXX: fix it after the commit assert_warn(/The keyword argument is passed as the last hash parameter.* for `method_missing'/m) do assert_equal([kw, kw], c.m(**kw)) end diff --git a/vm_insnhelper.c b/vm_insnhelper.c index 8b8fb94..70fbb49 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -2309,7 +2309,7 @@ vm_call_opt_send(rb_execution_context_t *ec, rb_control_frame_t *reg_cfp, struct https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L2309 struct rb_call_info_with_kwarg ci_entry; struct rb_call_cache cc_entry, *cc; - CALLER_SETUP_ARG(reg_cfp, calling, orig_ci, 1); + CALLER_SETUP_ARG(reg_cfp, calling, orig_ci, 0); i = calling->argc - 1; -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/