Skip to content

Commit 2fa3b45

Browse files
committed
Merged common statements [Bug #16242]
1 parent f0a5a07 commit 2fa3b45

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

class.c

+1-7
Original file line numberDiff line numberDiff line change
@@ -825,20 +825,14 @@ VALUE
825825
rb_include_class_new(VALUE module, VALUE super)
826826
{
827827
VALUE klass = class_alloc(T_ICLASS, rb_cClass);
828-
RCLASS_SET_ORIGIN(klass, klass);
829828

830829
RCLASS_M_TBL(OBJ_WB_UNPROTECT(klass)) =
831830
RCLASS_M_TBL(OBJ_WB_UNPROTECT(module)); /* TODO: unprotected? */
832831

832+
RCLASS_SET_ORIGIN(klass, module == RCLASS_ORIGIN(module) ? klass : RCLASS_ORIGIN(module));
833833
if (BUILTIN_TYPE(module) == T_ICLASS) {
834-
if (module != RCLASS_ORIGIN(module)) {
835-
RCLASS_SET_ORIGIN(klass, RCLASS_ORIGIN(module));
836-
}
837834
module = RBASIC(module)->klass;
838835
}
839-
else if (module != RCLASS_ORIGIN(module)) {
840-
RCLASS_SET_ORIGIN(klass, RCLASS_ORIGIN(module));
841-
}
842836
if (!RCLASS_IV_TBL(module)) {
843837
RCLASS_IV_TBL(module) = st_init_numtable();
844838
}

0 commit comments

Comments
 (0)