private static void CollectAssignedStructParameters([NotNull][ItemNotNull] ICollection <IParameterSymbol> parameters, [NotNull] IOperation bodyOperation, [NotNull] DiagnosticCollector collector) { var walker = new AssignmentWalker(parameters); walker.Visit(bodyOperation); foreach (IParameterSymbol parameter in walker.ParametersAssigned) { collector.Add(Diagnostic.Create(Rule, parameter.Locations[0], parameter.Name)); } }
private static void AnalyzeOrdinaryParameters(BaseAnalysisContext <ICollection <IParameterSymbol> > context, [NotNull] SyntaxNode bodySyntax, [NotNull] DiagnosticCollector collector) { DataFlowAnalysis dataFlowAnalysis = TryAnalyzeDataFlow(bodySyntax, context.Compilation); if (dataFlowAnalysis == null) { return; } foreach (IParameterSymbol parameter in context.Target) { if (dataFlowAnalysis.WrittenInside.Contains(parameter)) { collector.Add(Diagnostic.Create(Rule, parameter.Locations[0], parameter.Name)); } } }