vm_method.c: private

* vm_method.c (basic_obj_respond_to): call even if private.
  [Feature #6539]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38123 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2012-12-01 13:35:32 +00:00
parent 095022cbe9
commit ccebd9b016

View File

@ -1430,12 +1430,15 @@ static inline int
basic_obj_respond_to(VALUE obj, ID id, int pub) basic_obj_respond_to(VALUE obj, ID id, int pub)
{ {
VALUE klass = CLASS_OF(obj); VALUE klass = CLASS_OF(obj);
VALUE args[2];
switch (rb_method_boundp(klass, id, pub|NOEX_RESPONDS)) { switch (rb_method_boundp(klass, id, pub|NOEX_RESPONDS)) {
case 2: case 2:
return FALSE; return FALSE;
case 0: case 0:
return RTEST(rb_funcall(obj, respond_to_missing, 2, ID2SYM(id), pub ? Qfalse : Qtrue)); args[0] = ID2SYM(id);
args[1] = pub ? Qfalse : Qtrue;
return RTEST(rb_funcall2(obj, respond_to_missing, 2, args));
default: default:
return TRUE; return TRUE;
} }