summaryrefslogtreecommitdiff
path: root/vm_args.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-03-18 14:22:15 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-03-18 14:22:15 +0000
commit49455d6cdcc6430368e1722806f2c3af9cc6eba2 (patch)
treebb89cfc7f7257d2c9413c76663fd132dd8bce2dd /vm_args.c
parentadb3f250fe5a7c50872436c1b6c25627e850f981 (diff)
downloadruby-49455d6cdcc6430368e1722806f2c3af9cc6eba2.tar.gz
vm_args.c: pass block
* vm_args.c (refine_sym_proc_call): pass block to the method when using refinements. [ruby-core:80219] [Bug #13325] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58015 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_args.c')
-rw-r--r--vm_args.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/vm_args.c b/vm_args.c
index 6cded80924..9249984d80 100644
--- a/vm_args.c
+++ b/vm_args.c
@@ -12,6 +12,8 @@ NORETURN(static void raise_argument_error(rb_thread_t *th, const rb_iseq_t *iseq
NORETURN(static void argument_arity_error(rb_thread_t *th, const rb_iseq_t *iseq, const int miss_argc, const int min_argc, const int max_argc));
NORETURN(static void argument_kw_error(rb_thread_t *th, const rb_iseq_t *iseq, const char *error, const VALUE keys));
VALUE rb_keyword_error_new(const char *error, VALUE keys); /* class.c */
+static VALUE method_missing(VALUE obj, ID id, int argc, const VALUE *argv,
+ enum method_missing_reason call_status);
struct args_info {
/* basic args info */
@@ -800,6 +802,7 @@ refine_sym_proc_call(RB_BLOCK_CALL_FUNC_ARGLIST(yielded_arg, callback_arg))
VALUE obj;
ID mid;
const rb_callable_method_entry_t *me;
+ rb_thread_t *th;
if (argc-- < 1) {
rb_raise(rb_eArgError, "no receiver given");
@@ -807,11 +810,14 @@ refine_sym_proc_call(RB_BLOCK_CALL_FUNC_ARGLIST(yielded_arg, callback_arg))
obj = *argv++;
mid = SYM2ID(callback_arg);
me = rb_callable_method_entry_with_refinements(CLASS_OF(obj), mid);
+ th = GET_THREAD();
+ if (!NIL_P(blockarg)) {
+ vm_passed_block_handler_set(th, blockarg);
+ }
if (!me) {
- /* fallback to funcall (e.g. method_missing) */
- return rb_funcall_with_block(obj, mid, argc, argv, blockarg);
+ return method_missing(obj, mid, argc, argv, MISSING_NOENTRY);
}
- return vm_call0(GET_THREAD(), obj, mid, argc, argv, me);
+ return vm_call0(th, obj, mid, argc, argv, me);
}
static void