1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* vm_insnhelper.c (vm_call_method): stop method search when a method

is not found in a refinement, to support undef in refinements.
  [ruby-core:66741] [Bug #10578]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49554 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
shugo 2015-02-10 02:40:21 +00:00
parent 25dda42b7c
commit 53053bcac6
3 changed files with 23 additions and 0 deletions

View file

@ -1,3 +1,9 @@
Tue Feb 10 11:38:28 2015 Shugo Maeda <shugo@ruby-lang.org>
* vm_insnhelper.c (vm_call_method): stop method search when a method
is not found in a refinement, to support undef in refinements.
[ruby-core:66741] [Bug #10578]
Tue Feb 10 11:19:11 2015 Shugo Maeda <shugo@ruby-lang.org> Tue Feb 10 11:19:11 2015 Shugo Maeda <shugo@ruby-lang.org>
* lib/net/ftp.rb (chdir, delete, gettextfile, mdtm, mkdir, nlst, * lib/net/ftp.rb (chdir, delete, gettextfile, mdtm, mkdir, nlst,

View file

@ -1387,6 +1387,19 @@ class TestRefinement < Test::Unit::TestCase
:foo, bug10826) :foo, bug10826)
end end
def test_undef_original_method
assert_in_out_err([], <<-INPUT, ["NoMethodError"], [])
module NoPlus
refine String do
undef +
end
end
using NoPlus
"a" + "b" rescue p($!.class)
INPUT
end
private private
def eval_using(mod, s) def eval_using(mod, s)

View file

@ -1752,6 +1752,10 @@ vm_call_method(rb_thread_t *th, rb_control_frame_t *cfp, rb_call_info_t *ci)
goto start_method_dispatch; goto start_method_dispatch;
} }
} }
else {
ci->me = 0;
goto start_method_dispatch;
}
no_refinement_dispatch: no_refinement_dispatch:
if (ci->me->def->body.orig_me) { if (ci->me->def->body.orig_me) {