Project

General

Profile

Bug #13776 » refinement.patch

Mon_Ouie (Mon ouïe), 07/29/2017 09:18 AM

View differences:

test/ruby/test_refinement.rb (working copy)
end
end
class ParentDefiningPrivateMethod
private
def some_inherited_method
end
end
module MixinDefiningPrivateMethod
private
def some_included_method
end
end
class SomeChildClassToRefine < ParentDefiningPrivateMethod
include MixinDefiningPrivateMethod
private
def some_method
end
end
def test_refine_inherited_method_with_visibility_changes
Module.new do
refine(SomeChildClassToRefine) do
def some_inherited_method; end
def some_included_method; end
def some_method; end
end
end
obj = SomeChildClassToRefine.new
assert_raise_with_message(NoMethodError, /private/) do
obj.some_inherited_method
end
assert_raise_with_message(NoMethodError, /private/) do
obj.some_included_method
end
assert_raise_with_message(NoMethodError, /private/) do
obj.some_method
end
end
private
def eval_using(mod, s)
vm_insnhelper.c (working copy)
return vm_call_method(th, cfp, calling, ci, cc);
}
else {
return vm_call_zsuper(th, cfp, calling, ci, cc, cc->me->owner);
VALUE klass = RCLASS_SUPER(cc->me->owner);
cc->me = klass ? rb_callable_method_entry(klass, ci->mid) : NULL;
return vm_call_method(th, cfp, calling, ci, cc);
}
}
}
    (1-1/1)