From 7fc874bf4cbdd87b3d6fe05dc5959175f3fe94b8 Mon Sep 17 00:00:00 2001 From: Jeremy Evans Date: Tue, 3 Sep 2019 14:49:03 -0700 Subject: Add rb_funcall_with_block_kw This is needed for C functions to call methods with keyword arguments. This is a copy of rb_funcall_with_block with an extra argument for the keyword flag. There isn't a clean way to implement this that doesn't involve changing a lot of function signatures, because rb_call doesn't support a way to mark that the call has keyword arguments. So hack this in using a CALL_PUBLIC_KW call_type, which we switch for CALL_PUBLIC later in the call stack. We do need to modify rm_vm_call0 to take an argument for whether keyword arguments are used, since the call_type is no longer available at that point. Use the passed in value to set the appropriate keyword flag in both calling and ci_entry. --- vm_args.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'vm_args.c') diff --git a/vm_args.c b/vm_args.c index 17eee5e65c..a80100ea3c 100644 --- a/vm_args.c +++ b/vm_args.c @@ -996,7 +996,7 @@ vm_to_proc(VALUE proc) rb_callable_method_entry_with_refinements(CLASS_OF(proc), idTo_proc, NULL); if (me) { - b = rb_vm_call0(GET_EC(), proc, idTo_proc, 0, NULL, me); + b = rb_vm_call0(GET_EC(), proc, idTo_proc, 0, NULL, me, VM_NO_KEYWORDS); } else { /* NOTE: calling method_missing */ @@ -1047,7 +1047,7 @@ refine_sym_proc_call(RB_BLOCK_CALL_FUNC_ARGLIST(yielded_arg, callback_arg)) if (!me) { return method_missing(obj, mid, argc, argv, MISSING_NOENTRY); } - return rb_vm_call0(ec, obj, mid, argc, argv, me); + return rb_vm_call0(ec, obj, mid, argc, argv, me, VM_NO_KEYWORDS); } static VALUE -- cgit v1.2.3