summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYusuke Endoh <mame@ruby-lang.org>2019-09-05 18:54:26 +0900
committerJeremy Evans <code@jeremyevans.net>2019-09-05 17:47:12 -0700
commit252e2990099557a54577ad8915b689761117cd7a (patch)
treeb6b8769fe8f038e4da29b24da760c842444536bb
parent4615886c76c0e906a349440ac7e232ad0ba5ce30 (diff)
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.
-rw-r--r--test/ruby/test_keyword.rb5
-rw-r--r--vm_insnhelper.c2
2 files changed, 4 insertions, 3 deletions
diff --git a/test/ruby/test_keyword.rb b/test/ruby/test_keyword.rb
index 974a14fbcf..3c486a4e15 100644
--- a/test/ruby/test_keyword.rb
+++ b/test/ruby/test_keyword.rb
@@ -465,7 +465,9 @@ class TestKeywordArguments < Test::Unit::TestCase
[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
[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 8b8fb9467f..70fbb491e6 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
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;