1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

If removing an empty keyword splat hash, unset the kw_splat flag

Otherwise the last positional hash could be considered as the
keyword arguments.
This commit is contained in:
Jeremy Evans 2019-09-03 14:53:16 -07:00
parent 7fc874bf4c
commit 38dae1d510

View file

@ -2192,6 +2192,7 @@ vm_call_cfunc_with_frame(rb_execution_context_t *ec, rb_control_frame_t *reg_cfp
if (UNLIKELY(calling->kw_splat)) {
if (RHASH_EMPTY_P(*(GET_SP()-1))) {
argc--;
calling->kw_splat = 0;
}
}
if (UNLIKELY(IS_ARGS_KW_OR_KW_SPLAT(ci))) {
@ -2927,6 +2928,7 @@ vm_callee_setup_block_arg(rb_execution_context_t *ec, struct rb_calling_info *ca
if (UNLIKELY(calling->kw_splat)) {
if (RHASH_EMPTY_P(argv[calling->argc-1])) {
calling->argc--;
calling->kw_splat = 0;
}
}