vm_method.c: clear cache after refine method
* vm_method.c (rb_add_refined_method_entry): clear cache in the refined class since refining a method entry is modifying the class. [ruby-core:57079] [Bug #8880] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42896 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
d968e9ecfa
commit
a71ee2ce41
@ -1,3 +1,9 @@
|
|||||||
|
Mon Sep 9 16:55:59 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* vm_method.c (rb_add_refined_method_entry): clear cache in the
|
||||||
|
refined class since refining a method entry is modifying the class.
|
||||||
|
[ruby-core:57079] [Bug #8880]
|
||||||
|
|
||||||
Mon Sep 9 09:14:58 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Mon Sep 9 09:14:58 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* tool/rbinstall.rb (Gem::Specification#initialize): default date to
|
* tool/rbinstall.rb (Gem::Specification#initialize): default date to
|
||||||
|
@ -982,6 +982,29 @@ class TestRefinement < Test::Unit::TestCase
|
|||||||
RUBY
|
RUBY
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_refine_after_using
|
||||||
|
assert_separately([], <<-"end;")
|
||||||
|
bug8880 = '[ruby-core:57079] [Bug #8880]'
|
||||||
|
module Test
|
||||||
|
refine(String) do
|
||||||
|
end
|
||||||
|
end
|
||||||
|
using Test
|
||||||
|
def t
|
||||||
|
'Refinements are broken!'.chop!
|
||||||
|
end
|
||||||
|
t
|
||||||
|
module Test
|
||||||
|
refine(String) do
|
||||||
|
def chop!
|
||||||
|
self.sub!(/broken/, 'fine')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
assert_equal('Refinements are fine!', t, bug8880)
|
||||||
|
end;
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def eval_using(mod, s)
|
def eval_using(mod, s)
|
||||||
|
@ -190,6 +190,7 @@ rb_add_refined_method_entry(VALUE refined_class, ID mid)
|
|||||||
|
|
||||||
if (me) {
|
if (me) {
|
||||||
make_method_entry_refined(me);
|
make_method_entry_refined(me);
|
||||||
|
rb_clear_cache_by_class(refined_class);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
rb_add_method(refined_class, mid, VM_METHOD_TYPE_REFINED, 0,
|
rb_add_method(refined_class, mid, VM_METHOD_TYPE_REFINED, 0,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user