82 references to Statement
Microsoft.CodeAnalysis.CSharp (11)
_generated\0\Syntax.xml.Main.Generated.cs (1)
1927
=> node.Update(VisitList(node.AttributeLists), VisitToken(node.IfKeyword), VisitToken(node.OpenParenToken), (ExpressionSyntax?)Visit(node.Condition) ?? throw new ArgumentNullException("condition"), VisitToken(node.CloseParenToken), (StatementSyntax?)Visit(node.
Statement
) ?? throw new ArgumentNullException("statement"), (ElseClauseSyntax?)Visit(node.Else));
_generated\2\Syntax.xml.Syntax.Generated.cs (7)
8418
if (attributeLists != this.AttributeLists || ifKeyword != this.IfKeyword || openParenToken != this.OpenParenToken || condition != this.Condition || closeParenToken != this.CloseParenToken || statement != this.
Statement
|| @else != this.Else)
8429
public new IfStatementSyntax WithAttributeLists(SyntaxList<AttributeListSyntax> attributeLists) => Update(attributeLists, this.IfKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, this.
Statement
, this.Else);
8430
public IfStatementSyntax WithIfKeyword(SyntaxToken ifKeyword) => Update(this.AttributeLists, ifKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, this.
Statement
, this.Else);
8431
public IfStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.AttributeLists, this.IfKeyword, openParenToken, this.Condition, this.CloseParenToken, this.
Statement
, this.Else);
8432
public IfStatementSyntax WithCondition(ExpressionSyntax condition) => Update(this.AttributeLists, this.IfKeyword, this.OpenParenToken, condition, this.CloseParenToken, this.
Statement
, this.Else);
8433
public IfStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.AttributeLists, this.IfKeyword, this.OpenParenToken, this.Condition, closeParenToken, this.
Statement
, this.Else);
8435
public IfStatementSyntax WithElse(ElseClauseSyntax? @else) => Update(this.AttributeLists, this.IfKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, this.
Statement
, @else);
Binder\Binder_Statements.cs (1)
2591
var consequence = binder.BindPossibleEmbeddedStatement(node.
Statement
, diagnostics);
Binder\LocalBinderFactory.cs (1)
820
VisitPossibleEmbeddedStatement(node.
Statement
, enclosing);
Syntax\LookupPosition.cs (1)
460
return GetFirstExcludedToken(ifStmt.
Statement
);
Microsoft.CodeAnalysis.CSharp.CodeStyle (16)
src\roslyn\src\Analyzers\CSharp\Analyzers\AddBraces\CSharpAddBracesDiagnosticAnalyzer.cs (2)
199
if (statement is IfStatementSyntax ifStatement && ifStatement.
Statement
== embeddedStatement)
292
if (statement.
Statement
.IsKind(SyntaxKind.Block))
src\roslyn\src\Analyzers\CSharp\Analyzers\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessAnalyzer.cs (1)
67
var innerStatement = ifStatement.
Statement
;
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCoalesceExpression\CSharpUseCoalesceExpressionForIfNullStatementCheckDiagnosticAnalyzer.cs (2)
59
whenTrueStatement = ifStatement.
Statement
is BlockSyntax { Statements.Count: 1 } block
61
: ifStatement.
Statement
;
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionInitializer\CSharpUpdateExpressionSyntaxHelper.cs (1)
42
whenTrueStatements = ExtractEmbeddedStatements(ifStatement.
Statement
);
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCompoundAssignment\CSharpUseCompoundCoalesceAssignmentDiagnosticAnalyzer.cs (2)
104
whenTrue = ifStatement.
Statement
is BlockSyntax block
106
: ifStatement.
Statement
;
src\roslyn\src\Analyzers\CSharp\Analyzers\UseNullPropagation\CSharpUseNullPropagationDiagnosticAnalyzer.cs (3)
99
trueStatements = ifStatement.
Statement
is BlockSyntax block
101
: [ifStatement.
Statement
];
113
if (ifStatement.
Statement
.ContainsDirectives)
src\roslyn\src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.Analyzer.cs (2)
177
: ifStatement.
Statement
;
208
!_semanticModel.AnalyzeRequiredControlFlow(ifStatement.
Statement
).EndPointIsReachable)
src\roslyn\src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpIsAndCastCheckDiagnosticAnalyzer.cs (1)
176
if (ifStatement.
Statement
is not BlockSyntax block)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs (1)
138
IfStatementSyntax n => n.
Statement
,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SuppressFormattingRule.cs (1)
40
AddSuppressWrappingIfOnSingleLineOperation(list, ifStatementNode.IfKeyword, ifStatementNode.
Statement
.GetLastToken(includeZeroWidth: true));
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (6)
src\roslyn\src\Analyzers\CSharp\CodeFixes\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessCodeFixProvider.cs (1)
97
ifStatement.
Statement
is BlockSyntax block)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpCollectionExpressionRewriter.cs (2)
566
var trueStatement = (ExpressionStatementSyntax)UnwrapEmbeddedStatement(ifStatement.
Statement
);
852
yield return UnwrapEmbeddedStatement(ifStatement.
Statement
);
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseConditionalExpression\CSharpUseConditionalExpressionForAssignmentCodeFixProvider.cs (1)
48
ifStatement.
Statement
is BlockSyntax block)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseConditionalExpression\CSharpUseConditionalExpressionForReturnCodeFixProvider.cs (1)
35
ifStatement.
Statement
is BlockSyntax block)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseNullPropagation\CSharpUseNullPropagationCodeFixProvider.cs (1)
44
if (ifStatement.
Statement
is BlockSyntax block)
Microsoft.CodeAnalysis.CSharp.Features (40)
Completion\KeywordRecommenders\ElseKeywordRecommender.cs (1)
36
if (ifStatement.
Statement
.GetLastToken(includeZeroWidth: true) == token)
ConvertIfToSwitch\CSharpConvertIfToSwitchCodeRefactoringProvider.Rewriting.cs (1)
70
var block = ifStatement.
Statement
as BlockSyntax;
ConvertLinq\ConvertForEachToLinqQuery\CSharpConvertForEachToLinqQueryProvider.cs (1)
114
current = ifStatement.
Statement
;
Debugging\CSharpProximityExpressionsService.Worker.cs (1)
260
AddLastStatementOfConstruct(ifStatement.
Statement
);
EditAndContinue\SyntaxComparer.cs (2)
882
distance = ComputeWeightedDistance(leftIf.Condition, leftIf.
Statement
, rightIf.Condition, rightIf.
Statement
);
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.CallSiteContainerRewriter.cs (1)
174
.WithStatement(ReplaceStatementIfNeeded(node.
Statement
))
InvertIf\CSharpInvertIfCodeRefactoringProvider.cs (4)
51
=> new(ifNode.
Statement
, ifNode.
Statement
);
66
=> ifNode.
Statement
;
210
return originalIfStatement.
Statement
is BlockSyntax block
Snippets\CSharpElseSnippetProvider.cs (1)
47
if (ifStatement.
Statement
.GetLastToken(includeZeroWidth: true) == token)
Snippets\CSharpIfSnippetProvider.cs (2)
36
static s => (BlockSyntax)s.
Statement
,
43
static s => (BlockSyntax)s.
Statement
,
SplitOrMergeIfStatements\CSharpIfLikeStatementGenerator.cs (3)
122
return ifStatement.WithStatement(otherIfStatement.
Statement
);
149
newIfStatement = newIfStatement.WithStatement(Block(newIfStatement.
Statement
));
169
for (var statement = ifStatement.
Statement
; statement.IsEmbeddedStatementOwner(); statement = statement.GetEmbeddedStatement())
SplitOrMergeIfStatements\CSharpMergeConsecutiveIfStatementsCodeRefactoringProvider.cs (2)
39
span.IsAround(ifStatement.IfKeyword, ifStatement.
Statement
))
53
span.IsAround(elseClause.ElseKeyword, elseIfStatement.
Statement
))
src\roslyn\src\Analyzers\CSharp\Analyzers\AddBraces\CSharpAddBracesDiagnosticAnalyzer.cs (2)
199
if (statement is IfStatementSyntax ifStatement && ifStatement.
Statement
== embeddedStatement)
292
if (statement.
Statement
.IsKind(SyntaxKind.Block))
src\roslyn\src\Analyzers\CSharp\Analyzers\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessAnalyzer.cs (1)
67
var innerStatement = ifStatement.
Statement
;
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCoalesceExpression\CSharpUseCoalesceExpressionForIfNullStatementCheckDiagnosticAnalyzer.cs (2)
59
whenTrueStatement = ifStatement.
Statement
is BlockSyntax { Statements.Count: 1 } block
61
: ifStatement.
Statement
;
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionInitializer\CSharpUpdateExpressionSyntaxHelper.cs (1)
42
whenTrueStatements = ExtractEmbeddedStatements(ifStatement.
Statement
);
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCompoundAssignment\CSharpUseCompoundCoalesceAssignmentDiagnosticAnalyzer.cs (2)
104
whenTrue = ifStatement.
Statement
is BlockSyntax block
106
: ifStatement.
Statement
;
src\roslyn\src\Analyzers\CSharp\Analyzers\UseNullPropagation\CSharpUseNullPropagationDiagnosticAnalyzer.cs (3)
99
trueStatements = ifStatement.
Statement
is BlockSyntax block
101
: [ifStatement.
Statement
];
113
if (ifStatement.
Statement
.ContainsDirectives)
src\roslyn\src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.Analyzer.cs (2)
177
: ifStatement.
Statement
;
208
!_semanticModel.AnalyzeRequiredControlFlow(ifStatement.
Statement
).EndPointIsReachable)
src\roslyn\src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpIsAndCastCheckDiagnosticAnalyzer.cs (1)
176
if (ifStatement.
Statement
is not BlockSyntax block)
src\roslyn\src\Analyzers\CSharp\CodeFixes\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessCodeFixProvider.cs (1)
97
ifStatement.
Statement
is BlockSyntax block)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpCollectionExpressionRewriter.cs (2)
566
var trueStatement = (ExpressionStatementSyntax)UnwrapEmbeddedStatement(ifStatement.
Statement
);
852
yield return UnwrapEmbeddedStatement(ifStatement.
Statement
);
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseConditionalExpression\CSharpUseConditionalExpressionForAssignmentCodeFixProvider.cs (1)
48
ifStatement.
Statement
is BlockSyntax block)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseConditionalExpression\CSharpUseConditionalExpressionForReturnCodeFixProvider.cs (1)
35
ifStatement.
Statement
is BlockSyntax block)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseNullPropagation\CSharpUseNullPropagationCodeFixProvider.cs (1)
44
if (ifStatement.
Statement
is BlockSyntax block)
Structure\Providers\BlockSyntaxStructureProvider.cs (1)
49
elseStatement = nextIfStatement.
Statement
;
Microsoft.CodeAnalysis.CSharp.NetAnalyzers (4)
Microsoft.NetCore.Analyzers\Performance\CSharpDoNotGuardCall.Fixer.cs (2)
35
: ifStatementSyntax.
Statement
.ChildNodes().Count() == 1;
52
.WithStatement(guardedCallInElse ? ifStatementSyntax.
Statement
: ifStatementSyntax.Else.Statement)
Microsoft.NetCore.Analyzers\Performance\CSharpPreferDictionaryTryMethodsOverContainsKeyGuardFixer.cs (2)
233
if (ifStatement.
Statement
is BlockSyntax { Statements.Count: 1 } or ExpressionStatementSyntax)
247
editor.ReplaceNode(ifStatement.
Statement
, ifStatement.Else.Statement);
Microsoft.CodeAnalysis.CSharp.Workspaces (2)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs (1)
138
IfStatementSyntax n => n.
Statement
,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SuppressFormattingRule.cs (1)
40
AddSuppressWrappingIfOnSingleLineOperation(list, ifStatementNode.IfKeyword, ifStatementNode.
Statement
.GetLastToken(includeZeroWidth: true));
Roslyn.Diagnostics.CSharp.Analyzers (2)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs (1)
138
IfStatementSyntax n => n.
Statement
,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SuppressFormattingRule.cs (1)
40
AddSuppressWrappingIfOnSingleLineOperation(list, ifStatementNode.IfKeyword, ifStatementNode.
Statement
.GetLastToken(includeZeroWidth: true));
System.Private.CoreLib.Generators (1)
IntrinsicsInSystemPrivateCoreLibAnalyzer.cs (1)
586
if (HandleConditionalCase(ifStatement.Condition, ifStatement.
Statement
, ifStatement.Else))