summaryrefslogtreecommitdiff
path: root/vm_eval.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-08-20 05:13:28 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-08-20 05:13:28 +0000
commit629d26ef3a41cf585f92ac6d0d8b0a17a47c3daa (patch)
treeb2fe87f9c90528d9506a8dda119954ffa13803bd /vm_eval.c
parent24da2db3e1eab67b6ee7be00d75b73beb273a4c4 (diff)
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
Diffstat (limited to 'vm_eval.c')
-rw-r--r--vm_eval.c22
1 files changed, 1 insertions, 21 deletions
diff --git a/vm_eval.c b/vm_eval.c
index 25d9f32..3d20ceb 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