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