ruby-changes:24563
From: shugo <ko1@a...>
Date: Sat, 4 Aug 2012 01:33:20 +0900 (JST)
Subject: [ruby-changes:24563] shugo:r36613 (trunk): * insns.def (invokesuper): reverted r36612 so that super in an
shugo 2012-08-04 01:32:52 +0900 (Sat, 04 Aug 2012) New Revision: 36613 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=36613 Log: * insns.def (invokesuper): reverted r36612 so that super in an aliased method will not call the same method. Modified files: trunk/ChangeLog trunk/insns.def trunk/test/ruby/test_super.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 36612) +++ ChangeLog (revision 36613) @@ -1,3 +1,8 @@ +Sat Aug 4 01:27:40 2012 Shugo Maeda <shugo@r...> + + * insns.def (invokesuper): reverted r36612 so that super in an + aliased method will not call the same method. + Fri Aug 3 19:26:10 2012 Shugo Maeda <shugo@r...> * insns.def (invokesuper): don't skip the same class. instead, use Index: insns.def =================================================================== --- insns.def (revision 36612) +++ insns.def (revision 36613) @@ -1045,7 +1045,12 @@ while (ip && !ip->klass) { ip = ip->parent_iseq; } - me = rb_method_entry_get_with_omod(Qnil, klass, id, &klass); + 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); + } CALL_METHOD(num, blockptr, flag, id, me, recv, klass); } Index: test/ruby/test_super.rb =================================================================== --- test/ruby/test_super.rb (revision 36612) +++ test/ruby/test_super.rb (revision 36613) @@ -210,6 +210,42 @@ # [Bug #3351] def test_double_include - assert_equal([:Base, :Override, :Override], DoubleInclude::B.new.foo) + assert_equal([:Base, :Override], DoubleInclude::B.new.foo) + # should be changed as follows? + # assert_equal([:Base, :Override, :Override], DoubleInclude::B.new.foo) end + + module DoubleInclude2 + class Base + def foo + [:Base] + end + end + + module Override + def foo + super << :Override + end + end + + class A < Base + def foo + super << :A + end + end + + class B < A + def foo + super << :B + end + end + + B.send(:include, Override) + A.send(:include, Override) + end + + def test_double_include + assert_equal([:Base, :Override, :A, :Override, :B], + DoubleInclude2::B.new.foo) + end end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/