summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2019-11-28 21:31:53 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-11-28 21:31:53 +0900
commit2fa3b4565ad904b09419dc77f4fff03aee1a8358 (patch)
treed6a6e16834ff1747f0703106c53e9f5a282b6b8c
parentf0a5a07fa5b98a2e7fcd028cebd7770c6d8916a7 (diff)
Merged common statements [Bug #16242]
-rw-r--r--class.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/class.c b/class.c
index de4bffe..736e227 100644
--- a/class.c
+++ b/class.c
@@ -825,20 +825,14 @@ VALUE
rb_include_class_new(VALUE module, VALUE super)
{
VALUE klass = class_alloc(T_ICLASS, rb_cClass);
- RCLASS_SET_ORIGIN(klass, klass);
RCLASS_M_TBL(OBJ_WB_UNPROTECT(klass)) =
RCLASS_M_TBL(OBJ_WB_UNPROTECT(module)); /* TODO: unprotected? */
+ RCLASS_SET_ORIGIN(klass, module == RCLASS_ORIGIN(module) ? klass : RCLASS_ORIGIN(module));
if (BUILTIN_TYPE(module) == T_ICLASS) {
- if (module != RCLASS_ORIGIN(module)) {
- RCLASS_SET_ORIGIN(klass, RCLASS_ORIGIN(module));
- }
module = RBASIC(module)->klass;
}
- else if (module != RCLASS_ORIGIN(module)) {
- RCLASS_SET_ORIGIN(klass, RCLASS_ORIGIN(module));
- }
if (!RCLASS_IV_TBL(module)) {
RCLASS_IV_TBL(module) = st_init_numtable();
}