e$B1sF#$G$9!#e(B
e$B7Q>5@h$N%/%i%9$Ge(B public e$B$K$7$?%a%=%C%I$re(B public_method
e$B$G<h$j=P$7$Fe(B
e$B8F$S=P$9$He(B undefined private method e$B$H8@$o$l$F$7$^$$$^$9!#e(B
class C
def foo; “FOO”; end
private :foo
end
class D < C
public :foo
end
p D.new.public_method(:foo).call
#=> undefined private method foo' for class
D’ (NameError)
e$B$3$l$O8F$S=P$;$k$N$,@52r$H$$$&$3$H$G$$$$$G$7$g$&$+!#e(B
Index: proc.c
— proc.c (revision 25895)
+++ proc.c (working copy)
@@ -894,6 +894,7 @@
struct METHOD *data;
rb_method_entry_t *me, meb;
rb_method_definition_t *def = 0;
- rb_method_flag_t flag = NOEX_UNDEF;
again:
me = rb_method_entry(klass, id);
@@ -921,8 +922,11 @@
rb_print_undef(klass, id, 0);
}
def = me->def;
- if (scope && (me->flag & NOEX_MASK) != NOEX_PUBLIC) {
- rb_print_undef(rclass, def->original_id, (int)(me->flag &
NOEX_MASK));
- if (flag == NOEX_UNDEF) {
- flag = me->flag;
- if (scope && (flag & NOEX_MASK) != NOEX_PUBLIC) {
-
rb_print_undef(rclass, def->original_id, (int)(flag &
NOEX_MASK));
- }
}
if (def && def->type == VM_METHOD_TYPE_ZSUPER) {
klass = RCLASS_SUPER(me->klass);