private void AnalyzeVisitOperation([NotNull] IOperation operation, [NotNull] StatementWalker statementWalker, OperationAnalysisContext context) { statementWalker.Visit(operation); context.CancellationToken.ThrowIfCancellationRequested(); if (statementWalker.IdentifiersAssigned.Count > 1) { string identifiers = FormatIdentifierList(statementWalker.IdentifiersAssigned.ToList()); Location location = GetLocation(operation); context.ReportDiagnostic(Diagnostic.Create(Rule, location, identifiers)); } }
private static void AnalyzeCodeBlock(CodeBlockAnalysisContext context, int maxStatementCount) { if (context.OwningSymbol is INamedTypeSymbol || context.OwningSymbol.IsSynthesized()) { return; } var statementWalker = new StatementWalker(context.CancellationToken); statementWalker.Visit(context.CodeBlock); if (statementWalker.StatementCount > maxStatementCount) { ReportAtContainingSymbol(statementWalker.StatementCount, maxStatementCount, context); } }