From b7d5fa3cbfc0725aece8653985380f6034a454b0 Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 20 Aug 2015 05:13:28 +0000 Subject: vm_eval.c: share with rb_obj_respond_to * vm_eval.c (check_funcall_respond_to): share the behavior with rb_obj_respond_to. [ruby-core:70460] [Bug #11465] * vm_method.c (vm_respond_to): extract from rb_obj_respond_to and merge r39881. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51646 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- vm_eval.c | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) (limited to 'vm_eval.c') diff --git a/vm_eval.c b/vm_eval.c index 25d9f3251c..3d20ceb8a0 100644 --- a/vm_eval.c +++ b/vm_eval.c @@ -378,27 +378,7 @@ check_funcall_failed(struct rescue_funcall_args *args, VALUE e) static int check_funcall_respond_to(rb_thread_t *th, VALUE klass, VALUE recv, ID mid) { - const rb_callable_method_entry_t *me = rb_callable_method_entry(klass, idRespond_to); - - if (me && !METHOD_ENTRY_BASIC(me)) { - const rb_block_t *passed_block = th->passed_block; - VALUE args[2], result; - int arity = rb_method_entry_arity((const rb_method_entry_t *)me); - - if (arity > 2) - rb_raise(rb_eArgError, "respond_to? must accept 1 or 2 arguments (requires %d)", arity); - - if (arity < 1) arity = 2; - - args[0] = ID2SYM(mid); - args[1] = Qtrue; - result = vm_call0(th, recv, idRespond_to, arity, args, me); - th->passed_block = passed_block; - if (!RTEST(result)) { - return FALSE; - } - } - return TRUE; + return vm_respond_to(th, klass, recv, mid, 1); } static int -- cgit v1.2.3