vm_call_bmethod should not drop the empty keyword hash

Similar to 38e9c1bc35d5549575fbb263afff560e97db068e
This commit is contained in:
Yusuke Endoh 2019-09-05 18:57:19 +09:00 коммит произвёл Jeremy Evans
Родитель 252e299009
Коммит 70f2780892
2 изменённых файлов: 4 добавлений и 2 удалений

Просмотреть файл

@ -733,7 +733,9 @@ class TestKeywordArguments < Test::Unit::TestCase
define_method(:m) {|arg, **opt| [arg, opt] }
end
assert_raise(ArgumentError) { c.m(**{}) }
assert_raise(ArgumentError) { c.m(**kw) }
assert_warn(/The keyword argument is passed as the last hash parameter/m) do
assert_equal([kw, kw], c.m(**kw))
end
assert_warn(/The keyword argument is passed as the last hash parameter/m) do
assert_equal([h, kw], c.m(**h))
end

Просмотреть файл

@ -2279,7 +2279,7 @@ vm_call_bmethod(rb_execution_context_t *ec, rb_control_frame_t *cfp, struct rb_c
VALUE *argv;
int argc;
CALLER_SETUP_ARG(cfp, calling, ci, 1);
CALLER_SETUP_ARG(cfp, calling, ci, 0);
argc = calling->argc;
argv = ALLOCA_N(VALUE, argc);
MEMCPY(argv, cfp->sp - argc, VALUE, argc);