100 references to Sections
Microsoft.CodeAnalysis.CSharp (18)
Binder\LocalBinderFactory.cs (1)
738
foreach (SwitchSectionSyntax section in node.
Sections
)
Binder\SwitchBinder.cs (3)
138
foreach (var section in SwitchSyntax.
Sections
)
150
foreach (var section in SwitchSyntax.
Sections
)
180
foreach (var section in SwitchSyntax.
Sections
)
Binder\SwitchBinder_Patterns.cs (3)
33
if (node.
Sections
.Count == 0)
166
var boundSwitchSectionsBuilder = ArrayBuilder<BoundSwitchSection>.GetInstance(SwitchSyntax.
Sections
.Count);
168
foreach (SwitchSectionSyntax sectionSyntax in SwitchSyntax.
Sections
)
FlowAnalysis\AbstractFlowPass_Switch.cs (1)
106
foreach (var sectionSyntax in ((SwitchStatementSyntax)node.Syntax).
Sections
)
Syntax.xml.Main.Generated.cs (1)
1921
=> node.Update(VisitList(node.AttributeLists), VisitToken(node.SwitchKeyword), VisitToken(node.OpenParenToken), (ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression"), VisitToken(node.CloseParenToken), VisitToken(node.OpenBraceToken), VisitList(node.
Sections
), VisitToken(node.CloseBraceToken));
Syntax.xml.Syntax.Generated.cs (9)
8533
if (attributeLists != this.AttributeLists || switchKeyword != this.SwitchKeyword || openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken || openBraceToken != this.OpenBraceToken || sections != this.
Sections
|| closeBraceToken != this.CloseBraceToken)
8544
public new SwitchStatementSyntax WithAttributeLists(SyntaxList<AttributeListSyntax> attributeLists) => Update(attributeLists, this.SwitchKeyword, this.OpenParenToken, this.Expression, this.CloseParenToken, this.OpenBraceToken, this.
Sections
, this.CloseBraceToken);
8545
public SwitchStatementSyntax WithSwitchKeyword(SyntaxToken switchKeyword) => Update(this.AttributeLists, switchKeyword, this.OpenParenToken, this.Expression, this.CloseParenToken, this.OpenBraceToken, this.
Sections
, this.CloseBraceToken);
8546
public SwitchStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.AttributeLists, this.SwitchKeyword, openParenToken, this.Expression, this.CloseParenToken, this.OpenBraceToken, this.
Sections
, this.CloseBraceToken);
8547
public SwitchStatementSyntax WithExpression(ExpressionSyntax expression) => Update(this.AttributeLists, this.SwitchKeyword, this.OpenParenToken, expression, this.CloseParenToken, this.OpenBraceToken, this.
Sections
, this.CloseBraceToken);
8548
public SwitchStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.AttributeLists, this.SwitchKeyword, this.OpenParenToken, this.Expression, closeParenToken, this.OpenBraceToken, this.
Sections
, this.CloseBraceToken);
8549
public SwitchStatementSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(this.AttributeLists, this.SwitchKeyword, this.OpenParenToken, this.Expression, this.CloseParenToken, openBraceToken, this.
Sections
, this.CloseBraceToken);
8551
public SwitchStatementSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.AttributeLists, this.SwitchKeyword, this.OpenParenToken, this.Expression, this.CloseParenToken, this.OpenBraceToken, this.
Sections
, closeBraceToken);
8555
public SwitchStatementSyntax AddSections(params SwitchSectionSyntax[] items) => WithSections(this.
Sections
.AddRange(items));
Microsoft.CodeAnalysis.CSharp.CodeStyle (5)
src\Analyzers\CSharp\Analyzers\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionDiagnosticAnalyzer.Analyzer.cs (2)
110
var sections = switchStatement.
Sections
;
179
if (switchStatement.
Sections
.Any(section => section.Labels.Any(label => IsDefaultSwitchLabel(label))))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\IndentBlockFormattingRule.cs (1)
110
var lastSection = switchStatement.
Sections
.Last() == node;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\SpeculationAnalyzer.cs (2)
470
var originalSwitchLabels = originalSwitchStatement.
Sections
.SelectMany(section => section.Labels).ToArray();
471
var newSwitchLabels = newSwitchStatement.
Sections
.SelectMany(section => section.Labels).ToArray();
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (3)
src\Analyzers\CSharp\CodeFixes\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.Rewriter.cs (2)
222
var switchArms = node.
Sections
271
node.
Sections
, node.CloseBraceToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (1)
2132
if (switchStatement.
Sections
.SelectMany(ss => ss.Labels)
Microsoft.CodeAnalysis.CSharp.Features (10)
Debugging\CSharpProximityExpressionsService.Worker.cs (1)
272
foreach (var section in switchStatement.
Sections
)
EditAndContinue\CSharpEditAndContinueAnalyzer.cs (3)
852
var hasDecitionTree = oldNode.
Sections
.Any(s => s.Labels.Any(l => l is CasePatternSwitchLabelSyntax));
2910
=> oldSwitch.
Sections
.SequenceEqual(newSwitch.
Sections
, AreSwitchSectionsEquivalent);
Highlighting\KeywordHighlighters\SwitchStatementHighlighter.cs (1)
41
foreach (var switchSection in switchStatement.
Sections
)
src\Analyzers\CSharp\Analyzers\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionDiagnosticAnalyzer.Analyzer.cs (2)
110
var sections = switchStatement.
Sections
;
179
if (switchStatement.
Sections
.Any(section => section.Labels.Any(label => IsDefaultSwitchLabel(label))))
src\Analyzers\CSharp\CodeFixes\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.Rewriter.cs (2)
222
var switchArms = node.
Sections
271
node.
Sections
, node.CloseBraceToken);
Structure\Providers\SwitchStatementStructureProvider.cs (1)
28
foreach (var section in node.
Sections
)
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (4)
Compilation\SemanticModelAPITests.cs (2)
1912
var switchLabel = switchStatement.
Sections
[0].Labels[0];
2783
var switchLabel = switchStatement.
Sections
[0].Labels[0] as CaseSwitchLabelSyntax;
Compilation\SemanticModelGetDeclaredSymbolAPITests.cs (2)
718
SwitchLabelSyntax switchLabel = switchStmt.
Sections
[0].Labels[0];
751
SwitchLabelSyntax switchLabel = switchStmt.
Sections
[0].Labels[0];
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (50)
Generated\Syntax.Test.xml.Generated.cs (2)
12802
Assert.Equal(default, node.
Sections
);
12804
var newNode = node.WithAttributeLists(node.AttributeLists).WithSwitchKeyword(node.SwitchKeyword).WithOpenParenToken(node.OpenParenToken).WithExpression(node.Expression).WithCloseParenToken(node.CloseParenToken).WithOpenBraceToken(node.OpenBraceToken).WithSections(node.
Sections
).WithCloseBraceToken(node.CloseBraceToken);
Parsing\StatementParsingTests.cs (48)
2136
Assert.Equal(0, ss.
Sections
.Count);
2160
Assert.Equal(1, ss.
Sections
.Count);
2161
Assert.Equal(1, ss.
Sections
[0].Labels.Count);
2162
Assert.NotEqual(default, ss.
Sections
[0].Labels[0].Keyword);
2163
Assert.Equal(SyntaxKind.CaseKeyword, ss.
Sections
[0].Labels[0].Keyword.Kind());
2164
var caseLabelSyntax = ss.
Sections
[0].Labels[0] as CaseSwitchLabelSyntax;
2169
Assert.Equal(1, ss.
Sections
[0].Statements.Count);
2170
Assert.Equal(";", ss.
Sections
[0].Statements[0].ToString());
2195
Assert.Equal(2, ss.
Sections
.Count);
2197
Assert.Equal(1, ss.
Sections
[0].Labels.Count);
2198
Assert.NotEqual(default, ss.
Sections
[0].Labels[0].Keyword);
2199
Assert.Equal(SyntaxKind.CaseKeyword, ss.
Sections
[0].Labels[0].Keyword.Kind());
2200
var caseLabelSyntax = ss.
Sections
[0].Labels[0] as CaseSwitchLabelSyntax;
2205
Assert.Equal(1, ss.
Sections
[0].Statements.Count);
2206
Assert.Equal(";", ss.
Sections
[0].Statements[0].ToString());
2208
Assert.Equal(1, ss.
Sections
[1].Labels.Count);
2209
Assert.NotEqual(default, ss.
Sections
[1].Labels[0].Keyword);
2210
Assert.Equal(SyntaxKind.CaseKeyword, ss.
Sections
[1].Labels[0].Keyword.Kind());
2211
var caseLabelSyntax2 = ss.
Sections
[1].Labels[0] as CaseSwitchLabelSyntax;
2216
Assert.Equal(1, ss.
Sections
[1].Statements.Count);
2217
Assert.Equal(";", ss.
Sections
[0].Statements[0].ToString());
2242
Assert.Equal(1, ss.
Sections
.Count);
2244
Assert.Equal(1, ss.
Sections
[0].Labels.Count);
2245
Assert.NotEqual(default, ss.
Sections
[0].Labels[0].Keyword);
2246
Assert.Equal(SyntaxKind.DefaultKeyword, ss.
Sections
[0].Labels[0].Keyword.Kind());
2247
Assert.Equal(SyntaxKind.DefaultSwitchLabel, ss.
Sections
[0].Labels[0].Kind());
2248
Assert.NotEqual(default, ss.
Sections
[0].Labels[0].ColonToken);
2249
Assert.Equal(1, ss.
Sections
[0].Statements.Count);
2250
Assert.Equal(";", ss.
Sections
[0].Statements[0].ToString());
2275
Assert.Equal(1, ss.
Sections
.Count);
2277
Assert.Equal(2, ss.
Sections
[0].Labels.Count);
2278
Assert.NotEqual(default, ss.
Sections
[0].Labels[0].Keyword);
2279
Assert.Equal(SyntaxKind.CaseKeyword, ss.
Sections
[0].Labels[0].Keyword.Kind());
2280
var caseLabelSyntax = ss.
Sections
[0].Labels[0] as CaseSwitchLabelSyntax;
2284
Assert.NotEqual(default, ss.
Sections
[0].Labels[1].Keyword);
2285
Assert.Equal(SyntaxKind.CaseKeyword, ss.
Sections
[0].Labels[1].Keyword.Kind());
2286
var caseLabelSyntax2 = ss.
Sections
[0].Labels[1] as CaseSwitchLabelSyntax;
2290
Assert.NotEqual(default, ss.
Sections
[0].Labels[0].ColonToken);
2291
Assert.Equal(1, ss.
Sections
[0].Statements.Count);
2292
Assert.Equal(";", ss.
Sections
[0].Statements[0].ToString());
2317
Assert.Equal(1, ss.
Sections
.Count);
2319
Assert.Equal(1, ss.
Sections
[0].Labels.Count);
2320
Assert.NotEqual(default, ss.
Sections
[0].Labels[0].Keyword);
2321
Assert.Equal(SyntaxKind.CaseKeyword, ss.
Sections
[0].Labels[0].Keyword.Kind());
2322
var caseLabelSyntax = ss.
Sections
[0].Labels[0] as CaseSwitchLabelSyntax;
2326
Assert.Equal(2, ss.
Sections
[0].Statements.Count);
2327
Assert.Equal("s1();", ss.
Sections
[0].Statements[0].ToString());
2328
Assert.Equal("s2();", ss.
Sections
[0].Statements[1].ToString());
Microsoft.CodeAnalysis.CSharp.Workspaces (6)
CodeGeneration\CSharpSyntaxGenerator.cs (2)
2325
return statement?.
Sections
?? [];
2335
var newSections = statement.
Sections
.InsertRange(index, switchSections.Cast<SwitchSectionSyntax>());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\IndentBlockFormattingRule.cs (1)
110
var lastSection = switchStatement.
Sections
.Last() == node;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\SpeculationAnalyzer.cs (2)
470
var originalSwitchLabels = originalSwitchStatement.
Sections
.SelectMany(section => section.Labels).ToArray();
471
var newSwitchLabels = newSwitchStatement.
Sections
.SelectMany(section => section.Labels).ToArray();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (1)
2132
if (switchStatement.
Sections
.SelectMany(ss => ss.Labels)
Roslyn.Diagnostics.CSharp.Analyzers (4)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\IndentBlockFormattingRule.cs (1)
110
var lastSection = switchStatement.
Sections
.Last() == node;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\SpeculationAnalyzer.cs (2)
470
var originalSwitchLabels = originalSwitchStatement.
Sections
.SelectMany(section => section.Labels).ToArray();
471
var newSwitchLabels = newSwitchStatement.
Sections
.SelectMany(section => section.Labels).ToArray();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (1)
2132
if (switchStatement.
Sections
.SelectMany(ss => ss.Labels)