Пример #1
0
 /// <summary>
 /// Analyze control-flow within a part of a method body.
 /// </summary>
 public static ControlFlowAnalysis AnalyzeControlFlow(
     this SemanticModel semanticModel,
     SyntaxNode statement
     )
 {
     return(semanticModel.AnalyzeControlFlow(statement));
 }
        static void CollectSwitchSectionStatements(List<StatementSyntax> result, SemanticModel context,
                                                    StatementSyntax statement)
        {
            var blockStatement = statement as BlockSyntax;
            if (blockStatement != null)
                result.AddRange(blockStatement.Statements);
            else
                result.Add(statement);

            // add 'break;' at end if necessary
            var reachabilityAnalysis = context.AnalyzeControlFlow(statement);
            if (reachabilityAnalysis.EndPointIsReachable)
                result.Add(SyntaxFactory.BreakStatement());
        }