diff options
author | Jeremy Evans <code@jeremyevans.net> | 2019-09-29 22:49:43 -0700 |
---|---|---|
committer | Jeremy Evans <code@jeremyevans.net> | 2019-09-30 07:06:42 -0700 |
commit | a8c436d9a1d333e9391c78d4ffd32568a56534a6 (patch) | |
tree | 9d4f2862e435cfa8f6b2d327170208964201fe4f | |
parent | 3073404e741df19ae16248126640777ed36110e8 (diff) |
Issue keyword flag warning even with no arguments
If the keyword flag is set, there should be at least one argument,
if there isn't, that is a sign the keyword flag was passed when it
should not have been.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/2509
-rw-r--r-- | vm_eval.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -256,7 +256,7 @@ rb_adjust_argv_kw_splat(int *argc, const VALUE **argv, int *kw_splat) } } - if (*kw_splat && *argc > 0 && !RB_TYPE_P((*argv)[(*argc)-1], T_HASH)) { + if (*kw_splat && (*argc == 0 || !RB_TYPE_P((*argv)[(*argc)-1], T_HASH))) { rb_warn("Keyword flag passed calling internal method, but last entry is not a hash, unsetting keyword flag"); *kw_splat = 0; } |