summaryrefslogtreecommitdiff
path: root/vm_method.c
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-07-07 04:06:32 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-07-07 04:06:32 +0000
commit42f4a548f0e8ad0fa22a4132b164c7ab76e3bf45 (patch)
tree75f76f6c035454a93744937d9fe42530b3897e97 /vm_method.c
parent2520f3f79c0b65894cea4914c041f06b8d29b41a (diff)
* vm_method.c (rb_method_boundp): respond_to?(:protected_method,
true) should return true. Pointed out by Marc-Andre Lafortune. [ruby-dev:41837] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28564 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_method.c')
-rw-r--r--vm_method.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/vm_method.c b/vm_method.c
index becce27c1c..aa5db73643 100644
--- a/vm_method.c
+++ b/vm_method.c
@@ -565,19 +565,19 @@ rb_method_boundp(VALUE klass, ID id, int ex)
{
rb_method_entry_t *me = rb_method_entry(klass, id);
- if (me != 0) {
- if ((ex & NOEX_RESPONDS) && (me->flag & NOEX_PROTECTED) ||
- (ex & ~NOEX_RESPONDS) && (me->flag & NOEX_PRIVATE)) {
- return 0;
- }
- if (!me->def) return 0;
- if (me->def->type == VM_METHOD_TYPE_NOTIMPLEMENTED) {
- if (ex & NOEX_RESPONDS) return 2;
- return 0;
+ if (!me) return 0;
+ if (ex & ~NOEX_RESPONDS) { /* pub */
+ if (me->flag & NOEX_PRIVATE) return 0;
+ if (ex & NOEX_RESPONDS) {
+ if (me->flag & NOEX_PROTECTED) return 0;
}
- return 1;
}
- return 0;
+ if (!me->def) return 0;
+ if (me->def->type == VM_METHOD_TYPE_NOTIMPLEMENTED) {
+ if (ex & NOEX_RESPONDS) return 2;
+ return 0;
+ }
+ return 1;
}
void