ruby-changes:61741
From: Alan <ko1@a...>
Date: Wed, 17 Jun 2020 06:46:12 +0900 (JST)
Subject: [ruby-changes:61741] 4dba8b4027 (master): Assert iclass property and remove dead code
https://git.ruby-lang.org/ruby.git/commit/?id=4dba8b4027 From 4dba8b4027e1f3366c2e04dd7554eb65edbea983 Mon Sep 17 00:00:00 2001 From: Alan Wu <XrXr@u...> 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. 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) https://github.com/ruby/ruby/blob/trunk/class.c#L915 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) https://github.com/ruby/ruby/blob/trunk/class.c#L926 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 v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/