IronRuby.Tests.Tests.BlockReturnOptimization1 C# (CSharp) Method

BlockReturnOptimization1() public method

Block return propagates thru a single library method with a block without throwing unwinding exception.
public BlockReturnOptimization1 ( ) : void
return void
        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);
        }
Tests