public void BlockReturnOptimization1() {
StackUnwinder.InstanceCount = 0;
TestOutput(@"
def foo
10.times do
return 123
end
end
puts foo
", @"
123
");
Assert(StackUnwinder.InstanceCount == 0);
StackUnwinder.InstanceCount = 0;
TestOutput(@"
def foo
x = proc do
return 123
end
eval('10.times(&x)')
end
puts foo
", @"
123
");
Assert(StackUnwinder.InstanceCount == 1);
}