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