@@ -55,30 +55,30 @@ private static void AnalyzeSwitchStatement(SyntaxNodeAnalysisContext context)
55
55
{
56
56
TriviaBlock block = TriviaBlock . FromBetween ( previousSection , en . Current ) ;
57
57
58
- if ( ! block . Success )
59
- continue ;
60
-
61
- if ( block . Kind == TriviaBlockKind . BlankLine )
58
+ if ( block . Success )
62
59
{
63
- if ( option == BlankLineBetweenSwitchSections . Omit )
60
+ if ( block . Kind == TriviaBlockKind . BlankLine )
61
+ {
62
+ if ( option == BlankLineBetweenSwitchSections . Omit )
63
+ {
64
+ ReportDiagnostic ( context , block , "Remove" ) ;
65
+ }
66
+ else if ( option == BlankLineBetweenSwitchSections . OmitAfterBlock
67
+ && previousLastStatement . IsKind ( SyntaxKind . Block ) )
68
+ {
69
+ ReportDiagnostic ( context , block , "Remove" ) ;
70
+ }
71
+ }
72
+ else if ( option == BlankLineBetweenSwitchSections . Include )
64
73
{
65
- ReportDiagnostic ( context , block , "Remove " ) ;
74
+ ReportDiagnostic ( context , block , "Add " ) ;
66
75
}
67
76
else if ( option == BlankLineBetweenSwitchSections . OmitAfterBlock
68
- && previousLastStatement . IsKind ( SyntaxKind . Block ) )
77
+ && ! previousLastStatement . IsKind ( SyntaxKind . Block ) )
69
78
{
70
- ReportDiagnostic ( context , block , "Remove " ) ;
79
+ ReportDiagnostic ( context , block , "Add " ) ;
71
80
}
72
81
}
73
- else if ( option == BlankLineBetweenSwitchSections . Include )
74
- {
75
- ReportDiagnostic ( context , block , "Add" ) ;
76
- }
77
- else if ( option == BlankLineBetweenSwitchSections . OmitAfterBlock
78
- && ! previousLastStatement . IsKind ( SyntaxKind . Block ) )
79
- {
80
- ReportDiagnostic ( context , block , "Add" ) ;
81
- }
82
82
83
83
previousSection = en . Current ;
84
84
previousLastStatement = previousSection . Statements . LastOrDefault ( ) ;
0 commit comments