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:
parent
d763d45da2
commit
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>
|
Thu Jan 8 16:31:43 2015 Seiei Higa <hanachin@gmail.com>
|
||||||
|
|
||||||
* vm_method.c (rb_export_method): bail out if the original method
|
* 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}
|
assert_raise(NoMethodError, bug10106) {Object.new.foo}
|
||||||
end;
|
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
|
end
|
||||||
|
|
||||||
def test_change_refined_new_method_visibility
|
def test_change_refined_new_method_visibility
|
||||||
|
@ -668,12 +668,17 @@ get_original_method_entry(VALUE refinements,
|
|||||||
const rb_method_entry_t *me,
|
const rb_method_entry_t *me,
|
||||||
VALUE *defined_class_ptr)
|
VALUE *defined_class_ptr)
|
||||||
{
|
{
|
||||||
|
VALUE super;
|
||||||
|
|
||||||
if (me->def->body.orig_me) {
|
if (me->def->body.orig_me) {
|
||||||
return me->def->body.orig_me;
|
return me->def->body.orig_me;
|
||||||
}
|
}
|
||||||
|
else if (!(super = RCLASS_SUPER(me->klass))) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
rb_method_entry_t *tmp_me;
|
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);
|
defined_class_ptr);
|
||||||
return rb_resolve_refined_method(refinements, tmp_me,
|
return rb_resolve_refined_method(refinements, tmp_me,
|
||||||
defined_class_ptr);
|
defined_class_ptr);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user