class.c (mrb_prepend_module): c should not be MRB_TT_ICLASS

This commit is contained in:
Yukihiro "Matz" Matsumoto
2023-05-27 16:40:21 +09:00
parent 6ac10a01e4
commit 0ffe9b987a
+1 -9
View File
@@ -1519,15 +1519,7 @@ mrb_prepend_module(mrb_state *mrb, struct RClass *c, struct RClass *m)
mrb_check_frozen(mrb, c);
if (!(c->flags & MRB_FL_CLASS_IS_PREPENDED)) {
struct RClass *c0;
if (c->tt == MRB_TT_ICLASS) {
c0 = c->c;
}
else {
c0 = c;
}
origin = MRB_OBJ_ALLOC(mrb, MRB_TT_ICLASS, c0);
origin = MRB_OBJ_ALLOC(mrb, MRB_TT_ICLASS, c);
origin->flags |= MRB_FL_CLASS_IS_ORIGIN | MRB_FL_CLASS_IS_INHERITED;
origin->super = c->super;
c->super = origin;