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

BlockReturnOptimization7() public method

Return propagates thru yield in a block.
public BlockReturnOptimization7 ( ) : void
return void
        public void BlockReturnOptimization7() {
            StackUnwinder.InstanceCount = 0;
            TestOutput(@"
def f1
  f2 { return 123 } 
  puts 'unreachable'
end

def f2
  1.times { yield }
end

p f1
", @"
123
");
            Assert(StackUnwinder.InstanceCount == 0);

            TestOutput(@"
def f1
  f2 { return 123 } 
  puts 'unreachable'
end

def f2
  1.times { eval('yield') }
end

p f1
", @"
123
");
            Assert(StackUnwinder.InstanceCount == 1);
        }
Tests