From 334b41a46b2a1a72965494dcecc6fe73a83f4490 Mon Sep 17 00:00:00 2001 From: Jeremy Evans Date: Mon, 1 Apr 2019 12:15:01 -0700 Subject: Allow ** syntax to be used for calling methods that do not accept keywords Treat the ** syntax as passing a copy of the hash as the last positional argument. If the hash being double splatted is empty, do not add a positional argument. Remove rb_no_keyword_hash, no longer needed. --- vm.c | 5 ----- 1 file changed, 5 deletions(-) (limited to 'vm.c') diff --git a/vm.c b/vm.c index c727554483..cbd7b31f3e 100644 --- a/vm.c +++ b/vm.c @@ -2779,9 +2779,6 @@ static VALUE core_hash_merge_kwd(VALUE hash, VALUE kw); static VALUE core_hash_merge(VALUE hash, long argc, const VALUE *argv) { - if (hash == rb_no_keyword_hash) { - hash = rb_hash_new(); - } Check_Type(hash, T_HASH); VM_ASSERT(argc % 2 == 0); rb_hash_bulk_insert(argc, argv, hash); @@ -2815,8 +2812,6 @@ m_core_hash_merge_kwd(VALUE recv, VALUE hash, VALUE kw) static VALUE core_hash_merge_kwd(VALUE hash, VALUE kw) { - if (RHASH_EMPTY_P(hash) && kw == rb_no_keyword_hash) - return rb_no_keyword_hash; rb_hash_foreach(rb_to_hash_type(kw), kwmerge_i, hash); return hash; } -- cgit v1.2.3