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

ruby-changes:28863

From: charliesome <ko1@a...>
Date: Fri, 24 May 2013 19:33:15 +0900 (JST)
Subject: [ruby-changes:28863] charliesome:r40915 (trunk): * variable.c (set_const_visibility): use rb_frame_this_func() instead

charliesome	2013-05-24 19:33:05 +0900 (Fri, 24 May 2013)

  New Revision: 40915

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=40915

  Log:
    * variable.c (set_const_visibility): use rb_frame_this_func() instead
      of rb_frame_callee() for getting the name of the called method
    
    * test/ruby/test_module.rb: add test

  Modified files:
    trunk/ChangeLog
    trunk/test/ruby/test_module.rb
    trunk/variable.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 40914)
+++ ChangeLog	(revision 40915)
@@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Fri May 24 19:32:00 2013  Charlie Somerville  <charliesome@r...>
+
+	* variable.c (set_const_visibility): use rb_frame_this_func() instead
+	  of rb_frame_callee() for getting the name of the called method
+
+	* test/ruby/test_module.rb: add test for private_constant with no args
+
 Fri May 24 18:53:10 2013  Koichi Sasada  <ko1@a...>
 
 	* gc.c: do major/full GC when:
Index: variable.c
===================================================================
--- variable.c	(revision 40914)
+++ variable.c	(revision 40915)
@@ -2231,7 +2231,7 @@ set_const_visibility(VALUE mod, int argc https://github.com/ruby/ruby/blob/trunk/variable.c#L2231
 
     if (argc == 0) {
 	rb_warning("%"PRIsVALUE" with no argument is just ignored",
-		   QUOTE_ID(rb_frame_callee()));
+		   QUOTE_ID(rb_frame_this_func()));
     }
 
     for (i = 0; i < argc; i++) {
Index: test/ruby/test_module.rb
===================================================================
--- test/ruby/test_module.rb	(revision 40914)
+++ test/ruby/test_module.rb	(revision 40915)
@@ -1232,6 +1232,15 @@ class TestModule < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_module.rb#L1232
     assert_equal("bar", c.class_eval("BAR"))
   end
 
+  def test_private_constant_with_no_args
+    assert_in_out_err([], <<-RUBY, [], ["-:3: warning: private_constant with no argument is just ignored"])
+      $-w = true
+      class X
+        private_constant
+      end
+    RUBY
+  end
+
   class PrivateClass
   end
   private_constant :PrivateClass

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

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