diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-02-05 07:25:27 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-02-05 07:25:27 +0000 |
commit | a106b310e5bbe678022b127b9d32bb0a55708002 (patch) | |
tree | b82f29537e864bd9d30fd61662ca90c45cdf85c2 /vm_method.c | |
parent | 8efeb603fee5ad417d1fad69be41228458a78b75 (diff) | |
download | ruby-a106b310e5bbe678022b127b9d32bb0a55708002.tar.gz |
vm_method.c: drop include_all flag
* vm_method.c (rb_obj_respond_to): drop optional include_all flag if
respond_to? method is defined in old style. [Bug #7722]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39069 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_method.c')
-rw-r--r-- | vm_method.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/vm_method.c b/vm_method.c index 2adc91d737..f2c361f521 100644 --- a/vm_method.c +++ b/vm_method.c @@ -1521,7 +1521,24 @@ rb_obj_respond_to(VALUE obj, ID id, int priv) return basic_obj_respond_to(obj, id, !RTEST(priv)); } else { - return RTEST(rb_funcall(obj, idRespond_to, priv ? 2 : 1, ID2SYM(id), Qtrue)); + int argc = 1; + VALUE args[2]; + args[0] = ID2SYM(id); + args[1] = Qtrue; + if (priv) { + if (rb_obj_method_arity(obj, idRespond_to) != 1) { + argc = 2; + } + else { + VALUE klass = CLASS_OF(obj); + rb_warn("%"PRIsVALUE"%c""respond_to?(:%"PRIsVALUE") is" + " old fashion which takes only one parameter", + (FL_TEST(klass, FL_SINGLETON) ? obj : klass), + (FL_TEST(klass, FL_SINGLETON) ? '.' : '#'), + QUOTE_ID(id)); + } + } + return RTEST(rb_funcall2(obj, idRespond_to, argc, args)); } } |