summaryrefslogtreecommitdiff
path: root/class.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-04-20 05:55:38 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-04-20 05:55:38 +0000
commit5a1e96b22aa6759bde56ff9667759b44e9f6fa28 (patch)
tree956063703940ef9f3d450768628584dc08f97c42 /class.c
parent4c97b921f2f6d71d7a3f2c0b2c0c089b15686973 (diff)
*** empty log message ***
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@175 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'class.c')
-rw-r--r--class.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/class.c b/class.c
index 40db68beb2..1f8bccc109 100644
--- a/class.c
+++ b/class.c
@@ -217,31 +217,34 @@ rb_include_module(klass, module)
VALUE p;
if (NIL_P(module)) return;
+ if (klass == module) return;
switch (TYPE(module)) {
case T_MODULE:
case T_CLASS:
+ case T_ICLASS:
break;
default:
Check_Type(module, T_MODULE);
}
- if (klass == module) return;
- rb_clear_cache();
-
while (module) {
/* ignore if the module included already in superclasses */
for (p = RCLASS(klass)->super; p; p = RCLASS(p)->super) {
if (BUILTIN_TYPE(p) == T_ICLASS &&
- RCLASS(p)->m_tbl == RCLASS(module)->m_tbl)
+ RCLASS(p)->m_tbl == RCLASS(module)->m_tbl) {
+ if (RCLASS(module)->super) {
+ rb_include_module(p, RCLASS(module)->super);
+ }
return;
+ }
}
-
RCLASS(klass)->super =
include_class_new(module, RCLASS(klass)->super);
klass = RCLASS(klass)->super;
module = RCLASS(module)->super;
}
+ rb_clear_cache();
}
VALUE