Bug #10929 ยป block_from_nil.patch
| bootstraptest/test_block.rb | ||
|---|---|---|
|
end
|
||
|
'ok'
|
||
|
}
|
||
|
assert_equal 'ok', %q{
|
||
|
class NilClass
|
||
|
def to_proc
|
||
|
Proc.new {|x| x }
|
||
|
end
|
||
|
end
|
||
|
def foo(&blk)
|
||
|
blk.call('ok')
|
||
|
end
|
||
|
foo(&nil)
|
||
|
}, '[ruby-core:68384] [Bug #10929]'
|
||
| vm_args.c | ||
|---|---|---|
|
proc = *(--reg_cfp->sp);
|
||
|
if (proc != Qnil) {
|
||
|
if (proc != Qnil || rb_respond_to(Qnil, idTo_proc)) {
|
||
|
if (!rb_obj_is_proc(proc)) {
|
||
|
VALUE b;
|
||