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. --- hash.c | 8 -------- 1 file changed, 8 deletions(-) (limited to 'hash.c') diff --git a/hash.c b/hash.c index 0f1c460c49..b61784af3a 100644 --- a/hash.c +++ b/hash.c @@ -30,8 +30,6 @@ # endif #endif -VALUE rb_no_keyword_hash; - #ifndef HASH_DEBUG #define HASH_DEBUG 0 #endif @@ -3276,8 +3274,6 @@ inspect_hash(VALUE hash, VALUE dummy, int recur) static VALUE rb_hash_inspect(VALUE hash) { - if (hash == rb_no_keyword_hash) - return rb_usascii_str_new2("{(NO KEYWORD)}"); if (RHASH_EMPTY_P(hash)) return rb_usascii_str_new2("{}"); return rb_exec_recursive(inspect_hash, hash, 0); @@ -6277,10 +6273,6 @@ Init_Hash(void) */ rb_define_global_const("ENV", envtbl); - rb_no_keyword_hash = rb_hash_new(); - rb_hash_freeze(rb_no_keyword_hash); - rb_gc_register_mark_object(rb_no_keyword_hash); - /* for callcc */ ruby_register_rollback_func_for_ensure(hash_foreach_ensure, hash_foreach_ensure_rollback); -- cgit v1.2.3