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

ruby-changes:45783

From: naruse <ko1@a...>
Date: Sun, 12 Mar 2017 01:44:44 +0900 (JST)
Subject: [ruby-changes:45783] naruse:r57856 (ruby_2_4): merge revision(s) 57305: [Backport #13114] [Backport #13120]

naruse	2017-03-12 01:44:40 +0900 (Sun, 12 Mar 2017)

  New Revision: 57856

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

  Log:
    merge revision(s) 57305: [Backport #13114] [Backport #13120]
    
    variable.c: fix the condition to cache
    
    * variable.c (rb_const_set): fix the condition to cache the class
      path and cache permanent or temporary path corresponding to the
      outer klass.  [ruby-core:79039] [Bug #13120]

  Modified directories:
    branches/ruby_2_4/
  Modified files:
    branches/ruby_2_4/variable.c
    branches/ruby_2_4/version.h
Index: ruby_2_4/version.h
===================================================================
--- ruby_2_4/version.h	(revision 57855)
+++ ruby_2_4/version.h	(revision 57856)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_4/version.h#L1
 #define RUBY_VERSION "2.4.0"
 #define RUBY_RELEASE_DATE "2017-03-12"
-#define RUBY_PATCHLEVEL 21
+#define RUBY_PATCHLEVEL 22
 
 #define RUBY_RELEASE_YEAR 2017
 #define RUBY_RELEASE_MONTH 3
Index: ruby_2_4/variable.c
===================================================================
--- ruby_2_4/variable.c	(revision 57855)
+++ ruby_2_4/variable.c	(revision 57856)
@@ -2608,10 +2608,25 @@ rb_const_set(VALUE klass, ID id, VALUE v https://github.com/ruby/ruby/blob/trunk/ruby_2_4/variable.c#L2608
      * and avoid order-dependency on const_tbl
      */
     if (rb_cObject && (RB_TYPE_P(val, T_MODULE) || RB_TYPE_P(val, T_CLASS))) {
-	if (!NIL_P(rb_class_path_cached(val))) {
-	    rb_name_class(val, id);
-	    if (rb_class_path_cached(klass)) {
-		rb_class_name(val);
+	if (NIL_P(rb_class_path_cached(val))) {
+	    if (klass == rb_cObject) {
+		rb_ivar_set(val, classpath, rb_id2str(id));
+		rb_name_class(val, id);
+	    }
+	    else {
+		VALUE path;
+		ID pathid;
+		st_data_t n;
+		st_table *ivtbl = RCLASS_IV_TBL(klass);
+		if (ivtbl &&
+		    (st_lookup(ivtbl, (st_data_t)(pathid = classpath), &n) ||
+		     st_lookup(ivtbl, (st_data_t)(pathid = tmp_classpath), &n))) {
+		    path = rb_str_dup((VALUE)n);
+		    rb_str_append(rb_str_cat2(path, "::"), rb_id2str(id));
+		    OBJ_FREEZE(path);
+		    rb_ivar_set(val, pathid, path);
+		    rb_name_class(val, id);
+		}
 	    }
 	}
     }

Property changes on: ruby_2_4
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r57305


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

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