public void RegisterSyntaxNodeAction <TLanguageKindEnum>(DiagnosticAnalyzer analyzer, Action <SyntaxNodeAnalysisContext> action, ImmutableArray <TLanguageKindEnum> syntaxKinds) where TLanguageKindEnum : struct { SyntaxNodeAnalyzerAction <TLanguageKindEnum> analyzerAction = new SyntaxNodeAnalyzerAction <TLanguageKindEnum>(action, syntaxKinds, analyzer); this.GetOrCreateAnalyzerActions(analyzer).AddSyntaxNodeAction(analyzerAction); _syntaxNodeActions = _syntaxNodeActions.Add(analyzerAction); }
private void ExecuteSyntaxNodeAction <TLanguageKindEnum>( SyntaxNodeAnalyzerAction <TLanguageKindEnum> syntaxNodeAction, SyntaxNode node, SemanticModel semanticModel) where TLanguageKindEnum : struct { var syntaxNodeContext = new SyntaxNodeAnalysisContext(node, semanticModel, _analyzerOptions, _addDiagnostic, _cancellationToken); ExecuteAndCatchIfThrows(syntaxNodeAction.Analyzer, () => syntaxNodeAction.Action(syntaxNodeContext)); }
private void ExecuteSyntaxNodeAction <TLanguageKindEnum>( SyntaxNodeAnalyzerAction <TLanguageKindEnum> syntaxNodeAction, SyntaxNode node, SemanticModel semanticModel, Action <Diagnostic> addDiagnostic, SyntaxNodeAnalyzerStateData analyzerStateOpt) where TLanguageKindEnum : struct { Debug.Assert(analyzerStateOpt == null || analyzerStateOpt.CurrentNode == node); if (ShouldExecuteAction(analyzerStateOpt, syntaxNodeAction)) { var syntaxNodeContext = new SyntaxNodeAnalysisContext(node, semanticModel, _analyzerOptions, addDiagnostic, d => IsSupportedDiagnostic(syntaxNodeAction.Analyzer, d), _cancellationToken); ExecuteAndCatchIfThrows(syntaxNodeAction.Analyzer, () => syntaxNodeAction.Action(syntaxNodeContext)); analyzerStateOpt?.ProcessedActions.Add(syntaxNodeAction); } }
internal void AddSyntaxNodeAction <TLanguageKindEnum>(SyntaxNodeAnalyzerAction <TLanguageKindEnum> action) where TLanguageKindEnum : struct { _syntaxNodeActions = _syntaxNodeActions.Add(action); }