64 references to Labels
Microsoft.CodeAnalysis.CSharp (10)
_generated\0\Syntax.xml.Main.Generated.cs (1)
1936
=> node.Update(VisitList(node.
Labels
), VisitList(node.Statements));
_generated\2\Syntax.xml.Syntax.Generated.cs (3)
8652
if (labels != this.
Labels
|| statements != this.Statements)
8663
public SwitchSectionSyntax WithStatements(SyntaxList<StatementSyntax> statements) => Update(this.
Labels
, statements);
8665
public SwitchSectionSyntax AddLabels(params SwitchLabelSyntax[] items) => WithLabels(this.
Labels
.AddRange(items));
Binder\ExpressionVariableFinder.cs (1)
139
foreach (SwitchLabelSyntax label in node.
Labels
)
Binder\LocalBinderFactory.cs (1)
749
foreach (SwitchLabelSyntax label in node.
Labels
)
Binder\SwitchBinder.cs (1)
183
BuildSwitchLabels(section.
Labels
, GetBinder(section), labels, BindingDiagnosticBag.Discarded);
Binder\SwitchBinder_Patterns.cs (2)
197
var boundLabelsBuilder = ArrayBuilder<BoundSwitchLabel>.GetInstance(node.
Labels
.Count);
202
foreach (SwitchLabelSyntax labelSyntax in node.
Labels
)
FlowAnalysis\AbstractFlowPass_Switch.cs (1)
108
foreach (var label in sectionSyntax.
Labels
)
Microsoft.CodeAnalysis.CSharp.CodeStyle (12)
src\roslyn\src\Analyzers\CSharp\Analyzers\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionDiagnosticAnalyzer.Analyzer.cs (2)
117
if (!sections.All(s => CanConvertLabelsToArms(s.
Labels
)))
178
if (switchStatement.Sections.Any(section => section.
Labels
.Any(label => IsDefaultSwitchLabel(label))))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\IndentBlockFormattingRule.cs (2)
78
if (section is {
Labels
.Count: 0, Statements.Count: 0 })
110
var lastTokenOfLabel = section.
Labels
.Last().GetLastToken(includeZeroWidth: true);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SuppressFormattingRule.cs (6)
186
if (switchSection.
Labels
.Count < 2)
193
for (var i = 0; i < switchSection.
Labels
.Count - 1; ++i)
194
AddSuppressWrappingIfOnSingleLineOperation(list, switchSection.
Labels
[i].GetFirstToken(includeZeroWidth: true), switchSection.
Labels
[i].GetLastToken());
197
if (switchSection.
Labels
[^1] != null)
198
AddSuppressWrappingIfOnSingleLineOperation(list, switchSection.
Labels
[^1].GetFirstToken(includeZeroWidth: true), switchSection.GetLastToken());
src\roslyn\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 (5)
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.Rewriter.cs (4)
125
pattern: GetPattern(node.
Labels
, out var whenClauseOpt),
224
.OrderBy(section => section.
Labels
.Any(label => IsDefaultSwitchLabel(label)))
226
(tokensForLeadingTrivia: new[] { s.
Labels
[0].GetFirstToken(), s.
Labels
[0].GetLastToken() },
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (1)
2210
if (switchStatement.Sections.SelectMany(ss => ss.
Labels
)
Microsoft.CodeAnalysis.CSharp.Features (15)
EditAndContinue\CSharpEditAndContinueAnalyzer.cs (4)
852
var hasDecitionTree = oldNode.Sections.Any(s => s.
Labels
.Any(l => l is CasePatternSwitchLabelSyntax));
1805
return ((SwitchSectionSyntax)node).
Labels
.Last().Span;
2913
=> oldSection.
Labels
.SequenceEqual(newSection.
Labels
, AreLabelsEquivalent);
EditAndContinue\SyntaxComparer.cs (2)
766
return SyntaxFactory.AreEquivalent(left.
Labels
, right.
Labels
, null)
Highlighting\KeywordHighlighters\SwitchStatementHighlighter.cs (1)
43
foreach (var label in switchSection.
Labels
)
src\roslyn\src\Analyzers\CSharp\Analyzers\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionDiagnosticAnalyzer.Analyzer.cs (2)
117
if (!sections.All(s => CanConvertLabelsToArms(s.
Labels
)))
178
if (switchStatement.Sections.Any(section => section.
Labels
.Any(label => IsDefaultSwitchLabel(label))))
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.Rewriter.cs (4)
125
pattern: GetPattern(node.
Labels
, out var whenClauseOpt),
224
.OrderBy(section => section.
Labels
.Any(label => IsDefaultSwitchLabel(label)))
226
(tokensForLeadingTrivia: new[] { s.
Labels
[0].GetFirstToken(), s.
Labels
[0].GetLastToken() },
Structure\Providers\SwitchStatementStructureProvider.cs (2)
30
if (section.
Labels
.Count > 0 && section.Statements.Count > 0)
32
var start = section.
Labels
.Last().ColonToken.Span.End;
Microsoft.CodeAnalysis.CSharp.Workspaces (11)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\IndentBlockFormattingRule.cs (2)
78
if (section is {
Labels
.Count: 0, Statements.Count: 0 })
110
var lastTokenOfLabel = section.
Labels
.Last().GetLastToken(includeZeroWidth: true);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SuppressFormattingRule.cs (6)
186
if (switchSection.
Labels
.Count < 2)
193
for (var i = 0; i < switchSection.
Labels
.Count - 1; ++i)
194
AddSuppressWrappingIfOnSingleLineOperation(list, switchSection.
Labels
[i].GetFirstToken(includeZeroWidth: true), switchSection.
Labels
[i].GetLastToken());
197
if (switchSection.
Labels
[^1] != null)
198
AddSuppressWrappingIfOnSingleLineOperation(list, switchSection.
Labels
[^1].GetFirstToken(includeZeroWidth: true), switchSection.GetLastToken());
src\roslyn\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\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (1)
2210
if (switchStatement.Sections.SelectMany(ss => ss.
Labels
)
Roslyn.Diagnostics.CSharp.Analyzers (11)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\IndentBlockFormattingRule.cs (2)
78
if (section is {
Labels
.Count: 0, Statements.Count: 0 })
110
var lastTokenOfLabel = section.
Labels
.Last().GetLastToken(includeZeroWidth: true);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SuppressFormattingRule.cs (6)
186
if (switchSection.
Labels
.Count < 2)
193
for (var i = 0; i < switchSection.
Labels
.Count - 1; ++i)
194
AddSuppressWrappingIfOnSingleLineOperation(list, switchSection.
Labels
[i].GetFirstToken(includeZeroWidth: true), switchSection.
Labels
[i].GetLastToken());
197
if (switchSection.
Labels
[^1] != null)
198
AddSuppressWrappingIfOnSingleLineOperation(list, switchSection.
Labels
[^1].GetFirstToken(includeZeroWidth: true), switchSection.GetLastToken());
src\roslyn\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\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (1)
2210
if (switchStatement.Sections.SelectMany(ss => ss.
Labels
)