* object.c (rb_class_inherited_p): singleton class inherits Class

rather than its object's class.  [ruby-dev:23690]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6462 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2004-06-16 07:04:05 +00:00
parent 83c917df38
commit 6a5e63a715
2 changed files with 10 additions and 0 deletions

View File

@ -1,3 +1,8 @@
Wed Jun 16 16:03:59 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
* object.c (rb_class_inherited_p): singleton class inherits Class
rather than its object's class. [ruby-dev:23690]
Wed Jun 16 16:01:17 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
* gc.c (stack_grow_direction): memoize the direction.

View File

@ -1257,6 +1257,11 @@ rb_class_inherited_p(mod, arg)
rb_raise(rb_eTypeError, "compared with non class/module");
}
if (FL_TEST(mod, FL_SINGLETON)) {
if (RCLASS(mod)->m_tbl == RCLASS(arg)->m_tbl)
return Qtrue;
mod = RBASIC(mod)->klass;
}
while (mod) {
if (RCLASS(mod)->m_tbl == RCLASS(arg)->m_tbl)
return Qtrue;