File tree Expand file tree Collapse file tree
StyleCop.Analyzers.Test/ReadabilityRules
StyleCop.Analyzers/ReadabilityRules Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1480,14 +1480,14 @@ void MethodName()
14801480
14811481 case 4:
14821482case 5:
1483- {
1483+ {
14841484 label4:
14851485 while (true)
14861486 {
14871487 }
14881488
14891489 break;
1490- }
1490+ }
14911491default:
14921492label5a:
14931493 label5b:
@@ -1538,7 +1538,7 @@ void MethodName()
15381538 }
15391539
15401540 break;
1541- }
1541+ }
15421542 default:
15431543 label5a:
15441544 label5b:
@@ -1559,6 +1559,7 @@ void MethodName()
15591559 this . CSharpDiagnostic ( ) . WithLocation ( 32 , 1 ) ,
15601560 this . CSharpDiagnostic ( ) . WithLocation ( 34 , 1 ) ,
15611561 this . CSharpDiagnostic ( ) . WithLocation ( 35 , 1 ) ,
1562+ this . CSharpDiagnostic ( ) . WithLocation ( 36 , 1 ) ,
15621563 this . CSharpDiagnostic ( ) . WithLocation ( 44 , 1 ) ,
15631564 this . CSharpDiagnostic ( ) . WithLocation ( 45 , 1 ) ,
15641565 this . CSharpDiagnostic ( ) . WithLocation ( 46 , 1 ) ,
Original file line number Diff line number Diff line change @@ -217,11 +217,13 @@ private static void HandleSwitchStatement(SyntaxNodeAnalysisContext context)
217217 var labels = ImmutableList . CreateBuilder < SwitchLabelSyntax > ( ) ;
218218 var statements = ImmutableList . CreateBuilder < StatementSyntax > ( ) ;
219219 var labeledStatements = ImmutableList . CreateBuilder < StatementSyntax > ( ) ;
220+ var blockStatements = ImmutableList . CreateBuilder < StatementSyntax > ( ) ;
220221 foreach ( SwitchSectionSyntax switchSection in switchStatement . Sections )
221222 {
222223 labels . AddRange ( switchSection . Labels ) ;
223224 if ( switchSection . Statements . Count == 1 && switchSection . Statements [ 0 ] . IsKind ( SyntaxKind . Block ) )
224225 {
226+ blockStatements . Add ( switchSection . Statements [ 0 ] ) ;
225227 continue ;
226228 }
227229
@@ -241,6 +243,7 @@ private static void HandleSwitchStatement(SyntaxNodeAnalysisContext context)
241243 CheckElements ( context , labels . ToImmutable ( ) ) ;
242244 CheckElements ( context , statements . ToImmutable ( ) ) ;
243245 CheckElements ( context , labeledStatements . ToImmutable ( ) ) ;
246+ CheckElements ( context , blockStatements . ToImmutable ( ) ) ;
244247 }
245248
246249 private static void HandleInitializerExpression ( SyntaxNodeAnalysisContext context )
You can’t perform that action at this time.
0 commit comments