1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Assert iclass property and remove dead code

Iclass objects are never made from other iclass objects.
This commit is contained in:
Alan Wu 2020-06-16 17:45:45 -04:00 committed by GitHub
parent b50e74b4f8
commit 4dba8b4027
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
Notes: git 2020-06-17 06:46:17 +09:00
Merged: https://github.com/ruby/ruby/pull/3218

Merged-By: XrXr

View file

@ -915,6 +915,7 @@ rb_include_class_new(VALUE module, VALUE super)
if (BUILTIN_TYPE(module) == T_ICLASS) {
module = RBASIC(module)->klass;
}
RUBY_ASSERT(!RB_TYPE_P(module, T_ICLASS));
if (!RCLASS_IV_TBL(module)) {
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_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;
}