@@ -28,10 +28,7 @@ internal abstract class ElementDocumentationBase : DiagnosticAnalyzer
2828 private readonly Action < SyntaxNodeAnalysisContext , StyleCopSettings > indexerDeclarationAction ;
2929 private readonly Action < SyntaxNodeAnalysisContext , StyleCopSettings > operatorDeclarationAction ;
3030 private readonly Action < SyntaxNodeAnalysisContext , StyleCopSettings > conversionOperatorDeclarationAction ;
31- private readonly Action < SyntaxNodeAnalysisContext , StyleCopSettings > classDeclarationAction ;
32- private readonly Action < SyntaxNodeAnalysisContext , StyleCopSettings > structDeclarationAction ;
33- private readonly Action < SyntaxNodeAnalysisContext , StyleCopSettings > interfaceDeclarationAction ;
34- private readonly Action < SyntaxNodeAnalysisContext , StyleCopSettings > enumDeclarationAction ;
31+ private readonly Action < SyntaxNodeAnalysisContext , StyleCopSettings > baseTypeDeclarationAction ;
3532 private readonly Action < SyntaxNodeAnalysisContext , StyleCopSettings > fieldDeclarationAction ;
3633 private readonly Action < SyntaxNodeAnalysisContext , StyleCopSettings > propertyDeclarationAction ;
3734
@@ -46,10 +43,7 @@ protected ElementDocumentationBase(bool inheritDocSuppressesWarnings, string mat
4643 this . indexerDeclarationAction = this . HandleIndexerDeclaration ;
4744 this . operatorDeclarationAction = this . HandleOperatorDeclaration ;
4845 this . conversionOperatorDeclarationAction = this . HandleConversionOperatorDeclaration ;
49- this . classDeclarationAction = this . HandleClassDeclaration ;
50- this . structDeclarationAction = this . HandleStructDeclaration ;
51- this . interfaceDeclarationAction = this . HandleInterfaceDeclaration ;
52- this . enumDeclarationAction = this . HandleEnumDeclaration ;
46+ this . baseTypeDeclarationAction = this . HandleBaseTypeDeclaration ;
5347 this . fieldDeclarationAction = this . HandleFieldDeclaration ;
5448 this . propertyDeclarationAction = this . HandlePropertyDeclaration ;
5549 }
@@ -66,10 +60,7 @@ public override void Initialize(AnalysisContext context)
6660 context . RegisterSyntaxNodeAction ( this . indexerDeclarationAction , SyntaxKind . IndexerDeclaration ) ;
6761 context . RegisterSyntaxNodeAction ( this . operatorDeclarationAction , SyntaxKind . OperatorDeclaration ) ;
6862 context . RegisterSyntaxNodeAction ( this . conversionOperatorDeclarationAction , SyntaxKind . ConversionOperatorDeclaration ) ;
69- context . RegisterSyntaxNodeAction ( this . classDeclarationAction , SyntaxKind . ClassDeclaration ) ;
70- context . RegisterSyntaxNodeAction ( this . structDeclarationAction , SyntaxKind . StructDeclaration ) ;
71- context . RegisterSyntaxNodeAction ( this . interfaceDeclarationAction , SyntaxKind . InterfaceDeclaration ) ;
72- context . RegisterSyntaxNodeAction ( this . enumDeclarationAction , SyntaxKind . EnumDeclaration ) ;
63+ context . RegisterSyntaxNodeAction ( this . baseTypeDeclarationAction , SyntaxKinds . BaseTypeDeclaration ) ;
7364 context . RegisterSyntaxNodeAction ( this . fieldDeclarationAction , SyntaxKind . FieldDeclaration ) ;
7465 context . RegisterSyntaxNodeAction ( this . propertyDeclarationAction , SyntaxKind . PropertyDeclaration ) ;
7566 }
@@ -178,39 +169,9 @@ private void HandleConversionOperatorDeclaration(SyntaxNodeAnalysisContext conte
178169 this . HandleDeclaration ( context , needsComment , node , node . GetLocation ( ) ) ;
179170 }
180171
181- private void HandleClassDeclaration ( SyntaxNodeAnalysisContext context , StyleCopSettings settings )
172+ private void HandleBaseTypeDeclaration ( SyntaxNodeAnalysisContext context , StyleCopSettings settings )
182173 {
183- var node = ( ClassDeclarationSyntax ) context . Node ;
184-
185- Accessibility declaredAccessibility = node . GetDeclaredAccessibility ( context . SemanticModel , context . CancellationToken ) ;
186- Accessibility effectiveAccessibility = node . GetEffectiveAccessibility ( context . SemanticModel , context . CancellationToken ) ;
187- bool needsComment = SA1600ElementsMustBeDocumented . NeedsComment ( settings . DocumentationRules , node . Kind ( ) , node . Parent . Kind ( ) , declaredAccessibility , effectiveAccessibility ) ;
188- this . HandleDeclaration ( context , needsComment , node , node . Identifier . GetLocation ( ) ) ;
189- }
190-
191- private void HandleStructDeclaration ( SyntaxNodeAnalysisContext context , StyleCopSettings settings )
192- {
193- var node = ( StructDeclarationSyntax ) context . Node ;
194-
195- Accessibility declaredAccessibility = node . GetDeclaredAccessibility ( context . SemanticModel , context . CancellationToken ) ;
196- Accessibility effectiveAccessibility = node . GetEffectiveAccessibility ( context . SemanticModel , context . CancellationToken ) ;
197- bool needsComment = SA1600ElementsMustBeDocumented . NeedsComment ( settings . DocumentationRules , node . Kind ( ) , node . Parent . Kind ( ) , declaredAccessibility , effectiveAccessibility ) ;
198- this . HandleDeclaration ( context , needsComment , node , node . Identifier . GetLocation ( ) ) ;
199- }
200-
201- private void HandleInterfaceDeclaration ( SyntaxNodeAnalysisContext context , StyleCopSettings settings )
202- {
203- var node = ( InterfaceDeclarationSyntax ) context . Node ;
204-
205- Accessibility declaredAccessibility = node . GetDeclaredAccessibility ( context . SemanticModel , context . CancellationToken ) ;
206- Accessibility effectiveAccessibility = node . GetEffectiveAccessibility ( context . SemanticModel , context . CancellationToken ) ;
207- bool needsComment = SA1600ElementsMustBeDocumented . NeedsComment ( settings . DocumentationRules , node . Kind ( ) , node . Parent . Kind ( ) , declaredAccessibility , effectiveAccessibility ) ;
208- this . HandleDeclaration ( context , needsComment , node , node . Identifier . GetLocation ( ) ) ;
209- }
210-
211- private void HandleEnumDeclaration ( SyntaxNodeAnalysisContext context , StyleCopSettings settings )
212- {
213- var node = ( EnumDeclarationSyntax ) context . Node ;
174+ var node = ( BaseTypeDeclarationSyntax ) context . Node ;
214175
215176 Accessibility declaredAccessibility = node . GetDeclaredAccessibility ( context . SemanticModel , context . CancellationToken ) ;
216177 Accessibility effectiveAccessibility = node . GetEffectiveAccessibility ( context . SemanticModel , context . CancellationToken ) ;
0 commit comments