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);
        }
        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);
        }
        public void AnalyzeRegionDataFlow()
        {
            TestCode        testCode = new TestCode(@"
class C {
    public void F(int x)
    {
        int a;
/*start*/
        int b;
        int x, y = 1;
        { var z = ""a""; }
/*end*/
        int c;
    }
}");
            StatementSyntax firstStatement, lastStatement;

            testCode.GetStatementsBetweenMarkers(out firstStatement, out lastStatement);
            DataFlowAnalysis regionDataFlowAnalysis = testCode.SemanticModel.AnalyzeDataFlow(firstStatement, lastStatement);

            Assert.AreEqual("b,x,y,z", string.Join(",", regionDataFlowAnalysis
                                                   .VariablesDeclared
                                                   .Select(symbol => symbol.Name)));
        }
        public void AnalyzeRegionDataFlow()
        {
            TestCode testCode = new TestCode(@"
class C {
    public void F(int x)
    {
        int a;
/*start*/
        int b;
        int x, y = 1;
        { var z = ""a""; }
/*end*/
        int c;
    }
}");
            StatementSyntax firstStatement, lastStatement;
            testCode.GetStatementsBetweenMarkers(out firstStatement, out lastStatement);
            DataFlowAnalysis regionDataFlowAnalysis = testCode.SemanticModel.AnalyzeDataFlow(firstStatement, lastStatement);

            Assert.AreEqual("b,x,y,z", string.Join(",", regionDataFlowAnalysis
                .VariablesDeclared
                .Select(symbol => symbol.Name)));
        }