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