From 4dba8b4027e1f3366c2e04dd7554eb65edbea983 Mon Sep 17 00:00:00 2001 From: Alan Wu Date: Tue, 16 Jun 2020 17:45:45 -0400 Subject: Assert iclass property and remove dead code Iclass objects are never made from other iclass objects. --- class.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'class.c') diff --git a/class.c b/class.c index 78667addae..4dbf5a2f35 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; } -- cgit v1.2.3