diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-08-20 05:13:28 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-08-20 05:13:28 +0000 |
commit | b7d5fa3cbfc0725aece8653985380f6034a454b0 (patch) | |
tree | b2fe87f9c90528d9506a8dda119954ffa13803bd /vm_eval.c | |
parent | 64e3516b2497c734baf81527885a76239c898ee5 (diff) | |
download | ruby-b7d5fa3cbfc0725aece8653985380f6034a454b0.tar.gz |
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.c | 22 |
1 files changed, 1 insertions, 21 deletions
@@ -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 |