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

ruby-changes:43351

From: nagachika <ko1@a...>
Date: Thu, 16 Jun 2016 00:40:15 +0900 (JST)
Subject: [ruby-changes:43351] nagachika:r55425 (ruby_2_3): merge revision(s) 55005: [Backport #12382]

nagachika	2016-06-16 00:40:10 +0900 (Thu, 16 Jun 2016)

  New Revision: 55425

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

  Log:
    merge revision(s) 55005: [Backport #12382]
    
    * vm_insnhelper.c (vm_get_ev_const): warn deprecated constant even
      in the class context.  [ruby-core:75505] [Bug #12382]

  Modified directories:
    branches/ruby_2_3/
  Modified files:
    branches/ruby_2_3/ChangeLog
    branches/ruby_2_3/test/ruby/test_module.rb
    branches/ruby_2_3/variable.c
    branches/ruby_2_3/version.h
    branches/ruby_2_3/vm_insnhelper.c
Index: ruby_2_3/variable.c
===================================================================
--- ruby_2_3/variable.c	(revision 55424)
+++ ruby_2_3/variable.c	(revision 55425)
@@ -2209,6 +2209,20 @@ rb_autoload_p(VALUE mod, ID id) https://github.com/ruby/ruby/blob/trunk/ruby_2_3/variable.c#L2209
     return (ele = check_autoload_data(load)) ? ele->feature : Qnil;
 }
 
+void
+rb_const_warn_if_deprecated(const rb_const_entry_t *ce, VALUE klass, ID id)
+{
+    if (RB_CONST_DEPRECATED_P(ce)) {
+	if (klass == rb_cObject) {
+	    rb_warn("constant ::%"PRIsVALUE" is deprecated", QUOTE_ID(id));
+	}
+	else {
+	    rb_warn("constant %"PRIsVALUE"::%"PRIsVALUE" is deprecated",
+		    rb_class_name(klass), QUOTE_ID(id));
+	}
+    }
+}
+
 static VALUE
 rb_const_get_0(VALUE klass, ID id, int exclude, int recurse, int visibility)
 {
@@ -2226,15 +2240,7 @@ rb_const_get_0(VALUE klass, ID id, int e https://github.com/ruby/ruby/blob/trunk/ruby_2_3/variable.c#L2240
 		rb_name_err_raise("private constant %2$s::%1$s referenced",
 				  klass, ID2SYM(id));
 	    }
-	    if (RB_CONST_DEPRECATED_P(ce)) {
-		if (klass == rb_cObject) {
-		    rb_warn("constant ::%"PRIsVALUE" is deprecated", QUOTE_ID(id));
-		}
-		else {
-		    rb_warn("constant %"PRIsVALUE"::%"PRIsVALUE" is deprecated",
-			    rb_class_name(klass), QUOTE_ID(id));
-		}
-	    }
+	    rb_const_warn_if_deprecated(ce, klass, id);
 	    value = ce->value;
 	    if (value == Qundef) {
 		if (am == tmp) break;
Index: ruby_2_3/version.h
===================================================================
--- ruby_2_3/version.h	(revision 55424)
+++ ruby_2_3/version.h	(revision 55425)
@@ -1,10 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/version.h#L1
 #define RUBY_VERSION "2.3.2"
-#define RUBY_RELEASE_DATE "2016-06-14"
-#define RUBY_PATCHLEVEL 130
+#define RUBY_RELEASE_DATE "2016-06-16"
+#define RUBY_PATCHLEVEL 131
 
 #define RUBY_RELEASE_YEAR 2016
 #define RUBY_RELEASE_MONTH 6
-#define RUBY_RELEASE_DAY 14
+#define RUBY_RELEASE_DAY 16
 
 #include "ruby/version.h"
 
Index: ruby_2_3/test/ruby/test_module.rb
===================================================================
--- ruby_2_3/test/ruby/test_module.rb	(revision 55424)
+++ ruby_2_3/test/ruby/test_module.rb	(revision 55425)
@@ -1419,6 +1419,8 @@ class TestModule < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_3/test/ruby/test_module.rb#L1419
     c.const_set(:FOO, "foo")
     c.deprecate_constant(:FOO)
     assert_warn(/deprecated/) {c::FOO}
+    bug12382 = '[ruby-core:75505] [Bug #12382]'
+    assert_warn(/deprecated/, bug12382) {c.class_eval "FOO"}
   end
 
   def test_constants_with_private_constant
Index: ruby_2_3/vm_insnhelper.c
===================================================================
--- ruby_2_3/vm_insnhelper.c	(revision 55424)
+++ ruby_2_3/vm_insnhelper.c	(revision 55425)
@@ -660,6 +660,7 @@ vm_get_iclass(rb_control_frame_t *cfp, V https://github.com/ruby/ruby/blob/trunk/ruby_2_3/vm_insnhelper.c#L660
 static inline VALUE
 vm_get_ev_const(rb_thread_t *th, VALUE orig_klass, ID id, int is_defined)
 {
+    void rb_const_warn_if_deprecated(const rb_const_entry_t *ce, VALUE klass, ID id);
     VALUE val;
 
     if (orig_klass == Qnil) {
@@ -686,6 +687,7 @@ vm_get_ev_const(rb_thread_t *th, VALUE o https://github.com/ruby/ruby/blob/trunk/ruby_2_3/vm_insnhelper.c#L687
 		rb_const_entry_t *ce;
 	      search_continue:
 		if ((ce = rb_const_lookup(klass, id))) {
+		    rb_const_warn_if_deprecated(ce, klass, id);
 		    val = ce->value;
 		    if (val == Qundef) {
 			if (am == klass) break;
Index: ruby_2_3/ChangeLog
===================================================================
--- ruby_2_3/ChangeLog	(revision 55424)
+++ ruby_2_3/ChangeLog	(revision 55425)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ChangeLog#L1
+Thu Jun 16 00:29:29 2016  Nobuyoshi Nakada  <nobu@r...>
+
+	* vm_insnhelper.c (vm_get_ev_const): warn deprecated constant even
+	  in the class context.  [ruby-core:75505] [Bug #12382]
+
 Tue Jun 14 03:49:28 2016  Eric Wong  <e@8...>
 
 	* dir.c (dir_close): update RDoc for 2.3 #close change

Property changes on: ruby_2_3
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r55005


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

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