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

ruby-changes:37342

From: usa <ko1@a...>
Date: Tue, 27 Jan 2015 16:44:09 +0900 (JST)
Subject: [ruby-changes:37342] usa:r49423 (ruby_2_0_0): merge revision(s) 49182, 49183: [Backport #10706]

usa	2015-01-27 16:43:57 +0900 (Tue, 27 Jan 2015)

  New Revision: 49423

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

  Log:
    merge revision(s) 49182,49183: [Backport #10706]
    
    vm_method.c: fix change refined new method visibility
    * vm_method.c (rb_export_method): bail out if the original method
      is undefined when the method is refined.
      [ruby-core:67387] [Bug #10706]

  Modified directories:
    branches/ruby_2_0_0/
  Modified files:
    branches/ruby_2_0_0/ChangeLog
    branches/ruby_2_0_0/test/ruby/test_refinement.rb
    branches/ruby_2_0_0/version.h
    branches/ruby_2_0_0/vm_method.c
Index: ruby_2_0_0/ChangeLog
===================================================================
--- ruby_2_0_0/ChangeLog	(revision 49422)
+++ ruby_2_0_0/ChangeLog	(revision 49423)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1
+Tue Jan 27 16:41:33 2015  Seiei Higa  <hanachin@g...>
+
+	* vm_method.c (rb_export_method): bail out if the original method
+	  is undefined when the method is refined.
+	  [ruby-core:67387] [Bug #10706]
+
 Tue Jan 27 16:27:44 2015  Eric Wong  <e@8...>
 
 	* lib/resolv.rb: consider ENETUNREACH as ResolvTimeout
Index: ruby_2_0_0/vm_method.c
===================================================================
--- ruby_2_0_0/vm_method.c	(revision 49422)
+++ ruby_2_0_0/vm_method.c	(revision 49423)
@@ -771,7 +771,9 @@ rb_export_method(VALUE klass, ID name, r https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/vm_method.c#L771
 	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: ruby_2_0_0/version.h
===================================================================
--- ruby_2_0_0/version.h	(revision 49422)
+++ ruby_2_0_0/version.h	(revision 49423)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/version.h#L1
 #define RUBY_VERSION "2.0.0"
 #define RUBY_RELEASE_DATE "2015-01-27"
-#define RUBY_PATCHLEVEL 618
+#define RUBY_PATCHLEVEL 619
 
 #define RUBY_RELEASE_YEAR 2015
 #define RUBY_RELEASE_MONTH 1
Index: ruby_2_0_0/test/ruby/test_refinement.rb
===================================================================
--- ruby_2_0_0/test/ruby/test_refinement.rb	(revision 49422)
+++ ruby_2_0_0/test/ruby/test_refinement.rb	(revision 49423)
@@ -1002,6 +1002,20 @@ class TestRefinement < Test::Unit::TestC https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/ruby/test_refinement.rb#L1002
     INPUT
   end
 
+  def test_change_refined_new_method_visibility
+    assert_separately(['-W0'], <<-"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)

Property changes on: ruby_2_0_0
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r49182-49183


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

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