From: Trans Date: 2007-07-29T19:54:58+09:00 Subject: Re: Quarks On Jul 28, 2:17 pm, Nobuyoshi Nakada wrote: > Hi, > > At Sun, 29 Jul 2007 01:21:46 +0900, > Trans wrote in [ruby-talk:262287]: > > > Why? > > Maybe a bug. > > Index: class.c > =================================================================== > --- class.c (revision 12852) > +++ class.c (working copy) > @@ -600,9 +600,18 @@ class_instance_method_list(int argc, VAL > > list = st_init_numtable(); > - for (; mod; mod = RCLASS(mod)->super) { > + if (mod) { > st_foreach(RCLASS(mod)->m_tbl, method_entry, (st_data_t)list); > - if (BUILTIN_TYPE(mod) == T_ICLASS) continue; > - if (FL_TEST(mod, FL_SINGLETON)) continue; > - if (!recur) break; > + if (recur) { > + while ((mod = RCLASS(mod)->super) != 0) { > + st_foreach(RCLASS(mod)->m_tbl, method_entry, (st_data_t)list); > + } > + } > +#define HIDDEN_CLASS_P(mod) ((BUILTIN_TYPE(mod) == T_ICLASS) || \ > + (FL_TEST(mod, FL_SINGLETON))) > + else if (HIDDEN_CLASS_P(mod)) { > + while ((mod = RCLASS(mod)->super) != 0 && HIDDEN_CLASS_P(mod)) { > + st_foreach(RCLASS(mod)->m_tbl, method_entry, (st_data_t)list); > + } > + } > } > ary = rb_ary_new(); Thanks Nobu. Though that code seems kind of odd too. Does 'recur' refer to the ancestors flag? If so, how does the HIDDEN_CLASS_P (he he, another name for singleton) exclude the ancestors? T.