Don't check protected method ancestry on fcall
If we are making an FCALL, we know we are calling a method on self. This is the same check made for private method visibility, so it should also guarantee we can call a protected method.
This commit is contained in:
parent
87a560a057
commit
a580dd7737
Notes:
git
2022-06-22 10:34:17 +09:00
@ -3749,7 +3749,7 @@ vm_call_method(rb_execution_context_t *ec, rb_control_frame_t *cfp, struct rb_ca
|
|||||||
return vm_call_method_each_type(ec, cfp, calling);
|
return vm_call_method_each_type(ec, cfp, calling);
|
||||||
|
|
||||||
case METHOD_VISI_PROTECTED:
|
case METHOD_VISI_PROTECTED:
|
||||||
if (!(vm_ci_flag(ci) & VM_CALL_OPT_SEND)) {
|
if (!(vm_ci_flag(ci) & (VM_CALL_OPT_SEND | VM_CALL_FCALL))) {
|
||||||
VALUE defined_class = vm_defined_class_for_protected_call(vm_cc_cme(cc));
|
VALUE defined_class = vm_defined_class_for_protected_call(vm_cc_cme(cc));
|
||||||
if (!rb_obj_is_kind_of(cfp->self, defined_class)) {
|
if (!rb_obj_is_kind_of(cfp->self, defined_class)) {
|
||||||
vm_cc_method_missing_reason_set(cc, MISSING_PROTECTED);
|
vm_cc_method_missing_reason_set(cc, MISSING_PROTECTED);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user