* vm_insnhelper.c (vm_cref_push): no outer cref is needed for proc

from method.  Bug #3786, Bug #3860, [ruby-core:32501]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29318 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2010-09-23 00:01:40 +00:00
parent 631d23c57b
commit 9ccd4fe127
3 changed files with 31 additions and 9 deletions

View file

@ -415,4 +415,19 @@ class TestEval < Test::Unit::TestCase
assert_raise(ArgumentError) {eval("__ENCODING__".encode("utf-32be"))}
assert_raise(ArgumentError) {eval("__ENCODING__".encode("utf-32le"))}
end
def test_instance_eval_method_proc
bug3860 = Class.new do
def initialize(a);
@a=a
end
def get(*args)
@a
end
end
foo = bug3860.new 1
foo_pr = foo.method(:get).to_proc
result = foo.instance_eval(&foo_pr)
assert_equal(1, result, 'Bug #3786, Bug #3860, [ruby-core:32501]')
end
end