From 7f6a2e4a60ceb7cec9b7a41a1acc151a1db1ceb9 Mon Sep 17 00:00:00 2001 From: nobu Date: Sun, 25 Sep 2016 14:48:22 +0000 Subject: [PATCH] vm_args.c: split make_unused_kw_hash * vm_args.c (make_unknown_kw_hash, make_rest_kw_hash): split make_unused_kw_hash for key_only parameter. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56239 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- vm_args.c | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/vm_args.c b/vm_args.c index 89e25ca49b..5b7c27b4a8 100644 --- a/vm_args.c +++ b/vm_args.c @@ -347,19 +347,28 @@ args_setup_rest_parameter(struct args_info *args, VALUE *locals) } static VALUE -make_unused_kw_hash(const VALUE *passed_keywords, int passed_keyword_len, const VALUE *kw_argv, const int key_only) +make_unknown_kw_hash(const VALUE *passed_keywords, int passed_keyword_len, const VALUE *kw_argv) { int i; - VALUE obj = key_only ? rb_ary_tmp_new(1) : rb_hash_new(); + VALUE obj = rb_ary_tmp_new(1); for (i=0; ibody->param.flags.has_kwrest) { const int rest_hash_index = key_num + 1; - locals[rest_hash_index] = make_unused_kw_hash(passed_keywords, passed_keyword_len, passed_values, FALSE); + locals[rest_hash_index] = make_rest_kw_hash(passed_keywords, passed_keyword_len, passed_values); } else { if (found != passed_keyword_len) { - VALUE keys = make_unused_kw_hash(passed_keywords, passed_keyword_len, passed_values, TRUE); + VALUE keys = make_unknown_kw_hash(passed_keywords, passed_keyword_len, passed_values); argument_kw_error(GET_THREAD(), iseq, "unknown", keys); } }