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

* proc.c (proc_new): should use proc_dup() if block has Proc.

* vm.c (vm_make_proc_from_block): should use rb_cProc for block.
* vm.c (vm_make_proc): add an assertion.
* bootstraptest/test_proc.rb: add a test.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20980 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ko1 2008-12-25 03:51:35 +00:00
parent f6e435fe87
commit 7c982059ea
4 changed files with 57 additions and 23 deletions

View file

@ -394,3 +394,27 @@ assert_equal 'ok', %q{
a_proc = give_it
f.call_it(&give_it())
}, '[ruby-core:15711]'
assert_equal 'foo!', %q{
class FooProc < Proc
def initialize
@foo = "foo!"
end
def bar
@foo
end
end
def bar
FooProc.new &lambda{
p 1
}
end
fp = bar(&lambda{
p 2
})
fp.bar
}, 'Subclass of Proc'