diff options
author | Jeremy Evans <code@jeremyevans.net> | 2019-04-07 11:38:21 -0700 |
---|---|---|
committer | Jeremy Evans <code@jeremyevans.net> | 2019-08-30 12:39:31 -0700 |
commit | 3f67fcd3d5ca5e2907790eb5bb16d03f5884ece8 (patch) | |
tree | 06f1d1940a1972e97b7a492e4ce113a8346b4d0a /vm_args.c | |
parent | 334b41a46b2a1a72965494dcecc6fe73a83f4490 (diff) | |
download | ruby-3f67fcd3d5ca5e2907790eb5bb16d03f5884ece8.tar.gz |
Fix hash to keyword warning to apply in all cases
Previously, it only applied if the call had more positional
arguments than the method it was calling accepted.
Diffstat (limited to 'vm_args.c')
-rw-r--r-- | vm_args.c | 20 |
1 files changed, 9 insertions, 11 deletions
@@ -676,18 +676,16 @@ setup_parameters_complex(rb_execution_context_t * const ec, const rb_iseq_t * co given_argc--; } } - else if (given_argc > max_argc && max_argc >= 0) { - if (args_pop_keyword_hash(args, &keyword_hash)) { - /* Warn the following: - * def foo(k:1) p [k]; end - * foo({k:42}) #=> 42 - */ - if (ec->cfp->iseq) { - /* called from Ruby level */ - rb_warn_last_hash_to_keyword(calling, ci); - } - given_argc--; + else if (args_pop_keyword_hash(args, &keyword_hash)) { + /* Warn the following: + * def foo(k:1) p [k]; end + * foo({k:42}) #=> 42 + */ + if (ec->cfp->iseq) { + /* called from Ruby level */ + rb_warn_last_hash_to_keyword(calling, ci); } + given_argc--; } } |