1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Split visibility cases

This commit is contained in:
Nobuyoshi Nakada 2020-06-03 08:40:11 +09:00
parent 52ef2477e4
commit 1351374bd1
No known key found for this signature in database
GPG key ID: 7CD2805BFA3770C6

View file

@ -1304,10 +1304,15 @@ rb_method_boundp(VALUE klass, ID id, int ex)
}
if (me != NULL) {
if ((ex & ~BOUND_RESPONDS) &&
((METHOD_ENTRY_VISI(me) == METHOD_VISI_PRIVATE) ||
((ex & BOUND_RESPONDS) && (METHOD_ENTRY_VISI(me) == METHOD_VISI_PROTECTED)))) {
if (ex & ~BOUND_RESPONDS) {
switch (METHOD_ENTRY_VISI(me)) {
case METHOD_VISI_PRIVATE:
return 0;
case METHOD_VISI_PROTECTED:
if (ex & BOUND_RESPONDS) return 0;
default:
break;
}
}
if (me->def->type == VM_METHOD_TYPE_NOTIMPLEMENTED) {