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

ruby-changes:26214

From: shugo <ko1@a...>
Date: Sat, 8 Dec 2012 12:37:13 +0900 (JST)
Subject: [ruby-changes:26214] shugo:r38271 (trunk): * vm_insnhelper.c (vm_search_normal_superclass): super in a

shugo	2012-12-08 12:36:58 +0900 (Sat, 08 Dec 2012)

  New Revision: 38271

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

  Log:
    * vm_insnhelper.c (vm_search_normal_superclass): super in a
      refinement always uses the refined class as its superclass.
    
    * test/ruby/test_refinement.rb: related test.

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

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 38270)
+++ ChangeLog	(revision 38271)
@@ -1,3 +1,10 @@
+Sat Dec  8 12:34:01 2012  Shugo Maeda  <shugo@r...>
+
+	* vm_insnhelper.c (vm_search_normal_superclass): super in a
+	  refinement always uses the refined class as its superclass.
+
+	* test/ruby/test_refinement.rb: related test.
+
 Sat Dec  8 11:59:59 2012  Shugo Maeda  <shugo@r...>
 
 	* eval.c (rb_mod_refine): raise an ArgumentError if a given
@@ -7,6 +14,8 @@
 	  cache to improve performance.  It's safe now because blocks cannot
 	  be yielded with different refinements in the new specification.
 
+	* test/ruby/test_refinement.rb: related test.
+
 Sat Dec  8 11:17:53 2012  Shugo Maeda  <shugo@r...>
 
 	* eval.c (rb_mod_refine), vm_eval.c (rb_yield_refine_block): 
Index: vm_insnhelper.c
===================================================================
--- vm_insnhelper.c	(revision 38270)
+++ vm_insnhelper.c	(revision 38271)
@@ -1866,8 +1866,14 @@
 static inline VALUE
 vm_search_normal_superclass(VALUE klass)
 {
-    klass = RCLASS_ORIGIN(klass);
-    return RCLASS_SUPER(klass);
+    if (BUILTIN_TYPE(klass) == T_ICLASS &&
+	FL_TEST(RBASIC(klass)->klass, RMODULE_IS_REFINEMENT)) {
+	return rb_refinement_module_get_refined_class(RBASIC(klass)->klass);
+    }
+    else {
+	klass = RCLASS_ORIGIN(klass);
+	return RCLASS_SUPER(klass);
+    }
 }
 
 static void
Index: test/ruby/test_refinement.rb
===================================================================
--- test/ruby/test_refinement.rb	(revision 38270)
+++ test/ruby/test_refinement.rb	(revision 38271)
@@ -115,10 +115,10 @@
     assert_equal("Foo#y", foo.y)
   end
 
-  def test_super_chain
+  def test_super_not_chained
     foo = Foo.new
     assert_equal("Foo#y", foo.y)
-    assert_equal("FooExt2#y FooExt#y Foo#y", FooExtClient2.invoke_y_on(foo))
+    assert_equal("FooExt2#y Foo#y", FooExtClient2.invoke_y_on(foo))
     assert_equal("Foo#y", foo.y)
   end
 

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

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