зеркало из https://github.com/github/ruby.git
vm_method.c: no super klass, no original method entry
* vm_method.c (rb_method_entry): if no super class, no original method entry. [ruby-core:67389] [Bug #10707] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49184 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
d763d45da2
Коммит
3f8ceab90e
|
@ -1,3 +1,8 @@
|
|||
Thu Jan 8 17:05:00 2015 Seiei Higa <hanachin@gmail.com>
|
||||
|
||||
* vm_method.c (rb_method_entry): if no super class, no original
|
||||
method entry. [ruby-core:67389] [Bug #10707]
|
||||
|
||||
Thu Jan 8 16:31:43 2015 Seiei Higa <hanachin@gmail.com>
|
||||
|
||||
* vm_method.c (rb_export_method): bail out if the original method
|
||||
|
|
|
@ -1163,6 +1163,19 @@ class TestRefinement < Test::Unit::TestCase
|
|||
|
||||
assert_raise(NoMethodError, bug10106) {Object.new.foo}
|
||||
end;
|
||||
|
||||
assert_separately([], <<-"end;")
|
||||
bug10707 = '[ruby-core:67389] [Bug #10707]'
|
||||
module RefinementBug
|
||||
refine BasicObject do
|
||||
def foo
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
assert(methods, bug10707)
|
||||
assert_raise(NameError, bug10707) {method(:foo)}
|
||||
end;
|
||||
end
|
||||
|
||||
def test_change_refined_new_method_visibility
|
||||
|
|
|
@ -668,12 +668,17 @@ get_original_method_entry(VALUE refinements,
|
|||
const rb_method_entry_t *me,
|
||||
VALUE *defined_class_ptr)
|
||||
{
|
||||
VALUE super;
|
||||
|
||||
if (me->def->body.orig_me) {
|
||||
return me->def->body.orig_me;
|
||||
}
|
||||
else if (!(super = RCLASS_SUPER(me->klass))) {
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
rb_method_entry_t *tmp_me;
|
||||
tmp_me = rb_method_entry(RCLASS_SUPER(me->klass), me->called_id,
|
||||
tmp_me = rb_method_entry(super, me->called_id,
|
||||
defined_class_ptr);
|
||||
return rb_resolve_refined_method(refinements, tmp_me,
|
||||
defined_class_ptr);
|
||||
|
|
Загрузка…
Ссылка в новой задаче