Assert iclass property and remove dead code
Iclass objects are never made from other iclass objects.
This commit is contained in:
parent
b50e74b4f8
commit
4dba8b4027
Notes:
git
2020-06-17 06:46:17 +09:00
Merged: https://github.com/ruby/ruby/pull/3218 Merged-By: XrXr
6
class.c
6
class.c
@ -915,6 +915,7 @@ rb_include_class_new(VALUE module, VALUE super)
|
|||||||
if (BUILTIN_TYPE(module) == T_ICLASS) {
|
if (BUILTIN_TYPE(module) == T_ICLASS) {
|
||||||
module = RBASIC(module)->klass;
|
module = RBASIC(module)->klass;
|
||||||
}
|
}
|
||||||
|
RUBY_ASSERT(!RB_TYPE_P(module, T_ICLASS));
|
||||||
if (!RCLASS_IV_TBL(module)) {
|
if (!RCLASS_IV_TBL(module)) {
|
||||||
RCLASS_IV_TBL(module) = st_init_numtable();
|
RCLASS_IV_TBL(module) = st_init_numtable();
|
||||||
}
|
}
|
||||||
@ -925,12 +926,7 @@ rb_include_class_new(VALUE module, VALUE super)
|
|||||||
RCLASS_CONST_TBL(klass) = RCLASS_CONST_TBL(module);
|
RCLASS_CONST_TBL(klass) = RCLASS_CONST_TBL(module);
|
||||||
|
|
||||||
RCLASS_SET_SUPER(klass, super);
|
RCLASS_SET_SUPER(klass, super);
|
||||||
if (RB_TYPE_P(module, T_ICLASS)) {
|
|
||||||
RBASIC_SET_CLASS(klass, RBASIC(module)->klass);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
RBASIC_SET_CLASS(klass, module);
|
RBASIC_SET_CLASS(klass, module);
|
||||||
}
|
|
||||||
|
|
||||||
return (VALUE)klass;
|
return (VALUE)klass;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user