[前][次][番号順一覧][スレッド一覧]

ruby-changes:45211

From: nobu <ko1@a...>
Date: Sun, 8 Jan 2017 11:00:00 +0900 (JST)
Subject: [ruby-changes:45211] nobu:r57284 (trunk): variable.c: resolve permanent name only

nobu	2017-01-08 10:59:54 +0900 (Sun, 08 Jan 2017)

  New Revision: 57284

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=57284

  Log:
    variable.c: resolve permanent name only
    
    * variable.c (rb_const_set): resolve and cache class name
      immediately only if the outer class/module has the name,
      otherwise just set the ID.  [ruby-core:79007] [Bug #13113]

  Modified files:
    trunk/variable.c
Index: variable.c
===================================================================
--- variable.c	(revision 57283)
+++ variable.c	(revision 57284)
@@ -2612,7 +2612,12 @@ rb_const_set(VALUE klass, ID id, VALUE v https://github.com/ruby/ruby/blob/trunk/variable.c#L2612
      * and avoid order-dependency on const_tbl
      */
     if (rb_cObject && (RB_TYPE_P(val, T_MODULE) || RB_TYPE_P(val, T_CLASS))) {
-	rb_class_name(val);
+	if (!NIL_P(rb_class_path_cached(val))) {
+	    rb_name_class(val, id);
+	    if (rb_class_path_cached(klass)) {
+		rb_class_name(val);
+	    }
+	}
     }
 }
 
@@ -2660,7 +2665,8 @@ const_tbl_update(struct autoload_const_s https://github.com/ruby/ruby/blob/trunk/variable.c#L2665
 	}
 	rb_clear_constant_cache();
 	setup_const_entry(ce, klass, val, visibility);
-    } else {
+    }
+    else {
 	rb_clear_constant_cache();
 
 	ce = ZALLOC(rb_const_entry_t);

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]