aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-11-02 07:52:49 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-11-02 07:52:49 +0000
commitec3a333ec1cdbefc49952d5b38f5210f61dfd605 (patch)
treebaaea6e895f0a410ca55237cf03d0d4099add6c4
parentd7bb24e2dfeaa64ee083c1dc7ae98ca9bfac6f1b (diff)
downloadruby-ec3a333ec1cdbefc49952d5b38f5210f61dfd605.tar.gz
compile.c: kw splat after splat
* compile.c (setup_args): set keyword splat flag after splat arguments. [ruby-core:83638] [Bug #10856] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60613 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--compile.c2
-rw-r--r--test/ruby/test_keyword.rb6
2 files changed, 8 insertions, 0 deletions
diff --git a/compile.c b/compile.c
index c90db528e4..7228defdf0 100644
--- a/compile.c
+++ b/compile.c
@@ -4197,6 +4197,8 @@ setup_args(rb_iseq_t *iseq, LINK_ANCHOR *const args, const NODE *argn,
INSERT_LIST(args_splat, tmp);
nsplat++;
*flag |= VM_CALL_ARGS_SPLAT;
+ if (nd_type(argn->nd_body) == NODE_HASH)
+ *flag |= VM_CALL_KW_SPLAT;
if (next_is_array) {
int len = compile_array(iseq, args, argn->nd_head, COMPILE_ARRAY_TYPE_ARGS, NULL, flag, FALSE);
diff --git a/test/ruby/test_keyword.rb b/test/ruby/test_keyword.rb
index e2bdc34731..f4cc7bc9d6 100644
--- a/test/ruby/test_keyword.rb
+++ b/test/ruby/test_keyword.rb
@@ -513,11 +513,17 @@ class TestKeywordArguments < Test::Unit::TestCase
}
o = {}
assert_equal(:ok, m.f(**o), '[ruby-core:68124] [Bug #10856]')
+ a = []
+ assert_equal(:ok, m.f(*a, **o), '[ruby-core:83638] [Bug #10856]')
o = {a: 42}
assert_equal({a: 42}, m.f2(**o), '[ruby-core:82280] [Bug #13791]')
assert_equal({a: 42}, m.f2("a".to_sym => 42), '[ruby-core:82291] [Bug #13793]')
+
+ o = {}
+ a = [:ok]
+ assert_equal(:ok, m.f2(*a, **o), '[ruby-core:83638] [Bug #10856]')
end
def test_gced_object_in_stack