194 references to ForStatementSyntax
Microsoft.CodeAnalysis.CSharp (22)
Binder\Binder_Deconstruct.cs (3)
50
if (((
ForStatementSyntax
)node.Parent).Initializers.Contains(node))
199
var
loop = (
ForStatementSyntax
)grandParent;
Binder\Binder_Expressions.cs (2)
11006
var
loop = (
ForStatementSyntax
)parent;
Binder\Binder_Statements.cs (2)
88
result = BindFor((
ForStatementSyntax
)node, diagnostics);
2779
internal BoundForStatement BindFor(
ForStatementSyntax
node, BindingDiagnosticBag diagnostics)
Binder\ForLoopBinder.cs (3)
19
private readonly
ForStatementSyntax
_syntax;
21
public ForLoopBinder(Binder enclosing,
ForStatementSyntax
syntax)
69
private BoundForStatement BindForParts(
ForStatementSyntax
node, Binder originalBinder, BindingDiagnosticBag diagnostics)
Binder\LocalBinderFactory.cs (1)
595
public override void VisitForStatement(
ForStatementSyntax
node)
Compilation\MemberSemanticModel.cs (2)
399
var
forStmt = (
ForStatementSyntax
)stmt;
Parser\LanguageParser.cs (1)
9120
private
ForStatementSyntax
ParseForStatement(SyntaxList<AttributeListSyntax> attributes)
Syntax\ForStatementSyntax.cs (3)
11
public
ForStatementSyntax
Update(SyntaxToken forKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, SeparatedSyntaxList<ExpressionSyntax> initializers, SyntaxToken firstSemicolonToken, ExpressionSyntax? condition, SyntaxToken secondSemicolonToken, SeparatedSyntaxList<ExpressionSyntax> incrementors, SyntaxToken closeParenToken, StatementSyntax statement)
20
public static
ForStatementSyntax
ForStatement(VariableDeclarationSyntax? declaration, SeparatedSyntaxList<ExpressionSyntax> initializers, ExpressionSyntax? condition, SeparatedSyntaxList<ExpressionSyntax> incrementors, StatementSyntax statement)
23
public static
ForStatementSyntax
ForStatement(SyntaxToken forKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, SeparatedSyntaxList<ExpressionSyntax> initializers, SyntaxToken firstSemicolonToken, ExpressionSyntax? condition, SyntaxToken secondSemicolonToken, SeparatedSyntaxList<ExpressionSyntax> incrementors, SyntaxToken closeParenToken, StatementSyntax statement)
Syntax\LambdaUtilities.cs (1)
448
SeparatedSyntaxList<ExpressionSyntax> incrementors = ((
ForStatementSyntax
)node.Parent).Incrementors;
Syntax\LookupPosition.cs (2)
337
return ((
ForStatementSyntax
)statement).OpenParenToken.GetNextToken();
400
return GetFirstExcludedToken(((
ForStatementSyntax
)statement).Statement);
Syntax\SyntaxNodeExtensions.cs (2)
127
var
forStmt = (
ForStatementSyntax
)parent;
Microsoft.CodeAnalysis.CSharp.CodeStyle (13)
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.Analyzer.cs (2)
149
var
forStatement = (
ForStatementSyntax
)current;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ParenthesizedExpressionSyntaxExtensions.cs (1)
143
(nodeParent is
ForStatementSyntax
forStatement && forStatement.Condition == node) ||
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs (3)
120
ForStatementSyntax
or
135
ForStatementSyntax
n => n.Statement,
709
ForStatementSyntax
n => (n.OpenParenToken, n.CloseParenToken),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\FormattingHelpers.cs (3)
151
token.Parent is
ForStatementSyntax
forStatement &&
295
ForStatementSyntax
forStatement => forStatement.CloseParenToken.Equals(token),
366
ForStatementSyntax
or
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\ElasticTriviaFormattingRule.cs (1)
454
if (previousToken.Parent is
ForStatementSyntax
)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\IndentBlockFormattingRule.cs (1)
313
if (node is
ForStatementSyntax
forStatement && forStatement.Statement != null && !(forStatement.Statement is BlockSyntax))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SpacingFormattingRule.cs (2)
178
&& IsEmptyForStatement((
ForStatementSyntax
)previousToken.Parent!))
568
private static bool IsEmptyForStatement(
ForStatementSyntax
forStatement)
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (7)
src\Analyzers\CSharp\CodeFixes\UseCompoundAssignment\CSharpUseCompoundAssignmentCodeFixProvider.cs (1)
52
if (currentAssignment.Parent is
ForStatementSyntax
forStatement &&
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs (2)
2517
token.Parent is
ForStatementSyntax
forStatement)
2528
token.Parent is
ForStatementSyntax
forStatement2 &&
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpMoveDeclarationNearReferenceService.cs (1)
37
ForStatementSyntax
or
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (3)
161
ForStatementSyntax
forStatement => InferTypeInForStatement(forStatement, expression),
228
ForStatementSyntax
forStatement => InferTypeInForStatement(forStatement, previousToken: token),
1258
private IEnumerable<TypeInferenceInfo> InferTypeInForStatement(
ForStatementSyntax
forStatement, ExpressionSyntax expressionOpt = null, SyntaxToken? previousToken = null)
Microsoft.CodeAnalysis.CSharp.EditorFeatures (12)
AutomaticCompletion\AutomaticLineEnderCommandHandler.cs (1)
333
or
ForStatementSyntax
AutomaticCompletion\AutomaticLineEnderCommandHandler_Helpers.cs (4)
151
WhileStatementSyntax or ForEachStatementSyntax or
ForStatementSyntax
or LockStatementSyntax or UsingStatementSyntax
478
ForStatementSyntax
forStatementNode => ShouldAddBraceForForStatement(forStatementNode, caretPosition),
672
private static bool ShouldAddBraceForForStatement(
ForStatementSyntax
forStatementNode, int caretPosition)
946
ForStatementSyntax
forStatementNode => forStatementNode.WithStatement(block),
CompleteStatement\CompleteStatementCommandHandler.cs (7)
360
return isInsideDelimiters && TryGetForStatementCaret(caret, (
ForStatementSyntax
)statementNode, out targetPosition);
387
private static bool TryGetForStatementCaret(SnapshotPoint originalCaret,
ForStatementSyntax
forStatement, out SnapshotPoint forStatementCaret)
413
private static bool CaretIsInForStatementCondition(int caretPosition,
ForStatementSyntax
forStatementSyntax, [NotNullWhen(true)] out ExpressionSyntax? condition)
424
private static bool CaretIsInForStatementDeclaration(int caretPosition,
ForStatementSyntax
forStatementSyntax, [NotNullWhen(true)] out VariableDeclarationSyntax? declaration)
433
private static bool CaretIsInForStatementInitializers(int caretPosition,
ForStatementSyntax
forStatementSyntax, out int relocatedPosition)
525
var
forStatement = (
ForStatementSyntax
)currentNode;
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (3)
Semantics\OutVarTests.cs (3)
1275
ForStatementSyntax
forStatement;
1277
if ((forStatement = decl.Ancestors().OfType<
ForStatementSyntax
>().FirstOrDefault()) != null &&
1279
forStatement.Statement.DescendantNodes().OfType<
ForStatementSyntax
>().Any(f => f.Condition == null))
Microsoft.CodeAnalysis.CSharp.Features (39)
Completion\CompletionProviders\DeclarationName\DeclarationNameInfo.cs (1)
392
modifierGetter: v => v.Parent is UsingStatementSyntax or
ForStatementSyntax
ConvertForEachToFor\CSharpConvertForEachToForCodeRefactoringProvider.cs (1)
88
var
forStatement = ForStatement(
ConvertForToForEach\CSharpConvertForToForEachCodeRefactoringProvider.cs (4)
21
ForStatementSyntax
,
36
protected override SyntaxList<StatementSyntax> GetBodyStatements(
ForStatementSyntax
forStatement)
42
ForStatementSyntax
forStatement,
113
ForStatementSyntax
forStatement,
Debugging\CSharpProximityExpressionsService.RelevantExpressionsCollector.cs (1)
50
public override void VisitForStatement(
ForStatementSyntax
node)
Debugging\CSharpProximityExpressionsService.Worker.cs (1)
252
AddLastStatementOfConstruct((statement as
ForStatementSyntax
).Statement);
EditAndContinue\BreakpointSpans.cs (4)
631
var
forStatement = (
ForStatementSyntax
)statement;
958
var
forStatement = (
ForStatementSyntax
)parent;
EditAndContinue\CSharpEditAndContinueAnalyzer.cs (2)
1820
var
forStatement = (
ForStatementSyntax
)node;
EditAndContinue\SyntaxComparer.cs (6)
786
var
leftFor = (
ForStatementSyntax
)leftNode;
787
var
rightFor = (
ForStatementSyntax
)rightNode;
1167
private static double ComputeWeightedDistance(
ForStatementSyntax
left,
ForStatementSyntax
right)
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.CallSiteContainerRewriter.cs (1)
237
public override SyntaxNode VisitForStatement(
ForStatementSyntax
node)
ExtractMethod\CSharpSelectionValidator.Validator.cs (2)
35
ForStatementSyntax
or
63
ForStatementSyntax
or
Highlighting\KeywordHighlighters\LoopHighlighter.cs (2)
45
case
ForStatementSyntax
forStatement:
66
private static void HighlightForStatement(
ForStatementSyntax
statement, List<TextSpan> spans)
InvertIf\CSharpInvertIfCodeRefactoringProvider.cs (2)
78
case
ForStatementSyntax
:
102
CommonForEachStatementSyntax or DoStatementSyntax or WhileStatementSyntax or
ForStatementSyntax
ReverseForStatement\CSharpReverseForStatementCodeRefactoringProvider.cs (2)
37
var forStatement = await context.TryGetRelevantNodeAsync<
ForStatementSyntax
>().ConfigureAwait(false);
264
Document document,
ForStatementSyntax
forStatement, CancellationToken cancellationToken)
Snippets\AbstractCSharpForLoopSnippetProvider.cs (5)
28
internal abstract class AbstractCSharpForLoopSnippetProvider : AbstractForLoopSnippetProvider<
ForStatementSyntax
>
45
protected override
ForStatementSyntax
GenerateStatement(SyntaxGenerator generator, SyntaxContext syntaxContext, InlineExpressionInfo? inlineExpressionInfo)
88
protected override ImmutableArray<SnippetPlaceholder> GetPlaceHolderLocationsList(
ForStatementSyntax
forStatement, ISyntaxFacts syntaxFacts, CancellationToken cancellationToken)
115
protected override int GetTargetCaretPosition(
ForStatementSyntax
forStatement, SourceText sourceText)
121
protected override Task<Document> AddIndentationToDocumentAsync(Document document,
ForStatementSyntax
forStatement, CancellationToken cancellationToken)
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.Analyzer.cs (2)
149
var
forStatement = (
ForStatementSyntax
)current;
src\Analyzers\CSharp\CodeFixes\UseCompoundAssignment\CSharpUseCompoundAssignmentCodeFixProvider.cs (1)
52
if (currentAssignment.Parent is
ForStatementSyntax
forStatement &&
src\Compilers\CSharp\Portable\Syntax\LambdaUtilities.cs (1)
448
SeparatedSyntaxList<ExpressionSyntax> incrementors = ((
ForStatementSyntax
)node.Parent).Incrementors;
Structure\CSharpStructureHelpers.cs (1)
97
var forStatement = nextToken.GetAncestor<
ForStatementSyntax
>();
Microsoft.CodeAnalysis.CSharp.IOperation.UnitTests (48)
IOperation\IOperationTests.cs (1)
311
var op = (IForLoopOperation)comp.GetSemanticModel(tree).GetOperation(tree.GetRoot().DescendantNodes().OfType<
ForStatementSyntax
>().Single());
IOperation\IOperationTests_IBranchOperation.Extensions.cs (6)
52
AssertOuterIsCorrespondingLoopOfInner<
ForStatementSyntax
, BreakStatementSyntax>(@"
149
AssertOuterIsCorrespondingLoopOfInner<
ForStatementSyntax
, BreakStatementSyntax>(@"
170
AssertOuterIsCorrespondingLoopOfInner<
ForStatementSyntax
, BreakStatementSyntax>(@"
258
AssertOuterIsCorrespondingLoopOfInner<
ForStatementSyntax
, BreakStatementSyntax>(@"
303
AssertOuterIsCorrespondingLoopOfInner<
ForStatementSyntax
, ContinueStatementSyntax>(@"
326
var (expected, actual) = GetOuterOperationAndCorrespondingInnerOperation<
ForStatementSyntax
, BreakStatementSyntax>(@"
IOperation\IOperationTests_IForLoopStatement.cs (40)
79
VerifyOperationTreeForTest<
ForStatementSyntax
>(source, expectedOperationTree);
141
VerifyOperationTreeForTest<
ForStatementSyntax
>(source, expectedOperationTree);
203
VerifyOperationTreeForTest<
ForStatementSyntax
>(source, expectedOperationTree);
286
VerifyOperationTreeForTest<
ForStatementSyntax
>(source, expectedOperationTree);
369
VerifyOperationTreeForTest<
ForStatementSyntax
>(source, expectedOperationTree);
422
VerifyOperationTreeForTest<
ForStatementSyntax
>(source, expectedOperationTree);
500
VerifyOperationTreeForTest<
ForStatementSyntax
>(source, expectedOperationTree);
544
VerifyOperationTreeForTest<
ForStatementSyntax
>(source, expectedOperationTree);
597
VerifyOperationTreeForTest<
ForStatementSyntax
>(source, expectedOperationTree);
644
VerifyOperationTreeForTest<
ForStatementSyntax
>(source, expectedOperationTree);
694
VerifyOperationTreeForTest<
ForStatementSyntax
>(source, expectedOperationTree);
781
VerifyOperationTreeForTest<
ForStatementSyntax
>(source, expectedOperationTree);
877
VerifyOperationTreeForTest<
ForStatementSyntax
>(source, expectedOperationTree);
969
VerifyOperationTreeForTest<
ForStatementSyntax
>(source, expectedOperationTree);
1070
VerifyOperationTreeForTest<
ForStatementSyntax
>(source, expectedOperationTree);
1197
VerifyOperationTreeForTest<
ForStatementSyntax
>(source, expectedOperationTree);
1302
VerifyOperationTreeForTest<
ForStatementSyntax
>(source, expectedOperationTree);
1385
VerifyOperationTreeForTest<
ForStatementSyntax
>(source, expectedOperationTree);
1455
VerifyOperationTreeForTest<
ForStatementSyntax
>(source, expectedOperationTree);
1521
VerifyOperationTreeForTest<
ForStatementSyntax
>(source, expectedOperationTree);
1603
VerifyOperationTreeForTest<
ForStatementSyntax
>(source, expectedOperationTree);
1641
VerifyOperationTreeForTest<
ForStatementSyntax
>(source, expectedOperationTree);
1723
VerifyOperationTreeForTest<
ForStatementSyntax
>(source, expectedOperationTree);
1805
VerifyOperationTreeForTest<
ForStatementSyntax
>(source, expectedOperationTree);
1856
VerifyOperationTreeForTest<
ForStatementSyntax
>(source, expectedOperationTree);
2006
VerifyOperationTreeForTest<
ForStatementSyntax
>(source, expectedOperationTree);
2142
VerifyOperationTreeForTest<
ForStatementSyntax
>(source, expectedOperationTree);
2231
VerifyOperationTreeForTest<
ForStatementSyntax
>(source, expectedOperationTree);
2335
VerifyOperationTreeForTest<
ForStatementSyntax
>(source, expectedOperationTree);
2395
VerifyOperationTreeForTest<
ForStatementSyntax
>(source, expectedOperationTree);
2455
VerifyOperationTreeForTest<
ForStatementSyntax
>(source, expectedOperationTree);
2516
VerifyOperationTreeForTest<
ForStatementSyntax
>(source, expectedOperationTree);
2570
VerifyOperationTreeForTest<
ForStatementSyntax
>(source, expectedOperationTree);
2638
VerifyOperationTreeForTest<
ForStatementSyntax
>(source, expectedOperationTree);
2676
VerifyOperationTreeForTest<
ForStatementSyntax
>(source, expectedOperationTree);
2733
VerifyOperationTreeForTest<
ForStatementSyntax
>(source, expectedOperationTree);
2831
VerifyOperationTreeForTest<
ForStatementSyntax
>(source, expectedOperationTree);
2880
VerifyOperationTreeForTest<
ForStatementSyntax
>(source, expectedOperationTree);
2948
VerifyOperationTreeAndDiagnosticsForTest<
ForStatementSyntax
>(source, expectedOperationTree, expectedDiagnostics);
3012
VerifyOperationTreeAndDiagnosticsForTest<
ForStatementSyntax
>(source, expectedOperationTree, expectedDiagnostics);
IOperation\IOperationTests_InvalidStatement.cs (1)
325
VerifyOperationTreeAndDiagnosticsForTest<
ForStatementSyntax
>(source, expectedOperationTree, expectedDiagnostics);
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (4)
Compilation\GetSemanticInfoTests.cs (2)
998
var
forStatement = (
ForStatementSyntax
)methodDecl.Body.Statements[0];
Compilation\SemanticModelAPITests.cs (1)
209
var rxDecl = root.DescendantNodes().OfType<
ForStatementSyntax
>().Single().Declaration;
Compilation\SemanticModelGetDeclaredSymbolAPITests.cs (1)
60
var rxDecl = root.DescendantNodes().OfType<
ForStatementSyntax
>().Single().Declaration;
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (25)
Generated\Syntax.Test.xml.Generated.cs (5)
10613
private static
ForStatementSyntax
GenerateForStatement()
12496
var
node = GenerateForStatement();
12509
var
newNode = node.WithAttributeLists(node.AttributeLists).WithForKeyword(node.ForKeyword).WithOpenParenToken(node.OpenParenToken).WithDeclaration(node.Declaration).WithInitializers(node.Initializers).WithFirstSemicolonToken(node.FirstSemicolonToken).WithCondition(node.Condition).WithSecondSemicolonToken(node.SecondSemicolonToken).WithIncrementors(node.Incrementors).WithCloseParenToken(node.CloseParenToken).WithStatement(node.Statement);
17427
var
oldNode = GenerateForStatement();
17443
var
oldNode = GenerateForStatement();
Parsing\StatementParsingTests.cs (20)
1525
var
fs = (
ForStatementSyntax
)statement;
1551
var
fs = (
ForStatementSyntax
)statement;
1588
var
fs = (
ForStatementSyntax
)statement;
1627
var
fs = (
ForStatementSyntax
)statement;
1736
var
fs = (
ForStatementSyntax
)statement;
1765
var
fs = (
ForStatementSyntax
)statement;
1795
var
fs = (
ForStatementSyntax
)statement;
1825
var
fs = (
ForStatementSyntax
)statement;
1855
var
fs = (
ForStatementSyntax
)statement;
1886
var
fs = (
ForStatementSyntax
)statement;
Microsoft.CodeAnalysis.CSharp.Test.Utilities (1)
LocalVariableDeclaratorsCollector.cs (1)
78
public override void VisitForStatement(
ForStatementSyntax
node)
Microsoft.CodeAnalysis.CSharp.Workspaces (18)
Rename\LocalConflictVisitor.cs (1)
70
public override void VisitForStatement(
ForStatementSyntax
node)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ParenthesizedExpressionSyntaxExtensions.cs (1)
143
(nodeParent is
ForStatementSyntax
forStatement && forStatement.Condition == node) ||
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs (3)
120
ForStatementSyntax
or
135
ForStatementSyntax
n => n.Statement,
709
ForStatementSyntax
n => (n.OpenParenToken, n.CloseParenToken),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\FormattingHelpers.cs (3)
151
token.Parent is
ForStatementSyntax
forStatement &&
295
ForStatementSyntax
forStatement => forStatement.CloseParenToken.Equals(token),
366
ForStatementSyntax
or
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\ElasticTriviaFormattingRule.cs (1)
454
if (previousToken.Parent is
ForStatementSyntax
)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\IndentBlockFormattingRule.cs (1)
313
if (node is
ForStatementSyntax
forStatement && forStatement.Statement != null && !(forStatement.Statement is BlockSyntax))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SpacingFormattingRule.cs (2)
178
&& IsEmptyForStatement((
ForStatementSyntax
)previousToken.Parent!))
568
private static bool IsEmptyForStatement(
ForStatementSyntax
forStatement)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs (2)
2517
token.Parent is
ForStatementSyntax
forStatement)
2528
token.Parent is
ForStatementSyntax
forStatement2 &&
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpMoveDeclarationNearReferenceService.cs (1)
37
ForStatementSyntax
or
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (3)
161
ForStatementSyntax
forStatement => InferTypeInForStatement(forStatement, expression),
228
ForStatementSyntax
forStatement => InferTypeInForStatement(forStatement, previousToken: token),
1258
private IEnumerable<TypeInferenceInfo> InferTypeInForStatement(
ForStatementSyntax
forStatement, ExpressionSyntax expressionOpt = null, SyntaxToken? previousToken = null)
Microsoft.Interop.SourceGeneration (2)
Marshalling\ElementsMarshalling.cs (1)
571
var
forLoop = ForLoop(indexer, lengthExpression)
Utils\SyntaxFactoryExtensions.cs (1)
114
public static
ForStatementSyntax
ForLoop(string indexerIdentifier, ExpressionSyntax lengthExpression)