diff options
author | Alan Wu <XrXr@users.noreply.github.com> | 2020-06-16 17:45:45 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-16 17:45:45 -0400 |
commit | 4dba8b4027e1f3366c2e04dd7554eb65edbea983 (patch) | |
tree | ad2e850a0cf506fa5dc9077b12b1b3db776d2531 | |
parent | b50e74b4f82b649a59002741ce8a9ecbc834515c (diff) |
Assert iclass property and remove dead code
Iclass objects are never made from other iclass objects.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/3218
Merged-By: XrXr
-rw-r--r-- | class.c | 8 |
1 files changed, 2 insertions, 6 deletions
@@ -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; } |