diff options
author | Jeremy Evans <[email protected]> | 2019-09-18 12:08:14 -0700 |
---|---|---|
committer | Jeremy Evans <[email protected]> | 2019-09-20 07:45:11 -0700 |
commit | 27b67468724dc48ed8305d8cb33484a4af98fc05 () | |
tree | ed3a664dc2f2a7f729894a3d253171ce19b7f25b /internal.h | |
parent | e81a3e6df54842b5a836dad7055a4295cf4155bc (diff) |
Make passing empty keywords to dig pass empty keywords to next dig method
If defined in Ruby, dig would be defined as def dig(arg, *rest) end, it would not use keywords. If the last dig argument was an empty hash, it could be treated as keyword arguments by the next dig method. Allow dig to pass along the empty keyword flag if called with an empty keyword, to suppress the previous behavior and force treating the hash as a positional argument and not keywords. Also handle the case where dig calls method_missing, passing the empty keyword flag to that as well. This requires adding rb_check_funcall_with_hook_kw functions, so that dig can specify how arguments are treated. It also adds kw_splat arguments to a couple static functions.
-rw-r--r-- | internal.h | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -2301,6 +2301,8 @@ VALUE rb_check_block_call(VALUE, ID, int, const VALUE *, rb_block_call_func_t, V typedef void rb_check_funcall_hook(int, VALUE, ID, int, const VALUE *, VALUE); VALUE rb_check_funcall_with_hook(VALUE recv, ID mid, int argc, const VALUE *argv, rb_check_funcall_hook *hook, VALUE arg); const char *rb_type_str(enum ruby_value_type type); VALUE rb_check_funcall_default(VALUE, ID, int, const VALUE *, VALUE); VALUE rb_yield_1(VALUE val); |