summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2019-09-29 22:49:43 -0700
committerJeremy Evans <code@jeremyevans.net>2019-09-30 07:06:42 -0700
commita8c436d9a1d333e9391c78d4ffd32568a56534a6 (patch)
tree9d4f2862e435cfa8f6b2d327170208964201fe4f
parent3073404e741df19ae16248126640777ed36110e8 (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.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/vm_eval.c b/vm_eval.c
index c741773657..1c205f0a30 100644
--- a/vm_eval.c
+++ b/vm_eval.c
@@ -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;
}