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

ruby-changes:24561

From: shugo <ko1@a...>
Date: Fri, 3 Aug 2012 19:27:31 +0900 (JST)
Subject: [ruby-changes:24561] shugo:r36612 (trunk): * insns.def (invokesuper): don't skip the same class. instead, use

shugo	2012-08-03 19:27:21 +0900 (Fri, 03 Aug 2012)

  New Revision: 36612

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

  Log:
    * insns.def (invokesuper): don't skip the same class.  instead, use
      rb_method_entry_get_with_omod() to avoid infinite loop when
      super is used with refinements. [ruby-core:30450] [Bug #3351]

  Modified files:
    trunk/ChangeLog
    trunk/insns.def
    trunk/test/ruby/test_super.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 36611)
+++ ChangeLog	(revision 36612)
@@ -1,3 +1,9 @@
+Fri Aug  3 19:26:10 2012  Shugo Maeda  <shugo@r...>
+
+	* insns.def (invokesuper): don't skip the same class.  instead, use
+	  rb_method_entry_get_with_omod() to avoid infinite loop when
+	  super is used with refinements. [ruby-core:30450] [Bug #3351]
+
 Fri Aug  3 19:21:19 2012  Nobuyoshi Nakada  <nobu@r...>
 
 	* configure.in: use clang prior to gcc only when self-compiling on
Index: insns.def
===================================================================
--- insns.def	(revision 36611)
+++ insns.def	(revision 36612)
@@ -1045,12 +1045,7 @@
     while (ip && !ip->klass) {
 	ip = ip->parent_iseq;
     }
-    me = rb_method_entry(klass, id, &klass);
-    if (me && me->def->type == VM_METHOD_TYPE_ISEQ &&
-	me->def->body.iseq == ip) {
-	klass = RCLASS_SUPER(klass);
-	me = rb_method_entry_get_with_omod(Qnil, klass, id, &klass);
-    }
+    me = rb_method_entry_get_with_omod(Qnil, klass, id, &klass);
 
     CALL_METHOD(num, blockptr, flag, id, me, recv, klass);
 }
Index: test/ruby/test_super.rb
===================================================================
--- test/ruby/test_super.rb	(revision 36611)
+++ test/ruby/test_super.rb	(revision 36612)
@@ -184,4 +184,32 @@
       mid.subseq
     end
   end
+
+  module DoubleInclude
+    class Base
+      def foo
+        [:Base]
+      end
+    end
+
+    module Override
+      def foo
+        super << :Override
+      end
+    end
+
+    class A < Base
+    end
+
+    class B < A
+    end
+
+    B.send(:include, Override)
+    A.send(:include, Override)
+  end
+
+  # [Bug #3351]
+  def test_double_include
+    assert_equal([:Base, :Override, :Override], DoubleInclude::B.new.foo)
+  end
 end

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

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