730 references to LocalDeclarationStatementSyntax
Microsoft.CodeAnalysis.CSharp (39)
Binder\Binder_Statements.cs (4)
67result = BindLocalDeclarationStatement((LocalDeclarationStatementSyntax)node, diagnostics); 686internal BoundStatement BindLocalDeclarationStatement(LocalDeclarationStatementSyntax node, BindingDiagnosticBag diagnostics) 698private BoundStatement BindUsingDeclarationStatementParts(LocalDeclarationStatementSyntax node, BindingDiagnosticBag diagnostics) 705private BoundStatement BindDeclarationStatementParts(LocalDeclarationStatementSyntax node, BindingDiagnosticBag diagnostics)
Binder\LocalBinderFactory.cs (2)
936public override void VisitLocalDeclarationStatement(LocalDeclarationStatementSyntax node) 953if (node.Parent is VariableDeclarationSyntax { Parent: LocalDeclarationStatementSyntax { IsConst: true } })
Binder\LocalScopeBinder.cs (2)
189var decl = (LocalDeclarationStatementSyntax)innerStatement;
Binder\UsingStatementBinder.cs (1)
127VariableDeclarationSyntax declarationSyntax = isUsingDeclaration ? ((LocalDeclarationStatementSyntax)syntax).Declaration : (VariableDeclarationSyntax)syntax;
Lowering\Instrumentation\DebugInfoInjector.cs (1)
390((LocalDeclarationStatementSyntax)original.Syntax).Declaration.Variables.First(),
Lowering\Instrumentation\DebugInfoInjector_SequencePoints.cs (2)
107var parent = (LocalDeclarationStatementSyntax)declarationSyntax.Parent;
Lowering\Instrumentation\Instrumenter.cs (1)
216((LocalDeclarationStatementSyntax)original.Syntax).Declaration.Variables.Count == 1));
Lowering\LocalRewriter\LocalRewriter_LocalDeclaration.cs (3)
49var localDeclaration = syntax as LocalDeclarationStatementSyntax; 78((LocalDeclarationStatementSyntax)originalOpt.Syntax).Declaration.Variables.Count == 1)))
Lowering\LocalRewriter\LocalRewriter_UsingStatement.cs (2)
91LocalDeclarationStatementSyntax syntax = (LocalDeclarationStatementSyntax)usingDeclarations.Syntax;
Operations\CSharpOperationFactory.cs (3)
2110var statement = (LocalDeclarationStatementSyntax)node; 2157((LocalDeclarationStatementSyntax)declarationGroupSyntax).Declaration :
Parser\LanguageParser.cs (4)
2586tryParseLocalDeclarationStatementFromStartPoint<LocalDeclarationStatementSyntax>(attributes, ref afterAttributesPoint, out result)) 2698if (tryParseLocalDeclarationStatement<LocalDeclarationStatementSyntax>(attributes, out result)) 2728tryParseLocalDeclarationStatementFromStartPoint<LocalDeclarationStatementSyntax>(attributes, ref afterAttributesPoint, out result)) 2872return !isScript && statement is LocalDeclarationStatementSyntax { UsingKeyword: not null };
Symbols\LocalDeclarationKind.cs (2)
23/// User defined local variable declared by <see cref="LocalDeclarationStatementSyntax"/>. 28/// User defined local constant declared by <see cref="LocalDeclarationStatementSyntax"/>.
Symbols\Source\SourceMemberContainerSymbol.cs (2)
5204var decl = (LocalDeclarationStatementSyntax)innerStatement;
Syntax\LocalDeclarationStatementSyntax.cs (5)
11public LocalDeclarationStatementSyntax Update(SyntaxTokenList modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) 14public LocalDeclarationStatementSyntax Update(SyntaxToken awaitKeyword, SyntaxToken usingKeyword, SyntaxTokenList modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) 23public static LocalDeclarationStatementSyntax LocalDeclarationStatement(SyntaxTokenList modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) 26public static LocalDeclarationStatementSyntax LocalDeclarationStatement(SyntaxToken awaitKeyword, SyntaxToken usingKeyword, SyntaxTokenList modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) 29public static LocalDeclarationStatementSyntax LocalDeclarationStatement(SyntaxTokenList modifiers, VariableDeclarationSyntax declaration)
Syntax\LookupPosition.cs (1)
387return ((LocalDeclarationStatementSyntax)statement).SemicolonToken;
Syntax\SyntaxBindingUtilities.cs (2)
17or VariableDeclaratorSyntax { Parent.Parent: UsingStatementSyntax { AwaitKeyword.RawKind: not 0 } or LocalDeclarationStatementSyntax { AwaitKeyword.RawKind: not 0 } } 21=> node is VariableDeclaratorSyntax { Parent.Parent: UsingStatementSyntax { } or LocalDeclarationStatementSyntax { UsingKeyword.RawKind: not 0 } }
Syntax\SyntaxFacts.cs (1)
552case LocalDeclarationStatementSyntax local when local.AwaitKeyword.IsKind(SyntaxKind.AwaitKeyword):
Syntax\SyntaxNodeExtensions.cs (1)
271(current.Parent is VariableDeclarationSyntax { Parent: LocalDeclarationStatementSyntax } variableDeclaration && variableDeclaration.Type == current));
Microsoft.CodeAnalysis.CSharp.CodeStyle (39)
src\Analyzers\CSharp\Analyzers\InlineDeclaration\CSharpInlineDeclarationDiagnosticAnalyzer.cs (3)
150if (localDeclaration?.Parent is not LocalDeclarationStatementSyntax localStatement) 284LocalDeclarationStatementSyntax localStatement, 364LocalDeclarationStatementSyntax localStatement,
src\Analyzers\CSharp\Analyzers\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessAnalyzer.cs (1)
270if (previousStatement is not LocalDeclarationStatementSyntax localDeclarationStatement)
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForBuilderDiagnosticAnalyzer.cs (2)
137if (invocationExpression.Parent is not EqualsValueClauseSyntax { Parent: VariableDeclaratorSyntax { Parent: VariableDeclarationSyntax { Parent: LocalDeclarationStatementSyntax localDeclarationStatement } } declarator }) 251LocalDeclarationStatementSyntax LocalDeclarationStatement,
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (1)
780Parent.Parent: LocalDeclarationStatementSyntax localDeclarationStatement
src\Analyzers\CSharp\Analyzers\UseCollectionInitializer\CSharpObjectCreationHelpers.cs (1)
13LocalDeclarationStatementSyntax localDeclarationStatement,
src\Analyzers\CSharp\Analyzers\UseCollectionInitializer\CSharpUseCollectionInitializerAnalyzer.cs (2)
24LocalDeclarationStatementSyntax, 31protected override bool IsInitializerOfLocalDeclarationStatement(LocalDeclarationStatementSyntax localDeclarationStatement, BaseObjectCreationExpressionSyntax rootExpression, [NotNullWhen(true)] out VariableDeclaratorSyntax? variableDeclarator)
src\Analyzers\CSharp\Analyzers\UseCollectionInitializer\CSharpUseCollectionInitializerDiagnosticAnalyzer.cs (1)
33LocalDeclarationStatementSyntax,
src\Analyzers\CSharp\Analyzers\UseDeconstruction\CSharpUseDeconstructionDiagnosticAnalyzer.cs (1)
103if (variableDeclaration is not { Parent: LocalDeclarationStatementSyntax localDeclaration, Variables: [{ Initializer.Value: { } initializerValue } declarator] })
src\Analyzers\CSharp\Analyzers\UseLocalFunction\CSharpUseLocalFunctionDiagnosticAnalyzer.cs (8)
87if (!CheckForPattern(anonymousFunction, out var localDeclaration)) 176LocalDeclarationStatementSyntax localDeclaration, 195[NotNullWhen(true)] out LocalDeclarationStatementSyntax? localDeclaration) 211[NotNullWhen(true)] out LocalDeclarationStatementSyntax? localDeclaration) 222Parent: LocalDeclarationStatementSyntax declaration, 322[NotNullWhen(true)] out LocalDeclarationStatementSyntax? localDeclaration) 349[NotNullWhen(true)] out LocalDeclarationStatementSyntax? localDeclaration) 390LocalDeclarationStatementSyntax localDeclaration,
src\Analyzers\CSharp\Analyzers\UseObjectInitializer\CSharpUseNamedMemberInitializerAnalyzer.cs (2)
19LocalDeclarationStatementSyntax, 23protected override bool IsInitializerOfLocalDeclarationStatement(LocalDeclarationStatementSyntax localDeclarationStatement, BaseObjectCreationExpressionSyntax rootExpression, [NotNullWhen(true)] out VariableDeclaratorSyntax? variableDeclarator)
src\Analyzers\CSharp\Analyzers\UseObjectInitializer\CSharpUseObjectInitializerDiagnosticAnalyzer.cs (2)
23LocalDeclarationStatementSyntax, 66return node is not LocalDeclarationStatementSyntax localDecl ||
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.cs (1)
126if (localStatement is LocalDeclarationStatementSyntax localDecl && localDecl.UsingKeyword != default)
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpIsAndCastCheckDiagnosticAnalyzer.cs (2)
77out var ifStatement, out var localDeclarationStatement, 165[NotNullWhen(true)] out LocalDeclarationStatementSyntax? localDeclarationStatement,
src\Analyzers\CSharp\Analyzers\UseTupleSwap\CSharpUseTupleSwapDiagnosticAnalyzer.cs (2)
70var localDeclarationStatement = (LocalDeclarationStatementSyntax)syntaxContext.Node;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs (2)
742LocalDeclarationStatementSyntax localDeclaration => localDeclaration.Modifiers, 756LocalDeclarationStatementSyntax localDeclaration => localDeclaration.WithModifiers(modifiers),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpAccessibilityFacts.cs (3)
228var ld = (LocalDeclarationStatementSyntax)declaration; 313LocalDeclarationStatementSyntax localDecl => localDecl.Modifiers,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpHeaderFacts.cs (1)
92var node = TryGetAncestorForLocation<LocalDeclarationStatementSyntax>(root, position);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (2)
1343((LocalDeclarationStatementSyntax)localDeclarationStatement).Declaration.Variables.Contains(variableDeclarator); 1383=> ((LocalDeclarationStatementSyntax)node).Declaration.Variables;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpUseExplicitTypeHelper.cs (1)
99if ((variableDeclaration.Parent as LocalDeclarationStatementSyntax)?.IsConst == true)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpUseImplicitTypeHelper.cs (1)
113if ((variableDeclaration.Parent as LocalDeclarationStatementSyntax)?.IsConst == true)
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (47)
src\Analyzers\CSharp\CodeFixes\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.cs (1)
99if (declaratorToRemoveNode.Parent is VariableDeclarationSyntax { Parent: LocalDeclarationStatementSyntax declStatement, Variables.Count: 1 })
src\Analyzers\CSharp\CodeFixes\InlineDeclaration\CSharpInlineDeclarationCodeFixProvider.cs (3)
55declarationsToRemove.Add((LocalDeclarationStatementSyntax)diagnostic.AdditionalLocations[0].FindNode(cancellationToken).Parent.Parent); 117var localDeclarationStatement = (LocalDeclarationStatementSyntax)declaration.Parent;
src\Analyzers\CSharp\CodeFixes\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessCodeFixProvider.cs (2)
125var localDeclarationStatement = (LocalDeclarationStatementSyntax)root.FindNode(localDeclarationLocation.SourceSpan);
src\Analyzers\CSharp\CodeFixes\MakeStatementAsynchronous\CSharpMakeStatementAsynchronousCodeFixProvider.cs (2)
84case LocalDeclarationStatementSyntax localDeclaration: 106if (node is LocalDeclarationStatementSyntax localDeclaration && localDeclaration.UsingKeyword != default)
src\Analyzers\CSharp\CodeFixes\RemoveUnusedParametersAndValues\CSharpRemoveUnusedValuesCodeFixProvider.cs (4)
30ExpressionStatementSyntax, LocalDeclarationStatementSyntax, VariableDeclaratorSyntax, 42protected override LocalDeclarationStatementSyntax? GetCandidateLocalDeclarationForRemoval(VariableDeclaratorSyntax declarator) 43=> declarator.Parent?.Parent as LocalDeclarationStatementSyntax; 169protected override void InsertAtStartOfSwitchCaseBlockForDeclarationInCaseLabelOrClause(SwitchSectionSyntax switchCaseBlock, SyntaxEditor editor, LocalDeclarationStatementSyntax declarationStatement)
src\Analyzers\CSharp\CodeFixes\UseCollectionInitializer\CSharpUseCollectionInitializerCodeFixProvider.cs (1)
29LocalDeclarationStatementSyntax,
src\Analyzers\CSharp\CodeFixes\UseConditionalExpression\CSharpUseConditionalExpressionForAssignmentCodeFixProvider.cs (3)
26StatementSyntax, IfStatementSyntax, LocalDeclarationStatementSyntax, VariableDeclaratorSyntax, ExpressionSyntax, ConditionalExpressionSyntax> 40protected override LocalDeclarationStatementSyntax AddSimplificationToType(LocalDeclarationStatementSyntax statement)
src\Analyzers\CSharp\CodeFixes\UseDeconstruction\CSharpUseDeconstructionCodeFixProvider.cs (3)
84var currentDeclarationStatement = (LocalDeclarationStatementSyntax)current; 134INamedTypeSymbol tupleType, LocalDeclarationStatementSyntax declarationStatement, VariableDeclaratorSyntax variableDeclarator)
src\Analyzers\CSharp\CodeFixes\UseLocalFunction\CSharpUseLocalFunctionCodeFixProvider.cs (7)
58LocalDeclarationStatementSyntax declaration, 66var localDeclaration = (LocalDeclarationStatementSyntax)diagnostic.AdditionalLocations[0].FindNode(cancellationToken); 105var currentLocalDeclaration = currentRoot.GetCurrentNode(localDeclaration); 126LocalDeclarationStatementSyntax localDeclaration, 154LocalDeclarationStatementSyntax localDeclaration, AnonymousFunctionExpressionSyntax anonymousFunction, 198LocalDeclarationStatementSyntax localDeclaration,
src\Analyzers\CSharp\CodeFixes\UseObjectInitializer\CSharpUseObjectInitializerCodeFixProvider.cs (1)
30LocalDeclarationStatementSyntax,
src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpAsAndNullCheckCodeFixProvider.cs (1)
111declaration.Parent is LocalDeclarationStatementSyntax localDeclaration &&
src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpIsAndCastCheckCodeFixProvider.cs (2)
58var localDeclaration = (LocalDeclarationStatementSyntax)localDeclarationLocation.FindNode(cancellationToken);
src\Analyzers\CSharp\CodeFixes\UseSimpleUsingStatement\UseSimpleUsingStatementCodeFixProvider.cs (1)
199static LocalDeclarationStatementSyntax Convert(UsingStatementSyntax usingStatement)
src\Analyzers\CSharp\CodeFixes\UseTupleSwap\CSharpUseTupleSwapCodeFixProvider.cs (2)
49var localDeclarationStatement = (LocalDeclarationStatementSyntax)diagnostic.AdditionalLocations[0].FindNode(getInnermostNodeForTie: true, cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeRefactorings\CSharpRefactoringHelpersService.cs (2)
89if (node is LocalDeclarationStatementSyntax localDeclaration) 98if (declaration?.Parent is LocalDeclarationStatementSyntax localDeclarationStatement)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs (3)
1839token.Parent is LocalDeclarationStatementSyntax) 2088var localDeclaration = equalsValue.GetAncestor<LocalDeclarationStatementSyntax>(); 2348type.Parent?.Parent is LocalDeclarationStatementSyntax declStatement)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ExpressionSyntaxExtensions.cs (1)
173name.IsFoundUnder<LocalDeclarationStatementSyntax>(d => d.Declaration.Type) ||
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpMoveDeclarationNearReferenceService.cs (2)
23LocalDeclarationStatementSyntax, 54LocalDeclarationStatementSyntax declarationStatement,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpReplaceDiscardDeclarationsWithAssignmentsService.cs (5)
49case LocalDeclarationStatementSyntax localDeclarationStatement: 127private readonly LocalDeclarationStatementSyntax _localDeclarationStatement; 132private RemoveDiscardHelper(LocalDeclarationStatementSyntax localDeclarationStatement, SyntaxEditor editor) 141LocalDeclarationStatementSyntax localDeclarationStatement, 234var statement = LocalDeclarationStatement(
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpSemanticFactsService.cs (1)
132else if (node is LocalDeclarationStatementSyntax { Declaration.Variables: [{ Initializer.Value: { } value }] } localDeclaration)
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (6)
RefactoringHelpers\RefactoringHelpersTests.cs (6)
1025await TestAsync<LocalDeclarationStatementSyntax>(GetTestText(localDeclaration)); 1128await TestAsync<LocalDeclarationStatementSyntax>(testText); 1183await TestMissingAsync<LocalDeclarationStatementSyntax>(testText); 1211await TestAsync<LocalDeclarationStatementSyntax>(testText); 1617await TestAsync<LocalDeclarationStatementSyntax>(testText); 1642await TestMissingAsync<LocalDeclarationStatementSyntax>(testText);
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (5)
BreakingChanges.cs (1)
585VerifyOperationTreeForTest<LocalDeclarationStatementSyntax>(comp, @"
CodeGen\CodeGenTupleTest.cs (4)
7497var declaration = tree.GetRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().First(); 7530var declaration = tree.GetRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().First();
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (21)
Diagnostics\DiagnosticAnalyzerTests.cs (4)
3749var localDecl1 = tree.GetRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().First(); 4310var localDeclaration = tree.GetRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().First();
Diagnostics\GetDiagnosticsTests.cs (6)
782var localDecl = syntaxTree.GetRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().First(); 1061var localDecl = syntaxTree.GetRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().First(); 1549var localDecl = tree1.GetRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().First();
Semantics\LockTests.cs (1)
183var localDecl = tree.GetRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().Single();
Semantics\OutVarTests.cs (6)
9639var statement = (LocalDeclarationStatementSyntax)SyntaxFactory.ParseStatement(@" 17749var x2Decl = tree.GetRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().Single(); 21295var statement = (LocalDeclarationStatementSyntax)SyntaxFactory.ParseStatement(@"
Semantics\PatternMatchingTests_Scope.cs (4)
6467var statement = (LocalDeclarationStatementSyntax)SyntaxFactory.ParseStatement(@" 12142var statement = (LocalDeclarationStatementSyntax)SyntaxFactory.ParseStatement(@"
Microsoft.CodeAnalysis.CSharp.Features (143)
CodeLens\CSharpCodeLensDisplayInfoService.cs (2)
41var localDeclarationNode = (LocalDeclarationStatementSyntax)node;
CodeRefactorings\InlineTemporary\InlineTemporaryCodeRefactoringProvider.cs (10)
54variableDeclaration.Parent is not LocalDeclarationStatementSyntax localDeclarationStatement) 269var localDeclaration = (LocalDeclarationStatementSyntax)variableDeclaration.Parent; 297var localDeclaration = (LocalDeclarationStatementSyntax)variableDeclaration.Parent; 300var newLocalDeclaration = variableDeclarator.GetLeadingTrivia().Any(t => t.IsDirective) 317var localDeclaration = (LocalDeclarationStatementSyntax)variableDeclaration.Parent; 342var newLocalDeclaration = (LocalDeclarationStatementSyntax)FindDeclarator(newScope).Parent.Parent;
Completion\CompletionProviders\DeclarationName\DeclarationNameInfo.cs (1)
353modifierGetter: v => v.Parent is LocalDeclarationStatementSyntax localDeclaration
ConvertLinq\ConvertForEachToLinqQuery\AbstractToMethodConverter.cs (3)
59var variables = ((LocalDeclarationStatementSyntax)previous).Declaration.Variables; 150var localDeclaration = (LocalDeclarationStatementSyntax)node;
ConvertLinq\ConvertForEachToLinqQuery\CSharpConvertForEachToLinqQueryProvider.cs (4)
78if (!(statement is LocalDeclarationStatementSyntax localDeclarationStatement && 129var localDeclaration = (LocalDeclarationStatementSyntax)current; 172bool TryProcessLocalDeclarationStatement(LocalDeclarationStatementSyntax localDeclarationStatement)
ConvertLinq\CSharpConvertLinqQueryToForEachProvider.cs (1)
516private LocalDeclarationStatementSyntax CreateLocalDeclarationStatement(
Debugging\CSharpProximityExpressionsService.RelevantExpressionsCollector.cs (1)
32public override void VisitLocalDeclarationStatement(LocalDeclarationStatementSyntax node)
Debugging\CSharpProximityExpressionsService.Worker.cs (1)
102if (_parentStatement is LocalDeclarationStatementSyntax)
EditAndContinue\BreakpointSpans.cs (2)
593var declarationStatement = (LocalDeclarationStatementSyntax)statement;
EditAndContinue\CSharpEditAndContinueAnalyzer.cs (7)
843var oldUsingDeclarations = oldBlock.Statements.Where(s => s is LocalDeclarationStatementSyntax l && l.UsingKeyword != default); 844var newUsingDeclarations = newBlock.Statements.Where(s => s is LocalDeclarationStatementSyntax l && l.UsingKeyword != default); 1858var localDeclarationStatement = (LocalDeclarationStatementSyntax)node; 2253if (((LocalDeclarationStatementSyntax)node).UsingKeyword.IsKind(SyntaxKind.UsingKeyword)) 2274RoslynDebug.Assert(((LocalDeclarationStatementSyntax)node.Parent!.Parent!).AwaitKeyword.IsKind(SyntaxKind.AwaitKeyword)); 2673/// <see cref="UsingStatementSyntax"/> and using <see cref="LocalDeclarationStatementSyntax"/> generate finally blocks,
EditAndContinue\SyntaxComparer.cs (1)
1283if (child is LocalDeclarationStatementSyntax localDecl)
ExtractMethod\CSharpMethodExtractor.Analyzer.cs (1)
36return CreateFromSymbolCommon<LocalDeclarationStatementSyntax>(compilation, symbol, type, style, s_nonNoisySyntaxKindSet);
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.CallSiteContainerRewriter.cs (2)
59public override SyntaxNode VisitLocalDeclarationStatement(LocalDeclarationStatementSyntax node) 61node = (LocalDeclarationStatementSyntax)base.VisitLocalDeclarationStatement(node);
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.cs (5)
201var declStatement = idToken.GetAncestor<LocalDeclarationStatementSyntax>(); 306if (statement is not LocalDeclarationStatementSyntax declStatement) 331if (statement is not LocalDeclarationStatementSyntax declarationStatement || declarationStatement.Declaration.Variables.FullSpan.IsEmpty) 488private static SyntaxToken ApplyTriviaFromDeclarationToAssignmentIdentifier(LocalDeclarationStatementSyntax declarationStatement, bool firstVariableToAttachTrivia, VariableDeclaratorSyntax variable) 629var usingKeyword = originalIdentifierToken.Parent?.Parent?.Parent is LocalDeclarationStatementSyntax { UsingKeyword.FullSpan.IsEmpty: false }
ExtractMethod\CSharpMethodExtractor.PostProcessor.cs (11)
94var map = new Dictionary<ITypeSymbol, List<LocalDeclarationStatementSyntax>>(); 104AppendDeclarationStatementToMap(statement as LocalDeclarationStatementSyntax, map); 115LocalDeclarationStatementSyntax statement, 116Dictionary<ITypeSymbol, List<LocalDeclarationStatementSyntax>> map) 126private static IEnumerable<LocalDeclarationStatementSyntax> GetMergedDeclarationStatements( 127Dictionary<ITypeSymbol, List<LocalDeclarationStatementSyntax>> map) 135foreach (var statement in keyValuePair.Value) 163if (statement is not LocalDeclarationStatementSyntax declarationStatement) 195private static bool ContainsAnyInitialization(LocalDeclarationStatementSyntax statement) 234if (statements.ElementAtOrDefault(0) is not LocalDeclarationStatementSyntax declaration || statements.ElementAtOrDefault(1) is not ReturnStatementSyntax returnStatement) 266if (statements.ElementAtOrDefault(0) is not LocalDeclarationStatementSyntax declaration || statements.ElementAtOrDefault(1) is not ExpressionStatementSyntax assignment)
ExtractMethod\CSharpSelectionValidator.Validator.cs (1)
65LocalDeclarationStatementSyntax or
ExtractMethod\Extensions.cs (1)
117node.PartOfConstantInitializerExpression<LocalDeclarationStatementSyntax>(n => n.Modifiers);
GenerateMember\GenerateVariable\CSharpGenerateVariableService.cs (1)
207var declarationStatement = LocalDeclarationStatement(
Highlighting\KeywordHighlighters\AsyncAwaitHighlighter.cs (1)
76LocalDeclarationStatementSyntax localDeclaration =>
IntroduceParameter\CSharpIntroduceParameterCodeRefactoringProvider.cs (1)
35return variableDecl.Parent?.Parent as LocalDeclarationStatementSyntax;
IntroduceUsingStatement\CSharpIntroduceUsingStatementCodeRefactoringProvider.cs (5)
22: AbstractIntroduceUsingStatementCodeRefactoringProvider<StatementSyntax, LocalDeclarationStatementSyntax, TryStatementSyntax> 41protected override SyntaxList<StatementSyntax> GetSurroundingStatements(LocalDeclarationStatementSyntax declarationStatement) 57protected override StatementSyntax CreateUsingStatement(LocalDeclarationStatementSyntax declarationStatement, SyntaxList<StatementSyntax> statementsToSurround) 68LocalDeclarationStatementSyntax declarationStatement, 69[NotNullWhen(true)] out LocalDeclarationStatementSyntax? usingDeclarationStatement)
IntroduceVariable\CSharpIntroduceLocalForExpressionCodeRefactoringProvider.cs (3)
34LocalDeclarationStatementSyntax> 57protected override LocalDeclarationStatementSyntax FixupLocalDeclaration( 58ExpressionStatementSyntax expressionStatement, LocalDeclarationStatementSyntax localDeclaration)
IntroduceVariable\CSharpIntroduceVariableService_IntroduceLocal.cs (5)
46var declarationStatement = LocalDeclarationStatement( 97LocalDeclarationStatementSyntax declarationStatement, 160LocalDeclarationStatementSyntax declarationStatement, 223LocalDeclarationStatementSyntax declarationStatement, 291LocalDeclarationStatementSyntax declarationStatement,
MoveDeclarationNearReference\CSharpMoveDeclarationNearReferenceCodeRefactoringProvider.cs (1)
17internal class CSharpMoveDeclarationNearReferenceCodeRefactoringProvider : AbstractMoveDeclarationNearReferenceCodeRefactoringProvider<LocalDeclarationStatementSyntax>
RemoveUnusedVariable\CSharpRemoveUnusedVariableCodeFixProvider.cs (3)
21internal sealed partial class CSharpRemoveUnusedVariableCodeFixProvider : AbstractRemoveUnusedVariableCodeFixProvider<LocalDeclarationStatementSyntax, VariableDeclaratorSyntax, VariableDeclarationSyntax> 70protected override SeparatedSyntaxList<SyntaxNode> GetVariables(LocalDeclarationStatementSyntax localDeclarationStatement) 77if (node.Parent?.Parent is not LocalDeclarationStatementSyntax localDeclaration)
ReplaceConditionalWithStatements\CSharpReplaceConditionalWithStatementsCodeRefactoringProvider.cs (5)
23LocalDeclarationStatementSyntax, 36protected override bool CanRewriteLocalDeclarationStatement(LocalDeclarationStatementSyntax localDeclarationStatement) 50LocalDeclarationStatementSyntax localDeclarationStatement, 63protected override LocalDeclarationStatementSyntax GetUpdatedLocalDeclarationStatement( 65LocalDeclarationStatementSyntax localDeclarationStatement,
src\Analyzers\CSharp\Analyzers\InlineDeclaration\CSharpInlineDeclarationDiagnosticAnalyzer.cs (3)
150if (localDeclaration?.Parent is not LocalDeclarationStatementSyntax localStatement) 284LocalDeclarationStatementSyntax localStatement, 364LocalDeclarationStatementSyntax localStatement,
src\Analyzers\CSharp\Analyzers\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessAnalyzer.cs (1)
270if (previousStatement is not LocalDeclarationStatementSyntax localDeclarationStatement)
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForBuilderDiagnosticAnalyzer.cs (2)
137if (invocationExpression.Parent is not EqualsValueClauseSyntax { Parent: VariableDeclaratorSyntax { Parent: VariableDeclarationSyntax { Parent: LocalDeclarationStatementSyntax localDeclarationStatement } } declarator }) 251LocalDeclarationStatementSyntax LocalDeclarationStatement,
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (1)
780Parent.Parent: LocalDeclarationStatementSyntax localDeclarationStatement
src\Analyzers\CSharp\Analyzers\UseCollectionInitializer\CSharpObjectCreationHelpers.cs (1)
13LocalDeclarationStatementSyntax localDeclarationStatement,
src\Analyzers\CSharp\Analyzers\UseCollectionInitializer\CSharpUseCollectionInitializerAnalyzer.cs (2)
24LocalDeclarationStatementSyntax, 31protected override bool IsInitializerOfLocalDeclarationStatement(LocalDeclarationStatementSyntax localDeclarationStatement, BaseObjectCreationExpressionSyntax rootExpression, [NotNullWhen(true)] out VariableDeclaratorSyntax? variableDeclarator)
src\Analyzers\CSharp\Analyzers\UseCollectionInitializer\CSharpUseCollectionInitializerDiagnosticAnalyzer.cs (1)
33LocalDeclarationStatementSyntax,
src\Analyzers\CSharp\Analyzers\UseDeconstruction\CSharpUseDeconstructionDiagnosticAnalyzer.cs (1)
103if (variableDeclaration is not { Parent: LocalDeclarationStatementSyntax localDeclaration, Variables: [{ Initializer.Value: { } initializerValue } declarator] })
src\Analyzers\CSharp\Analyzers\UseLocalFunction\CSharpUseLocalFunctionDiagnosticAnalyzer.cs (8)
87if (!CheckForPattern(anonymousFunction, out var localDeclaration)) 176LocalDeclarationStatementSyntax localDeclaration, 195[NotNullWhen(true)] out LocalDeclarationStatementSyntax? localDeclaration) 211[NotNullWhen(true)] out LocalDeclarationStatementSyntax? localDeclaration) 222Parent: LocalDeclarationStatementSyntax declaration, 322[NotNullWhen(true)] out LocalDeclarationStatementSyntax? localDeclaration) 349[NotNullWhen(true)] out LocalDeclarationStatementSyntax? localDeclaration) 390LocalDeclarationStatementSyntax localDeclaration,
src\Analyzers\CSharp\Analyzers\UseObjectInitializer\CSharpUseNamedMemberInitializerAnalyzer.cs (2)
19LocalDeclarationStatementSyntax, 23protected override bool IsInitializerOfLocalDeclarationStatement(LocalDeclarationStatementSyntax localDeclarationStatement, BaseObjectCreationExpressionSyntax rootExpression, [NotNullWhen(true)] out VariableDeclaratorSyntax? variableDeclarator)
src\Analyzers\CSharp\Analyzers\UseObjectInitializer\CSharpUseObjectInitializerDiagnosticAnalyzer.cs (2)
23LocalDeclarationStatementSyntax, 66return node is not LocalDeclarationStatementSyntax localDecl ||
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.cs (1)
126if (localStatement is LocalDeclarationStatementSyntax localDecl && localDecl.UsingKeyword != default)
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpIsAndCastCheckDiagnosticAnalyzer.cs (2)
77out var ifStatement, out var localDeclarationStatement, 165[NotNullWhen(true)] out LocalDeclarationStatementSyntax? localDeclarationStatement,
src\Analyzers\CSharp\Analyzers\UseTupleSwap\CSharpUseTupleSwapDiagnosticAnalyzer.cs (2)
70var localDeclarationStatement = (LocalDeclarationStatementSyntax)syntaxContext.Node;
src\Analyzers\CSharp\CodeFixes\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.cs (1)
99if (declaratorToRemoveNode.Parent is VariableDeclarationSyntax { Parent: LocalDeclarationStatementSyntax declStatement, Variables.Count: 1 })
src\Analyzers\CSharp\CodeFixes\InlineDeclaration\CSharpInlineDeclarationCodeFixProvider.cs (3)
55declarationsToRemove.Add((LocalDeclarationStatementSyntax)diagnostic.AdditionalLocations[0].FindNode(cancellationToken).Parent.Parent); 117var localDeclarationStatement = (LocalDeclarationStatementSyntax)declaration.Parent;
src\Analyzers\CSharp\CodeFixes\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessCodeFixProvider.cs (2)
125var localDeclarationStatement = (LocalDeclarationStatementSyntax)root.FindNode(localDeclarationLocation.SourceSpan);
src\Analyzers\CSharp\CodeFixes\MakeStatementAsynchronous\CSharpMakeStatementAsynchronousCodeFixProvider.cs (2)
84case LocalDeclarationStatementSyntax localDeclaration: 106if (node is LocalDeclarationStatementSyntax localDeclaration && localDeclaration.UsingKeyword != default)
src\Analyzers\CSharp\CodeFixes\RemoveUnusedParametersAndValues\CSharpRemoveUnusedValuesCodeFixProvider.cs (4)
30ExpressionStatementSyntax, LocalDeclarationStatementSyntax, VariableDeclaratorSyntax, 42protected override LocalDeclarationStatementSyntax? GetCandidateLocalDeclarationForRemoval(VariableDeclaratorSyntax declarator) 43=> declarator.Parent?.Parent as LocalDeclarationStatementSyntax; 169protected override void InsertAtStartOfSwitchCaseBlockForDeclarationInCaseLabelOrClause(SwitchSectionSyntax switchCaseBlock, SyntaxEditor editor, LocalDeclarationStatementSyntax declarationStatement)
src\Analyzers\CSharp\CodeFixes\UseCollectionInitializer\CSharpUseCollectionInitializerCodeFixProvider.cs (1)
29LocalDeclarationStatementSyntax,
src\Analyzers\CSharp\CodeFixes\UseConditionalExpression\CSharpUseConditionalExpressionForAssignmentCodeFixProvider.cs (3)
26StatementSyntax, IfStatementSyntax, LocalDeclarationStatementSyntax, VariableDeclaratorSyntax, ExpressionSyntax, ConditionalExpressionSyntax> 40protected override LocalDeclarationStatementSyntax AddSimplificationToType(LocalDeclarationStatementSyntax statement)
src\Analyzers\CSharp\CodeFixes\UseDeconstruction\CSharpUseDeconstructionCodeFixProvider.cs (3)
84var currentDeclarationStatement = (LocalDeclarationStatementSyntax)current; 134INamedTypeSymbol tupleType, LocalDeclarationStatementSyntax declarationStatement, VariableDeclaratorSyntax variableDeclarator)
src\Analyzers\CSharp\CodeFixes\UseLocalFunction\CSharpUseLocalFunctionCodeFixProvider.cs (7)
58LocalDeclarationStatementSyntax declaration, 66var localDeclaration = (LocalDeclarationStatementSyntax)diagnostic.AdditionalLocations[0].FindNode(cancellationToken); 105var currentLocalDeclaration = currentRoot.GetCurrentNode(localDeclaration); 126LocalDeclarationStatementSyntax localDeclaration, 154LocalDeclarationStatementSyntax localDeclaration, AnonymousFunctionExpressionSyntax anonymousFunction, 198LocalDeclarationStatementSyntax localDeclaration,
src\Analyzers\CSharp\CodeFixes\UseObjectInitializer\CSharpUseObjectInitializerCodeFixProvider.cs (1)
30LocalDeclarationStatementSyntax,
src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpAsAndNullCheckCodeFixProvider.cs (1)
111declaration.Parent is LocalDeclarationStatementSyntax localDeclaration &&
src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpIsAndCastCheckCodeFixProvider.cs (2)
58var localDeclaration = (LocalDeclarationStatementSyntax)localDeclarationLocation.FindNode(cancellationToken);
src\Analyzers\CSharp\CodeFixes\UseSimpleUsingStatement\UseSimpleUsingStatementCodeFixProvider.cs (1)
199static LocalDeclarationStatementSyntax Convert(UsingStatementSyntax usingStatement)
src\Analyzers\CSharp\CodeFixes\UseTupleSwap\CSharpUseTupleSwapCodeFixProvider.cs (2)
49var localDeclarationStatement = (LocalDeclarationStatementSyntax)diagnostic.AdditionalLocations[0].FindNode(getInnermostNodeForTie: true, cancellationToken);
src\Compilers\CSharp\Portable\Syntax\SyntaxBindingUtilities.cs (2)
17or VariableDeclaratorSyntax { Parent.Parent: UsingStatementSyntax { AwaitKeyword.RawKind: not 0 } or LocalDeclarationStatementSyntax { AwaitKeyword.RawKind: not 0 } } 21=> node is VariableDeclaratorSyntax { Parent.Parent: UsingStatementSyntax { } or LocalDeclarationStatementSyntax { UsingKeyword.RawKind: not 0 } }
Microsoft.CodeAnalysis.CSharp.IOperation.UnitTests (78)
IOperation\IOperationTests.cs (2)
625var localDecl = (LocalDeclarationStatementSyntax)speculatedBlock.Statements[0];
IOperation\IOperationTests_ArrayCreationAndInitializer.cs (1)
329VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics);
IOperation\IOperationTests_IAnonymousFunctionExpression.cs (11)
64VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 148VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 232VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 280VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 334VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 382VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 409var variableDeclaration = syntaxTree.GetRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().Single(); 478VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>( 489var variableDeclaration = syntaxTree.GetRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().Single();
IOperation\IOperationTests_IAwaitExpression.cs (1)
229VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics, targetFramework: TargetFramework.Mscorlib46Extended);
IOperation\IOperationTests_IConditionalOperation.cs (2)
118VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 164VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics);
IOperation\IOperationTests_IConversionExpression.cs (4)
3260VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 3294VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 3332VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 5122VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics);
IOperation\IOperationTests_IDelegateCreationExpression.cs (12)
50VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 119VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 156VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 284VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 324VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 361VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 396VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 461VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 529VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics, 607VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 1726VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 1762VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics);
IOperation\IOperationTests_InvalidExpression.cs (2)
202VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 251VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics);
IOperation\IOperationTests_InvalidStatement.cs (1)
66VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics);
IOperation\IOperationTests_ISwitchExpression.cs (2)
759VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 816VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics);
IOperation\IOperationTests_ITupleExpression.cs (11)
77VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 153VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 313VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 389VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 453VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 520VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 613VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 748VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 853VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 944VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 1093VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics);
IOperation\IOperationTests_IUsingStatement.cs (5)
7985VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 8114VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 8227VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 8365VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 8538VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics);
IOperation\IOperationTests_IVariableDeclaration.cs (24)
50VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 83VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 117VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 155VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 195VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 236VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 274VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 308VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 349VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 381VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 417VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 455VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 499VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 2908VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 2951VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 2985VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 3027VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 3062VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 3106VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 3150VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 3188VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 3236VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 3272VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics); 3312VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics);
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (23)
Semantics\ArglistTests.cs (2)
962var stmt = meth.Body.Statements[0] as LocalDeclarationStatementSyntax;
Semantics\DeconstructionTests.cs (1)
4017VerifyOperationTreeAndDiagnosticsForTest<LocalDeclarationStatementSyntax>(source, expectedOperationTree, expectedDiagnostics);
Semantics\InterpolationTests.cs (3)
4240VerifyOperationTreeForTest<LocalDeclarationStatementSyntax>(comp, @" 4281VerifyOperationTreeForTest<LocalDeclarationStatementSyntax>(comp, @" 4319VerifyOperationTreeForTest<LocalDeclarationStatementSyntax>(comp, @"
Semantics\LambdaTests.cs (1)
8118var decls = tree.GetRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().ToImmutableArray();
Semantics\LockTests.cs (6)
45var localDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().Single(); 604var localDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().Single(); 628var localDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().Single();
Semantics\NullableReferenceTypesTests.cs (2)
35000var varDecl = tree.GetRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().Where(d => d.Declaration.Type.IsVar).Single();
Semantics\QueryTests.cs (6)
3414var queryStatement = (LocalDeclarationStatementSyntax)SyntaxFactory.ParseStatement(speculatedSource); 3458var queryStatement = (LocalDeclarationStatementSyntax)SyntaxFactory.ParseStatement(speculatedSource); 3517var queryExpression = (QueryExpressionSyntax)((LocalDeclarationStatementSyntax)queryStatement).Declaration.Variables[0].Initializer.Value; 3557var queryExpression = (QueryExpressionSyntax)((LocalDeclarationStatementSyntax)queryStatement).Declaration.Variables[0].Initializer.Value;
Semantics\TargetTypedConditionalOperatorTests.cs (2)
339var stmt = (LocalDeclarationStatementSyntax)methodTest.Body!.Statements.First();
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (86)
Compilation\GetSemanticInfoTests.cs (12)
255var v3 = (mainStats[2] as LocalDeclarationStatementSyntax).Declaration.Variables; 258var v4 = (mainStats[3] as LocalDeclarationStatementSyntax).Declaration.Variables; 266var v7 = (mainStats[6] as LocalDeclarationStatementSyntax).Declaration.Variables; 269var v8 = (mainStats[7] as LocalDeclarationStatementSyntax).Declaration.Variables; 272var v9 = (mainStats[8] as LocalDeclarationStatementSyntax).Declaration.Variables; 537var v1 = (mainStats[0] as LocalDeclarationStatementSyntax).Declaration.Variables; 540var v2 = (mainStats[1] as LocalDeclarationStatementSyntax).Declaration.Variables; 548var v4 = (mainStats[4] as LocalDeclarationStatementSyntax).Declaration.Variables; 551var v5 = (mainStats[5] as LocalDeclarationStatementSyntax).Declaration.Variables; 4875var statement = tree.GetRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().Single(); 4877var newStatement = statement.ReplaceNode(statement.Declaration.Variables[0].Initializer.Value, newSyntax);
Compilation\SemanticModelAPITests.cs (21)
1785var localDecl = (LocalDeclarationStatementSyntax)statement.Statements[0]; 1839var declarator = ((LocalDeclarationStatementSyntax)statement).Declaration.Variables.First(); 1852declarator = ((LocalDeclarationStatementSyntax)statement).Declaration.Variables.First(); 1949var speculatedStatement = (LocalDeclarationStatementSyntax)SyntaxFactory.ParseStatement(@"Func<int, int> var = (z) => x + z;"); 2175var statement = (LocalDeclarationStatementSyntax)methodDecl.Body.Statements[0]; 2191var speculatedStatement = statement.ReplaceNode(initializer.Value, SyntaxFactory.ParseExpression("0")); 2220var statement = (LocalDeclarationStatementSyntax)methodDecl.Body.Statements[0]; 2225var speculatedStatement = statement.ReplaceNode(expression, SyntaxFactory.ParseExpression("0")); 2233var newSpeculatedStatement = statement.ReplaceNode(expression, SyntaxFactory.ParseExpression("1.1")); 2238newSpeculatedStatement = (LocalDeclarationStatementSyntax)SyntaxFactory.ParseStatement(@"int z = 0;"); 2261var unsafeStatement = (LocalDeclarationStatementSyntax)SyntaxFactory.ParseStatement("int *p = &x;"); 2391var localDecl = (LocalDeclarationStatementSyntax)blockStatement.Statements[0]; 2575var declarator = ((LocalDeclarationStatementSyntax)blockStatement.Statements[0]).Declaration.Variables.First(); 2589declarator = ((LocalDeclarationStatementSyntax)blockStatement.Statements[0]).Declaration.Variables.First(); 2603declarator = ((LocalDeclarationStatementSyntax)blockStatement.Statements[0]).Declaration.Variables.First();
Compilation\SemanticModelGetDeclaredSymbolAPITests.cs (37)
567var localDecl = (LocalDeclarationStatementSyntax)methodDecl.Body.Statements[0]; 589var localDecl = (LocalDeclarationStatementSyntax)methodDecl.Body.Statements[0]; 1084var localDecl = (LocalDeclarationStatementSyntax)methodDecl.Body.Statements[0]; 1174var localDecl = (LocalDeclarationStatementSyntax)methodDecl.Body.Statements[0]; 2251var localDecl = (LocalDeclarationStatementSyntax)methodDecl.Body.Statements[0]; 2287var localDecl = (LocalDeclarationStatementSyntax)methodDecl.Body.Statements[0]; 2324var localDecl = (LocalDeclarationStatementSyntax)methodDecl.Body.Statements[0]; 2360var localDecl = (LocalDeclarationStatementSyntax)methodDecl.Body.Statements[0]; 2396var localDecl = (LocalDeclarationStatementSyntax)methodDecl.Body.Statements[0]; 2426var localDecl = (LocalDeclarationStatementSyntax)methodDecl.Body.Statements[0]; 2458var localDecl = (LocalDeclarationStatementSyntax)methodDecl.Body.Statements[1]; 2469localDecl = (LocalDeclarationStatementSyntax)methodDecl.Body.Statements[2]; 2495var localDecl = (LocalDeclarationStatementSyntax)methodDecl.Body.Statements[0]; 2532var localDecl = (LocalDeclarationStatementSyntax)methodDecl.Body.Statements[0]; 2617var localDecl = (LocalDeclarationStatementSyntax)methodDecl.Body.Statements[0]; 2642var localDecl = (LocalDeclarationStatementSyntax)methodDecl.Body.Statements[0]; 3212var declStmt = (LocalDeclarationStatementSyntax)methodDecl.Body.Statements[2]; 3235var localDecl = (LocalDeclarationStatementSyntax)methodDecl.Body.Statements[0]; 3269var localDecl = (LocalDeclarationStatementSyntax)methodDecl.Body.Statements[0];
SymbolDisplay\SymbolDisplayTests.cs (4)
8227var declaration = (LocalDeclarationStatementSyntax)semanticModel.SyntaxTree.GetRoot().DescendantNodes().Single(n => n.Kind() == SyntaxKind.LocalDeclarationStatement); 8278var declaration = (LocalDeclarationStatementSyntax)semanticModel.SyntaxTree.GetRoot().DescendantNodes().Single(n => n.Kind() == SyntaxKind.LocalDeclarationStatement);
Symbols\AnonymousTypesSymbolTests.cs (8)
1685var statement1 = mainBlock.Statements[0] as LocalDeclarationStatementSyntax; 1686var statement2 = mainBlock.Statements[1] as LocalDeclarationStatementSyntax; 1687var statement3 = mainBlock.Statements[2] as LocalDeclarationStatementSyntax; 1688var statement4 = mainBlock.Statements[3] as LocalDeclarationStatementSyntax;
Symbols\CovariantReturnTests.cs (2)
379foreach (var declaration in tree.GetRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>())
Symbols\TypeTests.cs (2)
1763var node1 = (LocalDeclarationStatementSyntax)tree.FindNodeOrTokenByKind(SyntaxKind.LocalDeclarationStatement, 3);
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (163)
Generated\Syntax.Test.xml.Generated.cs (5)
10559private static LocalDeclarationStatementSyntax GenerateLocalDeclarationStatement() 12269var node = GenerateLocalDeclarationStatement(); 12277var newNode = node.WithAttributeLists(node.AttributeLists).WithAwaitKeyword(node.AwaitKeyword).WithUsingKeyword(node.UsingKeyword).WithModifiers(node.Modifiers).WithDeclaration(node.Declaration).WithSemicolonToken(node.SemicolonToken); 16959var oldNode = GenerateLocalDeclarationStatement(); 16975var oldNode = GenerateLocalDeclarationStatement();
IncrementalParsing\BinaryExpression.cs (2)
34var statement = block.Statements[0] as LocalDeclarationStatementSyntax;
Parsing\DeconstructionTests.cs (2)
1882var declaration = ((LocalDeclarationStatementSyntax)statement).Declaration; 2048var declaration = ((LocalDeclarationStatementSyntax)statement).Declaration;
Parsing\ParsingErrorRecoveryTests.cs (94)
4586var ds = (LocalDeclarationStatementSyntax)ms.Body.Statements[0]; 4612var ds = (LocalDeclarationStatementSyntax)ms.Body.Statements[0]; 4639var ds = (LocalDeclarationStatementSyntax)ms.Body.Statements[0]; 4666var ds = (LocalDeclarationStatementSyntax)ms.Body.Statements[0]; 4694var ds = (LocalDeclarationStatementSyntax)ms.Body.Statements[0]; 4721var ds = (LocalDeclarationStatementSyntax)ms.Body.Statements[0]; 4749var ds = (LocalDeclarationStatementSyntax)ms.Body.Statements[0]; 4778var ds = (LocalDeclarationStatementSyntax)ms.Body.Statements[0]; 4807var ds = (LocalDeclarationStatementSyntax)ms.Body.Statements[0]; 4837var ds = (LocalDeclarationStatementSyntax)ms.Body.Statements[0]; 4866var ds = (LocalDeclarationStatementSyntax)ms.Body.Statements[0]; 4894var ds = (LocalDeclarationStatementSyntax)ms.Body.Statements[0]; 4921var ds = (LocalDeclarationStatementSyntax)ms.Body.Statements[0]; 4948var ds = (LocalDeclarationStatementSyntax)ms.Body.Statements[0]; 4975var ds = (LocalDeclarationStatementSyntax)ms.Body.Statements[0]; 5003var ds = (LocalDeclarationStatementSyntax)ms.Body.Statements[0]; 5030var ds = (LocalDeclarationStatementSyntax)ms.Body.Statements[0]; 5058var ds = (LocalDeclarationStatementSyntax)ms.Body.Statements[0]; 5084var ds = (LocalDeclarationStatementSyntax)ms.Body.Statements[0]; 5114var ds = (LocalDeclarationStatementSyntax)ms.Body.Statements[0]; 5143var ds = (LocalDeclarationStatementSyntax)ms.Body.Statements[0]; 5173var ds = (LocalDeclarationStatementSyntax)ms.Body.Statements[0]; 5826var ds = (LocalDeclarationStatementSyntax)ms.Body.Statements[0]; 5866var ds = (LocalDeclarationStatementSyntax)ms.Body.Statements[0]; 5895var ds = (LocalDeclarationStatementSyntax)ms.Body.Statements[0]; 5924var ds = (LocalDeclarationStatementSyntax)ms.Body.Statements[0]; 5954var ds = (LocalDeclarationStatementSyntax)ms.Body.Statements[0]; 5983var ds = (LocalDeclarationStatementSyntax)ms.Body.Statements[0]; 6016var ds = (LocalDeclarationStatementSyntax)ms.Body.Statements[0]; 6043var ds = (LocalDeclarationStatementSyntax)ms.Body.Statements[0]; 6070var ds = (LocalDeclarationStatementSyntax)ms.Body.Statements[0]; 6097var ds = (LocalDeclarationStatementSyntax)ms.Body.Statements[0]; 6125var ds = (LocalDeclarationStatementSyntax)ms.Body.Statements[0]; 6152var ds = (LocalDeclarationStatementSyntax)ms.Body.Statements[0]; 6182var ds = (LocalDeclarationStatementSyntax)ms.Body.Statements[0]; 6213var ds = (LocalDeclarationStatementSyntax)ms.Body.Statements[0]; 6241var ds = (LocalDeclarationStatementSyntax)ms.Body.Statements[0]; 6289var ds = (LocalDeclarationStatementSyntax)ms.Body.Statements[0]; 6323var ds = (LocalDeclarationStatementSyntax)ms.Body.Statements[0]; 6354var ds = (LocalDeclarationStatementSyntax)ms.Body.Statements[0]; 6640var ds = (LocalDeclarationStatementSyntax)md.Body.Statements[0]; 6685var ds = (LocalDeclarationStatementSyntax)md.Body.Statements[0]; 6729var ds = (LocalDeclarationStatementSyntax)md.Body.Statements[0]; 6779var ds = (LocalDeclarationStatementSyntax)md.Body.Statements[0]; 6827var ds = (LocalDeclarationStatementSyntax)md.Body.Statements[0]; 6874var ds = (LocalDeclarationStatementSyntax)md.Body.Statements[0]; 6927var decl = (LocalDeclarationStatementSyntax)subitem1.Body.Statements[0];
Parsing\StatementParsingTests.cs (60)
192var ds = (LocalDeclarationStatementSyntax)statement; 220var ds = (LocalDeclarationStatementSyntax)statement; 250var ds = (LocalDeclarationStatementSyntax)statement; 284var ds = (LocalDeclarationStatementSyntax)statement; 325var ds = (LocalDeclarationStatementSyntax)statement; 353var ds = (LocalDeclarationStatementSyntax)statement; 379var ds = (LocalDeclarationStatementSyntax)statement; 405var ds = (LocalDeclarationStatementSyntax)statement; 431var ds = (LocalDeclarationStatementSyntax)statement; 457var ds = (LocalDeclarationStatementSyntax)statement; 483var ds = (LocalDeclarationStatementSyntax)statement; 509var ds = (LocalDeclarationStatementSyntax)statement; 544var ds = (LocalDeclarationStatementSyntax)statement; 574var ds = (LocalDeclarationStatementSyntax)statement; 619var ds = (LocalDeclarationStatementSyntax)statement; 650var ds = (LocalDeclarationStatementSyntax)statement; 682var ds = (LocalDeclarationStatementSyntax)statement; 714var ds = (LocalDeclarationStatementSyntax)statement; 746var ds = (LocalDeclarationStatementSyntax)statement; 777var ds = (LocalDeclarationStatementSyntax)statement; 803var ds = (LocalDeclarationStatementSyntax)statement; 834var ds = (LocalDeclarationStatementSyntax)statement; 2400var us = (LocalDeclarationStatementSyntax)statement; 2495var us = (LocalDeclarationStatementSyntax)statement; 2627var us = (LocalDeclarationStatementSyntax)statement; 2843var us = (LocalDeclarationStatementSyntax)statement; 2946var us = (LocalDeclarationStatementSyntax)statement; 3029var us = (LocalDeclarationStatementSyntax)statement; 3101var us = (LocalDeclarationStatementSyntax)statement; 3348var decl = (LocalDeclarationStatementSyntax)statement;
Microsoft.CodeAnalysis.CSharp.Workspaces (46)
Classification\ClassificationHelpers.cs (1)
240LocalDeclarationStatementSyntax localDeclarationStatement => localDeclarationStatement.IsConst ? ClassificationTypeNames.ConstantName : ClassificationTypeNames.LocalName,
CodeGeneration\CSharpSyntaxGenerator.cs (19)
1283FlattenDeclaration(builder, declaration, ((LocalDeclarationStatementSyntax)declaration).Declaration); 1329SyntaxKind.LocalDeclarationStatement => ((LocalDeclarationStatementSyntax)declaration).Declaration.Variables.Count, 1656LocalDeclarationStatementSyntax localDecl => localDecl.WithModifiers(modifiers), 1913LocalDeclarationStatementSyntax localDeclaration => this.GetName(localDeclaration.Declaration), 1944LocalDeclarationStatementSyntax localDeclaration when localDeclaration.Declaration.Variables.Count == 1 => 1983return ((LocalDeclarationStatementSyntax)declaration).Declaration.Type; 2015SyntaxKind.LocalDeclarationStatement => ((LocalDeclarationStatementSyntax)declaration).WithDeclaration(((LocalDeclarationStatementSyntax)declaration).Declaration.WithType((TypeSyntax)type)), 2075SyntaxKind.LocalDeclarationStatement => ((LocalDeclarationStatementSyntax)declaration).Declaration, 2084SyntaxKind.LocalDeclarationStatement => ((LocalDeclarationStatementSyntax)declaration).WithDeclaration(variables), 2414var ld = (LocalDeclarationStatementSyntax)declaration; 2454var ld = (LocalDeclarationStatementSyntax)declaration; 2829var ld1 = (LocalDeclarationStatementSyntax)decl1; 2830var ld2 = (LocalDeclarationStatementSyntax)decl2; 2977SyntaxKind.LocalDeclarationStatement => ((LocalDeclarationStatementSyntax)declaration).Declaration.Variables,
Recommendations\CSharpRecommendationServiceRunner.cs (1)
351!contextNode.IsFoundUnder<LocalDeclarationStatementSyntax>(d => d.Declaration.Type) &&
Rename\LocalConflictVisitor.cs (1)
49if (statement is LocalDeclarationStatementSyntax declarationStatement)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs (2)
742LocalDeclarationStatementSyntax localDeclaration => localDeclaration.Modifiers, 756LocalDeclarationStatementSyntax localDeclaration => localDeclaration.WithModifiers(modifiers),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpAccessibilityFacts.cs (3)
228var ld = (LocalDeclarationStatementSyntax)declaration; 313LocalDeclarationStatementSyntax localDecl => localDecl.Modifiers,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpHeaderFacts.cs (1)
92var node = TryGetAncestorForLocation<LocalDeclarationStatementSyntax>(root, position);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (2)
1343((LocalDeclarationStatementSyntax)localDeclarationStatement).Declaration.Variables.Contains(variableDeclarator); 1383=> ((LocalDeclarationStatementSyntax)node).Declaration.Variables;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpUseExplicitTypeHelper.cs (1)
99if ((variableDeclaration.Parent as LocalDeclarationStatementSyntax)?.IsConst == true)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpUseImplicitTypeHelper.cs (1)
113if ((variableDeclaration.Parent as LocalDeclarationStatementSyntax)?.IsConst == true)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeRefactorings\CSharpRefactoringHelpersService.cs (2)
89if (node is LocalDeclarationStatementSyntax localDeclaration) 98if (declaration?.Parent is LocalDeclarationStatementSyntax localDeclarationStatement)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs (3)
1839token.Parent is LocalDeclarationStatementSyntax) 2088var localDeclaration = equalsValue.GetAncestor<LocalDeclarationStatementSyntax>(); 2348type.Parent?.Parent is LocalDeclarationStatementSyntax declStatement)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ExpressionSyntaxExtensions.cs (1)
173name.IsFoundUnder<LocalDeclarationStatementSyntax>(d => d.Declaration.Type) ||
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpMoveDeclarationNearReferenceService.cs (2)
23LocalDeclarationStatementSyntax, 54LocalDeclarationStatementSyntax declarationStatement,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpReplaceDiscardDeclarationsWithAssignmentsService.cs (5)
49case LocalDeclarationStatementSyntax localDeclarationStatement: 127private readonly LocalDeclarationStatementSyntax _localDeclarationStatement; 132private RemoveDiscardHelper(LocalDeclarationStatementSyntax localDeclarationStatement, SyntaxEditor editor) 141LocalDeclarationStatementSyntax localDeclarationStatement, 234var statement = LocalDeclarationStatement(
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpSemanticFactsService.cs (1)
132else if (node is LocalDeclarationStatementSyntax { Declaration.Variables: [{ Initializer.Value: { } value }] } localDeclaration)
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (7)
CodeGeneration\SyntaxGeneratorTests.cs (5)
491VerifySyntax<LocalDeclarationStatementSyntax>(Generator.LocalDeclarationStatement(Generator.IdentifierName("x"), "y"), "x y;"); 492VerifySyntax<LocalDeclarationStatementSyntax>(Generator.LocalDeclarationStatement(Generator.IdentifierName("x"), "y", Generator.IdentifierName("z")), "x y = z;"); 494VerifySyntax<LocalDeclarationStatementSyntax>(Generator.LocalDeclarationStatement(Generator.IdentifierName("x"), "y", isConst: true), "const x y;"); 495VerifySyntax<LocalDeclarationStatementSyntax>(Generator.LocalDeclarationStatement(Generator.IdentifierName("x"), "y", Generator.IdentifierName("z"), isConst: true), "const x y = z;"); 497VerifySyntax<LocalDeclarationStatementSyntax>(Generator.LocalDeclarationStatement("y", Generator.IdentifierName("z")), "var y = z;");
EmbeddedLanguages\VirtualChars\CSharpVirtualCharServiceTests.cs (2)
26var parsedStatement = (LocalDeclarationStatementSyntax)SyntaxFactory.ParseStatement(statement, options: options);
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (1)
Diagnostics\DiagnosticAnalyzerServiceTests.cs (1)
756var localDeclaration = root.DescendantNodes().OfType<CodeAnalysis.CSharp.Syntax.LocalDeclarationStatementSyntax>().First();
Microsoft.CodeAnalysis.Test.Utilities (2)
Diagnostics\CommonDiagnosticAnalyzers.cs (2)
2850foreach (var localDecl in root.DescendantNodes().OfType<CSharp.Syntax.LocalDeclarationStatementSyntax>())
Microsoft.Interop.ComInterfaceGenerator (1)
ComInterfaceGenerator.cs (1)
531var vtableDeclarationStatement =
Microsoft.Interop.LibraryImportGenerator (4)
Analyzers\ConvertToLibraryImportFixer.cs (4)
344LocalDeclarationStatementSyntax declaration = invocation.FirstAncestorOrSelf<LocalDeclarationStatementSyntax>(); 361var declaration = (LocalDeclarationStatementSyntax)node;
Microsoft.Interop.SourceGeneration (14)
Marshalling\ElementsMarshalling.cs (4)
331LocalDeclarationStatementSyntax managedValuesDeclaration = Declare(SpanOf(elementMarshaller.TypeInfo.ManagedType.Syntax), 348LocalDeclarationStatementSyntax unmanagedValuesDeclaration = Declare( 418LocalDeclarationStatementSyntax unmanagedValuesSource = Declare( 435LocalDeclarationStatementSyntax managedValuesDestination = LocalDeclarationStatement(VariableDeclaration(
Marshalling\StatefulMarshallingStrategy.cs (1)
129LocalDeclarationStatementSyntax declaration = Declare(
Utils\SyntaxFactoryExtensions.cs (2)
18public static LocalDeclarationStatementSyntax Declare(TypeSyntax typeSyntax, string identifier, bool initializeToDefault) 28public static LocalDeclarationStatementSyntax Declare(TypeSyntax typeSyntax, string identifier, ExpressionSyntax? initializer)
VariableDeclarations.cs (7)
15public ImmutableArray<LocalDeclarationStatementSyntax> Variables { get; init; } 19ImmutableArray<LocalDeclarationStatementSyntax>.Builder variables = ImmutableArray.CreateBuilder<LocalDeclarationStatementSyntax>(); 55static void AppendVariableDeclarations(ImmutableArray<LocalDeclarationStatementSyntax>.Builder statementsToUpdate, IBoundMarshallingGenerator marshaller, StubIdentifierContext context, bool initializeToDefault) 82ImmutableArray<LocalDeclarationStatementSyntax>.Builder variables = ImmutableArray.CreateBuilder<LocalDeclarationStatementSyntax>(); 112static void AppendVariableDeclarations(ImmutableArray<LocalDeclarationStatementSyntax>.Builder statementsToUpdate, IBoundMarshallingGenerator marshaller, StubIdentifierContext context, bool initializeToDefault)
Microsoft.ML.InternalCodeAnalyzer (2)
ParameterVariableNameAnalyzer.cs (2)
49var node = (LocalDeclarationStatementSyntax)context.Node;
Microsoft.VisualStudio.LanguageServices.CSharp (3)
CodeModel\MethodXml\MethodXmlBuilder.cs (2)
67success = TryGenerateLocal((LocalDeclarationStatementSyntax)statement); 88private bool TryGenerateLocal(LocalDeclarationStatementSyntax localDeclarationStatement)
LanguageService\CSharpHelpContextService.cs (1)
507if (token.IsKind(SyntaxKind.UsingKeyword) && token.Parent is UsingStatementSyntax or LocalDeclarationStatementSyntax)