75 references to Statements
Microsoft.CodeAnalysis.CSharp (10)
Binder\LocalBinderFactory.cs (1)
772
foreach (StatementSyntax statement in node.
Statements
)
Binder\SwitchBinder.cs (3)
140
builder.AddRange(BuildLocals(section.
Statements
, GetBinder(section)));
152
builder.AddRange(BuildLocalFunctions(section.
Statements
));
186
BuildLabels(section.
Statements
, ref labels);
Binder\SwitchBinder_Patterns.cs (2)
200
var boundStatementsBuilder = ArrayBuilder<BoundStatement>.GetInstance(node.
Statements
.Count);
201
foreach (StatementSyntax statement in node.
Statements
)
Syntax.xml.Main.Generated.cs (1)
1924
=> node.Update(VisitList(node.Labels), VisitList(node.
Statements
));
Syntax.xml.Syntax.Generated.cs (3)
8606
if (labels != this.Labels || statements != this.
Statements
)
8616
public SwitchSectionSyntax WithLabels(SyntaxList<SwitchLabelSyntax> labels) => Update(labels, this.
Statements
);
8620
public SwitchSectionSyntax AddStatements(params StatementSyntax[] items) => WithStatements(this.
Statements
.AddRange(items));
Microsoft.CodeAnalysis.CSharp.CodeStyle (9)
src\Analyzers\CSharp\Analyzers\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionDiagnosticAnalyzer.Analyzer.cs (4)
221
switch (section.
Statements
.Count)
224
case 2 when section.
Statements
[1].IsKind(SyntaxKind.BreakStatement) || section.
Statements
[0].IsKind(SyntaxKind.SwitchStatement):
225
return Visit(section.
Statements
[0]);
src\Analyzers\CSharp\Analyzers\RemoveUnreachableCode\RemoveUnreachableCodeHelpers.cs (1)
23
siblingStatements = [.. switchSection.
Statements
];
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\IndentBlockFormattingRule.cs (3)
83
section.
Statements
.Count == 0)
100
var firstStatementIsBlock = section.
Statements
is [(kind: SyntaxKind.Block), ..];
112
if (section.
Statements
is not ([var firstStatement, ..] and [.., var lastStatement]))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpBlockFacts.cs (1)
41
SwitchSectionSyntax switchSection => switchSection.
Statements
,
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (7)
src\Analyzers\CSharp\CodeFixes\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.Rewriter.cs (3)
127
expression: RewriteStatements(node.
Statements
));
227
tokensForTrailingTrivia: new[] { s.
Statements
[0].GetFirstToken(), s.
Statements
[0].GetLastToken() },
src\Analyzers\CSharp\CodeFixes\RemoveUnusedParametersAndValues\CSharpRemoveUnusedValuesCodeFixProvider.cs (1)
170
var firstStatement = switchCaseBlock.
Statements
.FirstOrDefault();
src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpAsAndNullCheckCodeFixProvider.cs (1)
65
: ((SwitchSectionSyntax)newParentScope).
Statements
.First();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTokenExtensions.cs (1)
415
foreach (var statement in section.
Statements
)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Indentation\CSharpIndentationService.cs (1)
174
if (node is not SwitchSectionSyntax {
Statements
: [var firstStatement, ..] and [.., var lastStatement] })
Microsoft.CodeAnalysis.CSharp.Features (22)
Debugging\CSharpProximityExpressionsService.Worker.cs (1)
274
AddLastStatementOfConstruct(section.
Statements
.LastOrDefault());
EditAndContinue\BreakpointSpans.cs (2)
556
if (switchLabel.Parent is not SwitchSectionSyntax switchSection || switchSection.
Statements
.Count == 0)
561
return TryCreateSpanForNode(switchSection.
Statements
[0], position);
EditAndContinue\SyntaxComparer.cs (2)
767
&& SyntaxFactory.AreEquivalent(left.
Statements
, right.
Statements
, ignoreChildNode: HasLabel);
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.CallSiteContainerRewriter.cs (1)
142
return node.WithStatements([.. VisitList(ReplaceStatements(node.
Statements
))]);
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.MultipleStatementsCodeGenerator.cs (1)
74
SwitchSectionSyntax switchSectionNode => switchSectionNode.
Statements
,
IntroduceUsingStatement\CSharpIntroduceUsingStatementCodeRefactoringProvider.cs (1)
48
SwitchSectionSyntax switchSection => switchSection.
Statements
,
IntroduceVariable\CSharpIntroduceVariableService_IntroduceLocal.cs (1)
536
SwitchSectionSyntax switchSection => switchSection.
Statements
,
InvertIf\CSharpInvertIfCodeRefactoringProvider.cs (1)
89
SwitchSectionSyntax n => n.
Statements
,
src\Analyzers\CSharp\Analyzers\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionDiagnosticAnalyzer.Analyzer.cs (4)
221
switch (section.
Statements
.Count)
224
case 2 when section.
Statements
[1].IsKind(SyntaxKind.BreakStatement) || section.
Statements
[0].IsKind(SyntaxKind.SwitchStatement):
225
return Visit(section.
Statements
[0]);
src\Analyzers\CSharp\Analyzers\RemoveUnreachableCode\RemoveUnreachableCodeHelpers.cs (1)
23
siblingStatements = [.. switchSection.
Statements
];
src\Analyzers\CSharp\CodeFixes\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.Rewriter.cs (3)
127
expression: RewriteStatements(node.
Statements
));
227
tokensForTrailingTrivia: new[] { s.
Statements
[0].GetFirstToken(), s.
Statements
[0].GetLastToken() },
src\Analyzers\CSharp\CodeFixes\RemoveUnusedParametersAndValues\CSharpRemoveUnusedValuesCodeFixProvider.cs (1)
170
var firstStatement = switchCaseBlock.
Statements
.FirstOrDefault();
src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpAsAndNullCheckCodeFixProvider.cs (1)
65
: ((SwitchSectionSyntax)newParentScope).
Statements
.First();
Structure\Providers\SwitchStatementStructureProvider.cs (2)
30
if (section.Labels.Count > 0 && section.
Statements
.Count > 0)
33
var end = section.
Statements
.Last().Span.End;
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (15)
Generated\Syntax.Test.xml.Generated.cs (2)
12814
Assert.Equal(default, node.
Statements
);
12815
var newNode = node.WithLabels(node.Labels).WithStatements(node.
Statements
);
Parsing\StatementParsingTests.cs (13)
2169
Assert.Equal(1, ss.Sections[0].
Statements
.Count);
2170
Assert.Equal(";", ss.Sections[0].
Statements
[0].ToString());
2205
Assert.Equal(1, ss.Sections[0].
Statements
.Count);
2206
Assert.Equal(";", ss.Sections[0].
Statements
[0].ToString());
2216
Assert.Equal(1, ss.Sections[1].
Statements
.Count);
2217
Assert.Equal(";", ss.Sections[0].
Statements
[0].ToString());
2249
Assert.Equal(1, ss.Sections[0].
Statements
.Count);
2250
Assert.Equal(";", ss.Sections[0].
Statements
[0].ToString());
2291
Assert.Equal(1, ss.Sections[0].
Statements
.Count);
2292
Assert.Equal(";", ss.Sections[0].
Statements
[0].ToString());
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)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\IndentBlockFormattingRule.cs (3)
83
section.
Statements
.Count == 0)
100
var firstStatementIsBlock = section.
Statements
is [(kind: SyntaxKind.Block), ..];
112
if (section.
Statements
is not ([var firstStatement, ..] and [.., var lastStatement]))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpBlockFacts.cs (1)
41
SwitchSectionSyntax switchSection => switchSection.
Statements
,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTokenExtensions.cs (1)
415
foreach (var statement in section.
Statements
)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Indentation\CSharpIndentationService.cs (1)
174
if (node is not SwitchSectionSyntax {
Statements
: [var firstStatement, ..] and [.., var lastStatement] })
Roslyn.Diagnostics.CSharp.Analyzers (6)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\IndentBlockFormattingRule.cs (3)
83
section.
Statements
.Count == 0)
100
var firstStatementIsBlock = section.
Statements
is [(kind: SyntaxKind.Block), ..];
112
if (section.
Statements
is not ([var firstStatement, ..] and [.., var lastStatement]))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpBlockFacts.cs (1)
41
SwitchSectionSyntax switchSection => switchSection.
Statements
,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTokenExtensions.cs (1)
415
foreach (var statement in section.
Statements
)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Indentation\CSharpIndentationService.cs (1)
174
if (node is not SwitchSectionSyntax {
Statements
: [var firstStatement, ..] and [.., var lastStatement] })