summaryrefslogtreecommitdiff
path: root/class.c
diff options
context:
space:
mode:
authorAlan Wu <XrXr@users.noreply.github.com>2020-06-16 17:45:45 -0400
committerGitHub <noreply@github.com>2020-06-16 17:45:45 -0400
commit4dba8b4027e1f3366c2e04dd7554eb65edbea983 (patch)
treead2e850a0cf506fa5dc9077b12b1b3db776d2531 /class.c
parentb50e74b4f82b649a59002741ce8a9ecbc834515c (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
Diffstat (limited to 'class.c')
-rw-r--r--class.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/class.c b/class.c
index 78667ad..4dbf5a2 100644
--- a/class.c
+++ b/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;
}