private ICyclomaticComplexity TryCalculate(ISyntaxNodeDeclaration syntaxNode) { var blockStatements = ParseStatements(syntaxNode); var branchesVisitor = branchesVisitorFactory.Create(); AcceptVisitors(blockStatements, branchesVisitor); return(CreateComplexity(branchesVisitor)); }
private static IEnumerable <SyntaxNode> ParseStatements(ISyntaxNodeDeclaration syntaxNode) { var syntaxNodes = (CSharpSyntaxNode)syntaxNode.UnderlyingSyntaxNode.RawObject; var result = new List <CSharpSyntaxNode> { syntaxNodes }; return(result); }
private static IEnumerable <Statement> ParseStatements(ISyntaxNodeDeclaration syntaxNode) { var blockStatement = (BlockStatement)syntaxNode.UnderlyingSyntaxNode.RawObject; return(blockStatement.Statements); }