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