зеркало из https://github.com/github/ruby.git
* 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] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36612 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
bea3f0df10
Коммит
2d3d84155d
|
@ -1,3 +1,9 @@
|
|||
Fri Aug 3 19:26:10 2012 Shugo Maeda <shugo@ruby-lang.org>
|
||||
|
||||
* 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@ruby-lang.org>
|
||||
|
||||
* configure.in: use clang prior to gcc only when self-compiling on
|
||||
|
|
|
@ -1045,12 +1045,7 @@ invokesuper
|
|||
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);
|
||||
}
|
||||
|
|
|
@ -184,4 +184,32 @@ class TestSuper < Test::Unit::TestCase
|
|||
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
|
||||
|
|
Загрузка…
Ссылка в новой задаче