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

ruby-changes:37101

From: nobu <ko1@a...>
Date: Thu, 8 Jan 2015 16:31:56 +0900 (JST)
Subject: [ruby-changes:37101] nobu:r49182 (trunk): vm_method.c: fix change refined new method visibility

nobu	2015-01-08 16:31:45 +0900 (Thu, 08 Jan 2015)

  New Revision: 49182

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

  Log:
    vm_method.c: fix change refined new method visibility

  Modified files:
    trunk/ChangeLog
    trunk/test/ruby/test_refinement.rb
    trunk/vm_method.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 49181)
+++ ChangeLog	(revision 49182)
@@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Thu Jan  8 16:31:43 2015  Seiei Higa  <hanachin@g...>
+
+
+
 Thu Jan  8 12:53:44 2015  Nobuyoshi Nakada  <nobu@r...>
 
 	* dir.c (glob_helper): match in case-folding only if the directory
Index: vm_method.c
===================================================================
--- vm_method.c	(revision 49181)
+++ vm_method.c	(revision 49182)
@@ -825,7 +825,9 @@ rb_export_method(VALUE klass, ID name, r https://github.com/ruby/ruby/blob/trunk/vm_method.c#L825
 	me = search_method(rb_cObject, name, &defined_class);
     }
 
-    if (UNDEFINED_METHOD_ENTRY_P(me)) {
+    if (UNDEFINED_METHOD_ENTRY_P(me) ||
+	(me->def->type == VM_METHOD_TYPE_REFINED &&
+	 UNDEFINED_METHOD_ENTRY_P(me->def->body.orig_me))) {
 	rb_print_undef(klass, name, 0);
     }
 
Index: test/ruby/test_refinement.rb
===================================================================
--- test/ruby/test_refinement.rb	(revision 49181)
+++ test/ruby/test_refinement.rb	(revision 49182)
@@ -1165,6 +1165,20 @@ class TestRefinement < Test::Unit::TestC https://github.com/ruby/ruby/blob/trunk/test/ruby/test_refinement.rb#L1165
     end;
   end
 
+  def test_change_refined_new_method_visibility
+    assert_separately([], <<-"end;")
+    bug10706 = '[ruby-core:67387] [Bug #10706]'
+    module RefinementBug
+      refine Object do
+        def foo
+        end
+      end
+    end
+
+    assert_raise(NameError, bug10706) {private(:foo)}
+    end;
+  end
+
   private
 
   def eval_using(mod, s)

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

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