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

ruby-changes:26240

From: shugo <ko1@a...>
Date: Mon, 10 Dec 2012 22:03:18 +0900 (JST)
Subject: [ruby-changes:26240] shugo:r38297 (trunk): * vm_method.c (rb_method_entry_without_refinements): use

shugo	2012-12-10 22:02:54 +0900 (Mon, 10 Dec 2012)

  New Revision: 38297

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

  Log:
    * vm_method.c (rb_method_entry_without_refinements): use
      rb_resolve_refined_method() to search superclasses if
      me->def->orig_me is 0.  This change fixes make test-all
      TESTS="json ruby/test_refinement.rb".
    
    * test/ruby/test_refinement.rb: related test.

  Modified files:
    trunk/ChangeLog
    trunk/test/ruby/test_refinement.rb
    trunk/vm_method.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 38296)
+++ ChangeLog	(revision 38297)
@@ -1,3 +1,12 @@
+Mon Dec 10 18:35:25 2012  Shugo Maeda  <shugo@r...>
+
+	* vm_method.c (rb_method_entry_without_refinements): use
+	  rb_resolve_refined_method() to search superclasses if
+	  me->def->orig_me is 0.  This change fixes make test-all
+	  TESTS="json ruby/test_refinement.rb".
+
+	* test/ruby/test_refinement.rb: related test.
+
 Mon Dec 10 17:59:07 2012  NAKAMURA Usaku  <usa@r...>
 
 	* ext/fiddle/win32/*: library ports from DL to Fiddle.
Index: vm_method.c
===================================================================
--- vm_method.c	(revision 38296)
+++ vm_method.c	(revision 38297)
@@ -637,7 +637,7 @@
     rb_method_entry_t *me = rb_method_entry(klass, id, &defined_class);
 
     if (me && me->def->type == VM_METHOD_TYPE_REFINED) {
-	me = me->def->body.orig_me;
+	me = rb_resolve_refined_method(Qnil, me, &defined_class);
     }
     if (defined_class_ptr)
 	*defined_class_ptr = defined_class;
Index: test/ruby/test_refinement.rb
===================================================================
--- test/ruby/test_refinement.rb	(revision 38296)
+++ test/ruby/test_refinement.rb	(revision 38297)
@@ -129,11 +129,30 @@
     assert_raise(NoMethodError) { foo.z }
   end
 
+  module RespondTo
+    class Super
+      def foo
+      end
+    end
+
+    class Sub < Super
+    end
+
+    module M
+      refine Sub do
+        def foo
+        end
+      end
+    end
+  end
+
   def test_send_should_not_use_refinements
     foo = Foo.new
     assert_raise(NoMethodError) { foo.send(:z) }
     assert_raise(NoMethodError) { FooExtClient.send_z_on(foo) }
     assert_raise(NoMethodError) { foo.send(:z) }
+
+    assert_equal(true, RespondTo::Sub.new.respond_to?(:foo))
   end
 
   def test_method_should_not_use_refinements

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

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