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:
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
1 changed files with 2 additions and 6 deletions
8
class.c
8
class.c
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue