ruby-changes:50016
From: usa <ko1@a...>
Date: Wed, 31 Jan 2018 22:13:42 +0900 (JST)
Subject: [ruby-changes:50016] usa:r62134 (ruby_2_3): merge revision(s) 59444, 59445: [Backport #13776]
usa 2018-01-31 22:13:36 +0900 (Wed, 31 Jan 2018) New Revision: 62134 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=62134 Log: 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@g...> Modified directories: branches/ruby_2_3/ Modified files: branches/ruby_2_3/ChangeLog branches/ruby_2_3/test/ruby/test_refinement.rb branches/ruby_2_3/version.h branches/ruby_2_3/vm_insnhelper.c Index: ruby_2_3/ChangeLog =================================================================== --- ruby_2_3/ChangeLog (revision 62133) +++ ruby_2_3/ChangeLog (revision 62134) @@ -1,3 +1,18 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ChangeLog#L1 +Wed Jan 31 22:12:48 2018 Nobuyoshi Nakada <nobu@r...> + + adjust indent + + * 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@g...> + Wed Jan 31 20:47:07 2018 NARUSE, Yui <naruse@r...> HTTPHeader#add_field should allow binary [Bug #13926] Index: ruby_2_3/test/ruby/test_refinement.rb =================================================================== --- ruby_2_3/test/ruby/test_refinement.rb (revision 62133) +++ ruby_2_3/test/ruby/test_refinement.rb (revision 62134) @@ -1673,6 +1673,49 @@ class TestRefinement < Test::Unit::TestC https://github.com/ruby/ruby/blob/trunk/ruby_2_3/test/ruby/test_refinement.rb#L1673 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) Index: ruby_2_3/version.h =================================================================== --- ruby_2_3/version.h (revision 62133) +++ ruby_2_3/version.h (revision 62134) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/version.h#L1 #define RUBY_VERSION "2.3.7" #define RUBY_RELEASE_DATE "2018-01-31" -#define RUBY_PATCHLEVEL 395 +#define RUBY_PATCHLEVEL 396 #define RUBY_RELEASE_YEAR 2018 #define RUBY_RELEASE_MONTH 1 Index: ruby_2_3/vm_insnhelper.c =================================================================== --- ruby_2_3/vm_insnhelper.c (revision 62133) +++ ruby_2_3/vm_insnhelper.c (revision 62134) @@ -2073,48 +2073,49 @@ vm_call_method_each_type(rb_thread_t *th https://github.com/ruby/ruby/blob/trunk/ruby_2_3/vm_insnhelper.c#L2073 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); } } Index: ruby_2_3 =================================================================== --- ruby_2_3 (revision 62133) +++ ruby_2_3 (revision 62134) Property changes on: ruby_2_3 ___________________________________________________________________ Modified: svn:mergeinfo ## -0,0 +0,1 ## Merged /trunk:r59444 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/