40 references to IfKeyword
Microsoft.CodeAnalysis.CSharp (10)
Lowering\Instrumentation\DebugInfoInjector.cs (1)
365
syntax.
IfKeyword
.SpanStart,
Syntax.xml.Main.Generated.cs (1)
1915
=> 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));
Syntax.xml.Syntax.Generated.cs (7)
8372
if (attributeLists != this.AttributeLists || ifKeyword != this.
IfKeyword
|| openParenToken != this.OpenParenToken || condition != this.Condition || closeParenToken != this.CloseParenToken || statement != this.Statement || @else != this.Else)
8383
public new IfStatementSyntax WithAttributeLists(SyntaxList<AttributeListSyntax> attributeLists) => Update(attributeLists, this.
IfKeyword
, this.OpenParenToken, this.Condition, this.CloseParenToken, this.Statement, this.Else);
8385
public IfStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.AttributeLists, this.
IfKeyword
, openParenToken, this.Condition, this.CloseParenToken, this.Statement, this.Else);
8386
public IfStatementSyntax WithCondition(ExpressionSyntax condition) => Update(this.AttributeLists, this.
IfKeyword
, this.OpenParenToken, condition, this.CloseParenToken, this.Statement, this.Else);
8387
public IfStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.AttributeLists, this.
IfKeyword
, this.OpenParenToken, this.Condition, closeParenToken, this.Statement, this.Else);
8388
public IfStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.
IfKeyword
, this.OpenParenToken, this.Condition, this.CloseParenToken, statement, this.Else);
8389
public IfStatementSyntax WithElse(ElseClauseSyntax? @else) => Update(this.AttributeLists, this.
IfKeyword
, this.OpenParenToken, this.Condition, this.CloseParenToken, this.Statement, @else);
Syntax\LookupPosition.cs (1)
343
return ((IfStatementSyntax)statement).
IfKeyword
;
Microsoft.CodeAnalysis.CSharp.CodeStyle (2)
src\Analyzers\CSharp\Analyzers\UseCompoundAssignment\CSharpUseCompoundCoalesceAssignmentDiagnosticAnalyzer.cs (1)
165
ifStatement.
IfKeyword
.GetLocation(),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SuppressFormattingRule.cs (1)
40
AddSuppressWrappingIfOnSingleLineOperation(list, ifStatementNode.
IfKeyword
, ifStatementNode.Statement.GetLastToken(includeZeroWidth: true));
Microsoft.CodeAnalysis.CSharp.Features (16)
ConvertIfToSwitch\CSharpConvertIfToSwitchCodeRefactoringProvider.Rewriting.cs (1)
72
SwitchKeyword.WithTriviaFrom(ifStatement.
IfKeyword
),
ConvertLinq\ConvertForEachToLinqQuery\AbstractConverter.cs (3)
87
.WithCommentsFrom(ifStatement.
IfKeyword
.LeadingTrivia, ifStatement.
IfKeyword
.TrailingTrivia),
277
.WithCommentsFrom(ifStatement.
IfKeyword
.GetAllTrivia().Concat(node.ExtraLeadingComments), node.ExtraTrailingComments);
EditAndContinue\CSharpEditAndContinueAnalyzer.cs (1)
1794
return TextSpan.FromBounds(ifStatement.
IfKeyword
.SpanStart, ifStatement.CloseParenToken.Span.End);
Highlighting\KeywordHighlighters\IfStatementHighlighter.cs (4)
43
highlights.Add(ifStatement.
IfKeyword
.Span);
53
if (OnlySpacesBetween(elseKeyword, elseIfStatement.
IfKeyword
))
58
elseIfStatement.
IfKeyword
.Span.End));
64
highlights.Add(elseIfStatement.
IfKeyword
.Span);
SplitOrMergeIfStatements\CSharpMergeConsecutiveIfStatementsCodeRefactoringProvider.cs (3)
37
span.IsAround(ifStatement.
IfKeyword
) ||
38
span.IsAround(ifStatement.
IfKeyword
, ifStatement.CloseParenToken) ||
39
span.IsAround(ifStatement.
IfKeyword
, ifStatement.Statement))
SplitOrMergeIfStatements\CSharpMergeNestedIfStatementsCodeRefactoringProvider.cs (3)
37
span.IsAround(ifStatement.
IfKeyword
) ||
38
span.IsAround(ifStatement.
IfKeyword
, ifStatement.CloseParenToken) ||
39
span.IsAround(ifStatement.
IfKeyword
, ifStatement))
src\Analyzers\CSharp\Analyzers\UseCompoundAssignment\CSharpUseCompoundCoalesceAssignmentDiagnosticAnalyzer.cs (1)
165
ifStatement.
IfKeyword
.GetLocation(),
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (10)
Generated\Syntax.Test.xml.Generated.cs (2)
12770
Assert.Equal(SyntaxKind.IfKeyword, node.
IfKeyword
.Kind());
12776
var newNode = node.WithAttributeLists(node.AttributeLists).WithIfKeyword(node.
IfKeyword
).WithOpenParenToken(node.OpenParenToken).WithCondition(node.Condition).WithCloseParenToken(node.CloseParenToken).WithStatement(node.Statement).WithElse(node.Else);
Parsing\StatementParsingTests.cs (8)
2023
Assert.NotEqual(default, ss.
IfKeyword
);
2024
Assert.Equal(SyntaxKind.IfKeyword, ss.
IfKeyword
.Kind());
2046
Assert.NotEqual(default, ss.
IfKeyword
);
2047
Assert.Equal(SyntaxKind.IfKeyword, ss.
IfKeyword
.Kind());
2072
Assert.NotEqual(default, ss.
IfKeyword
);
2073
Assert.Equal(SyntaxKind.IfKeyword, ss.
IfKeyword
.Kind());
2086
Assert.NotEqual(default, subIf.
IfKeyword
);
2087
Assert.Equal(SyntaxKind.IfKeyword, subIf.
IfKeyword
.Kind());
Microsoft.CodeAnalysis.CSharp.Workspaces (1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SuppressFormattingRule.cs (1)
40
AddSuppressWrappingIfOnSingleLineOperation(list, ifStatementNode.
IfKeyword
, ifStatementNode.Statement.GetLastToken(includeZeroWidth: true));
Roslyn.Diagnostics.CSharp.Analyzers (1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SuppressFormattingRule.cs (1)
40
AddSuppressWrappingIfOnSingleLineOperation(list, ifStatementNode.
IfKeyword
, ifStatementNode.Statement.GetLastToken(includeZeroWidth: true));