From 0ffe9b987ac0bec07d1027d8a9500bed0a3d9d65 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Sat, 27 May 2023 16:40:21 +0900 Subject: [PATCH] class.c (mrb_prepend_module): `c` should not be `MRB_TT_ICLASS` --- src/class.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/class.c b/src/class.c index 46ce0c547..2cded3256 100644 --- a/src/class.c +++ b/src/class.c @@ -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;