diff options
author | Yusuke Endoh <[email protected]> | 2019-03-18 14:25:47 +0900 |
---|---|---|
committer | Jeremy Evans <[email protected]> | 2019-08-30 12:39:31 -0700 |
commit | 16c6984bb97409029e213154ac4f633ae04af3d8 (patch) | |
tree | 53839e4d596e4016320097530ff5d7fcf19d11e6 /hash.c | |
parent | b0a291f6f6a5834fd84807eb48be906ade429871 (diff) |
Separate keyword arguments from positional arguments
And, allow non-symbol keys as a keyword arugment
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/2395
Diffstat (limited to 'hash.c')
-rw-r--r-- | hash.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -30,6 +30,8 @@ # endif #endif +VALUE rb_no_keyword_hash; + #ifndef HASH_DEBUG #define HASH_DEBUG 0 #endif @@ -3274,6 +3276,8 @@ 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); @@ -6273,6 +6277,10 @@ 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); |