public void AnalyzeRegionControlFlow()
{
TestCode testCode = new TestCode(@"
class C {
public void F()
{
goto L1; // 1
/*start*/
L1: ;
if (false) return;
/*end*/
goto L1; // 2
}
}");
StatementSyntax firstStatement, lastStatement;
testCode.GetStatementsBetweenMarkers(out firstStatement, out lastStatement);
ControlFlowAnalysis regionControlFlowAnalysis =
testCode.SemanticModel.AnalyzeControlFlow(firstStatement, lastStatement);
Assert.AreEqual(1, regionControlFlowAnalysis.EntryPoints.Count());
Assert.AreEqual(1, regionControlFlowAnalysis.ExitPoints.Count());
Assert.IsTrue(regionControlFlowAnalysis.EndPointIsReachable);
BlockSyntax methodBody = testCode.SyntaxTree
.GetRoot()
.DescendantNodes()
.OfType<MethodDeclarationSyntax>()
.First()
.Body;
regionControlFlowAnalysis = testCode.SemanticModel.AnalyzeControlFlow(methodBody, methodBody);
Assert.IsFalse(regionControlFlowAnalysis.EndPointIsReachable);
}