From ba5ea548cefd82307e96a6308e2b85425030e461 Mon Sep 17 00:00:00 2001 From: shugo Date: Sun, 11 Nov 2012 02:42:04 +0000 Subject: * vm_core.h (rb_call_info_t::refinements), compile.c (new_callinfo): add a new field for inline method cache. * vm_insnhelper.c (vm_search_method): check rb_call_info_t::refinements not to confuse inline method cache when module_eval is used with refinements. * test/ruby/test_refinement.rb: related test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37616 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_refinement.rb | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'test') diff --git a/test/ruby/test_refinement.rb b/test/ruby/test_refinement.rb index aeb519c18d..12a00bb16c 100644 --- a/test/ruby/test_refinement.rb +++ b/test/ruby/test_refinement.rb @@ -685,4 +685,28 @@ class TestRefinement < Test::Unit::TestCase assert_equal("#", m.refinements[c].inspect) end + + module InlineMethodCache + class C + def foo + "original" + end + end + + module M + refine C do + def foo + "refined" + end + end + end + end + + def test_inline_method_cache + c = InlineMethodCache::C.new + f = Proc.new { c.foo } + assert_equal("original", f.call) + assert_equal("refined", InlineMethodCache::M.module_eval(&f)) + assert_equal("original", f.call) + end end -- cgit v1.2.3