diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-01-31 13:13:36 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-01-31 13:13:36 +0000 |
commit | 1aee5acdae7fa88e0241ed4c21ed88f775054cba (patch) | |
tree | c611f5ad265456e01e0f2b7d470960a3ac70d357 /vm_insnhelper.c | |
parent | ecb7182f93594109970db1811057c35ca71f73b2 (diff) |
merge revision(s) 59444,59445: [Backport #13776]
adjust indent [ci skip]
* vm_insnhelper.c (vm_call_method_each_type): adjust indent of a
block in switch.
visibility of inherited method
* vm_insnhelper.c (vm_call_method_each_type): honor the original
visibility of inherited methods when a refinement is defined but
not activated. [ruby-core:82209] [Bug #13776]
Author: Mon_Ouie (Mon ouie) <mon.ouie@gmail.com>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@62134 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_insnhelper.c')
-rw-r--r-- | vm_insnhelper.c | 85 |
1 files changed, 43 insertions, 42 deletions
diff --git a/vm_insnhelper.c b/vm_insnhelper.c index e8dbcfb91f..da87a11582 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -2073,48 +2073,49 @@ vm_call_method_each_type(rb_thread_t *th, rb_control_frame_t *cfp, struct rb_cal return vm_call_zsuper(th, cfp, calling, ci, cc, RCLASS_ORIGIN(cc->me->owner)); case VM_METHOD_TYPE_REFINED: { - const rb_cref_t *cref = rb_vm_get_cref(cfp->ep); - VALUE refinements = cref ? CREF_REFINEMENTS(cref) : Qnil; - VALUE refinement; - const rb_callable_method_entry_t *ref_me; - - refinement = find_refinement(refinements, cc->me->owner); - - if (NIL_P(refinement)) { - goto no_refinement_dispatch; - } - ref_me = rb_callable_method_entry(refinement, ci->mid); - - if (ref_me) { - if (cc->call == vm_call_super_method) { - const rb_control_frame_t *top_cfp = current_method_entry(th, cfp); - const rb_callable_method_entry_t *top_me = rb_vm_frame_method_entry(top_cfp); - if (top_me && rb_method_definition_eq(ref_me->def, top_me->def)) { - goto no_refinement_dispatch; - } - } - cc->me = ref_me; - if (ref_me->def->type != VM_METHOD_TYPE_REFINED) { - return vm_call_method(th, cfp, calling, ci, cc); - } - } - else { - cc->me = NULL; - return vm_call_method_nome(th, cfp, calling, ci, cc); - } - - no_refinement_dispatch: - if (cc->me->def->body.refined.orig_me) { - cc->me = refined_method_callable_without_refinement(cc->me); - - if (UNDEFINED_METHOD_ENTRY_P(cc->me)) { - cc->me = NULL; - } - return vm_call_method(th, cfp, calling, ci, cc); - } - else { - return vm_call_zsuper(th, cfp, calling, ci, cc, cc->me->owner); - } + const rb_cref_t *cref = rb_vm_get_cref(cfp->ep); + VALUE refinements = cref ? CREF_REFINEMENTS(cref) : Qnil; + VALUE refinement; + const rb_callable_method_entry_t *ref_me; + + refinement = find_refinement(refinements, cc->me->owner); + + if (NIL_P(refinement)) { + goto no_refinement_dispatch; + } + ref_me = rb_callable_method_entry(refinement, ci->mid); + + if (ref_me) { + if (cc->call == vm_call_super_method) { + const rb_control_frame_t *top_cfp = current_method_entry(th, cfp); + const rb_callable_method_entry_t *top_me = rb_vm_frame_method_entry(top_cfp); + if (top_me && rb_method_definition_eq(ref_me->def, top_me->def)) { + goto no_refinement_dispatch; + } + } + cc->me = ref_me; + if (ref_me->def->type != VM_METHOD_TYPE_REFINED) { + return vm_call_method(th, cfp, calling, ci, cc); + } + } + else { + cc->me = NULL; + return vm_call_method_nome(th, cfp, calling, ci, cc); + } + + no_refinement_dispatch: + if (cc->me->def->body.refined.orig_me) { + cc->me = refined_method_callable_without_refinement(cc->me); + + if (UNDEFINED_METHOD_ENTRY_P(cc->me)) { + cc->me = NULL; + } + } + else { + 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); } } |