@@ -21,8 +21,6 @@ namespace SonarAnalyzer.Core.AnalysisContext;
21
21
22
22
public class SonarAnalysisContext
23
23
{
24
- internal ImmutableArray < DiagnosticDescriptor > SupportedDiagnostics { get ; }
25
-
26
24
private readonly RoslynAnalysisContext analysisContext ;
27
25
28
26
/// <summary>
@@ -54,6 +52,8 @@ public class SonarAnalysisContext
54
52
/// </remarks>
55
53
public static Action < IReportingContext > ReportDiagnostic { get ; set ; }
56
54
55
+ internal ImmutableArray < DiagnosticDescriptor > SupportedDiagnostics { get ; }
56
+
57
57
internal SonarAnalysisContext ( RoslynAnalysisContext analysisContext , ImmutableArray < DiagnosticDescriptor > supportedDiagnostics )
58
58
{
59
59
this . analysisContext = analysisContext ?? throw new ArgumentNullException ( nameof ( analysisContext ) ) ;
@@ -65,18 +65,6 @@ private protected SonarAnalysisContext(SonarAnalysisContext context) : this(cont
65
65
public bool TryGetValue < TValue > ( SourceText text , SourceTextValueProvider < TValue > valueProvider , out TValue value ) =>
66
66
analysisContext . TryGetValue ( text , valueProvider , out value ) ;
67
67
68
- /// <summary>
69
- /// Legacy API for backward compatibility with SonarLint v4.0 - v5.5. See <see cref="ShouldExecuteRegisteredAction"/>.
70
- /// </summary>
71
- internal static bool LegacyIsRegisteredActionEnabled ( IEnumerable < DiagnosticDescriptor > diagnostics , SyntaxTree tree ) =>
72
- ShouldExecuteRegisteredAction == null || tree == null || ShouldExecuteRegisteredAction ( diagnostics , tree ) ;
73
-
74
- /// <summary>
75
- /// Legacy API for backward compatibility with SonarLint v4.0 - v5.5. See <see cref="ShouldExecuteRegisteredAction"/>.
76
- /// </summary>
77
- internal static bool LegacyIsRegisteredActionEnabled ( DiagnosticDescriptor diagnostic , SyntaxTree tree ) =>
78
- ShouldExecuteRegisteredAction == null || tree == null || ShouldExecuteRegisteredAction ( new [ ] { diagnostic } , tree ) ;
79
-
80
68
public void RegisterCodeBlockStartAction < TSyntaxKind > ( GeneratedCodeRecognizer generatedCodeRecognizer , Action < SonarCodeBlockStartAnalysisContext < TSyntaxKind > > action )
81
69
where TSyntaxKind : struct =>
82
70
RegisterCompilationStartAction (
@@ -115,7 +103,19 @@ public void RegisterTreeAction(GeneratedCodeRecognizer generatedCodeRecognizer,
115
103
/// This should NOT be used for actions that report issues.
116
104
/// </summary>
117
105
public void RegisterNodeActionInAllFiles < TSyntaxKind > ( Action < SonarSyntaxNodeReportingContext > action , params TSyntaxKind [ ] syntaxKinds ) where TSyntaxKind : struct =>
118
- analysisContext . RegisterSyntaxNodeAction ( c => action ( new ( this , c ) ) , syntaxKinds ) ;
106
+ analysisContext . RegisterSyntaxNodeAction ( x => action ( new ( this , x ) ) , syntaxKinds ) ;
107
+
108
+ /// <summary>
109
+ /// Legacy API for backward compatibility with SonarLint v4.0 - v5.5. See <see cref="ShouldExecuteRegisteredAction"/>.
110
+ /// </summary>
111
+ internal static bool LegacyIsRegisteredActionEnabled ( IEnumerable < DiagnosticDescriptor > diagnostics , SyntaxTree tree ) =>
112
+ ShouldExecuteRegisteredAction is null || tree is null || ShouldExecuteRegisteredAction ( diagnostics , tree ) ;
113
+
114
+ /// <summary>
115
+ /// Legacy API for backward compatibility with SonarLint v4.0 - v5.5. See <see cref="ShouldExecuteRegisteredAction"/>.
116
+ /// </summary>
117
+ internal static bool LegacyIsRegisteredActionEnabled ( DiagnosticDescriptor diagnostic , SyntaxTree tree ) =>
118
+ ShouldExecuteRegisteredAction is null || tree is null || ShouldExecuteRegisteredAction ( new [ ] { diagnostic } , tree ) ;
119
119
120
120
private void Execute < TSonarContext > ( TSonarContext context , Action < TSonarContext > action )
121
121
where TSonarContext : IAnalysisContext
0 commit comments