332 references to GetDeclaredSymbol
Microsoft.CodeAnalysis.CSharp.CodeStyle (7)
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForBuilderDiagnosticAnalyzer.cs (1)
160
initializedSymbol: semanticModel.
GetDeclaredSymbol
(declarator, cancellationToken));
src\Analyzers\CSharp\Analyzers\UseLocalFunction\CSharpUseLocalFunctionDiagnosticAnalyzer.cs (1)
110
var local = semanticModel.
GetDeclaredSymbol
(localDeclaration.Declaration.Variables[0], cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SemanticModelExtensions.cs (4)
228
return semanticModel.
GetDeclaredSymbol
(
239
return semanticModel.
GetDeclaredSymbol
(
300
var symbol = semanticModel.
GetDeclaredSymbol
(variableDeclaration.Variables[0], cancellationToken);
498
return semanticModel.
GetDeclaredSymbol
(syntax, cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (1)
1231
var symbol = semanticModel.
GetDeclaredSymbol
(variableDeclarator, cancellationToken);
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (6)
src\Analyzers\CSharp\CodeFixes\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.cs (1)
80
declaratorToRemoveType = semanticModel.
GetDeclaredSymbol
(declaratorToRemoveNode, cancellationToken).GetSymbolType();
src\Analyzers\CSharp\CodeFixes\InlineDeclaration\CSharpInlineDeclarationCodeFixProvider.cs (1)
218
var local = (ILocalSymbol)semanticModel.
GetDeclaredSymbol
(declarator, cancellationToken);
src\Analyzers\CSharp\CodeFixes\UseLocalFunction\CSharpUseLocalFunctionCodeFixProvider.cs (1)
136
var localSymbol = semanticModel.
GetDeclaredSymbol
(
src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpAsAndNullCheckCodeFixProvider.cs (1)
138
if (semanticModel.
GetDeclaredSymbol
(declarator, cancellationToken) is ILocalSymbol local)
src\Analyzers\CSharp\CodeFixes\UseSystemThreadingLock\CSharpUseSystemThreadingLockCodeFixProvider.cs (1)
93
if (semanticModel.
GetDeclaredSymbol
(variableDeclarator, cancellationToken) is not IFieldSymbol field)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (1)
2178
var symbol = SemanticModel.
GetDeclaredSymbol
(variableDeclarator);
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (78)
CodeGen\CodeGenDeconstructTests.cs (8)
1370
Assert.Equal("(System.Int32 x, System.Int32 y) z", model.
GetDeclaredSymbol
(x).ToTestDisplayString());
1427
Assert.Equal("(System.Int32 x, System.Int32 y) z", model.
GetDeclaredSymbol
(x).ToTestDisplayString());
1670
Assert.Equal("(System.Int32 x, System.Int32 y) a", model.
GetDeclaredSymbol
(declarations.ElementAt(4)).ToTestDisplayString());
1672
Assert.Equal("(System.Int32, System.Int32) b", model.
GetDeclaredSymbol
(declarations.ElementAt(5)).ToTestDisplayString());
1674
Assert.Equal("(System.Int32, System.Int32 x) c", model.
GetDeclaredSymbol
(declarations.ElementAt(6)).ToTestDisplayString());
1676
var x = (ILocalSymbol)model.
GetDeclaredSymbol
(declarations.ElementAt(7));
1681
model.
GetDeclaredSymbol
(declarations.ElementAt(8)).ToTestDisplayString());
5473
var firstX1Symbol = model.
GetDeclaredSymbol
(firstX1);
CodeGen\CodeGenRefLocalTests.cs (3)
4043
Assert.Equal("System.Int32 x", model.
GetDeclaredSymbol
(xDecl).ToTestDisplayString());
4080
Assert.Equal("C x", model.
GetDeclaredSymbol
(xDecl).ToTestDisplayString());
4114
Assert.Equal("System.Int32 x", model.
GetDeclaredSymbol
(xDecl).ToTestDisplayString());
CodeGen\CodeGenTupleTest.cs (67)
1616
var xSymbol = model.
GetDeclaredSymbol
(x).GetSymbol<SourceLocalSymbol>().Type;
3224
model.
GetDeclaredSymbol
(x).ToTestDisplayString());
3257
model.
GetDeclaredSymbol
(x).ToTestDisplayString());
4025
var resultSymbol = model.
GetDeclaredSymbol
(result);
8300
Assert.Equal("(System.Int16 a, System.String b)? x", model.
GetDeclaredSymbol
(x).ToTestDisplayString());
8357
Assert.Equal("(System.Int16 a, System.String b)? x", model.
GetDeclaredSymbol
(x).ToTestDisplayString());
8415
Assert.Equal("(System.Int16 a, System.String b)? x", model.
GetDeclaredSymbol
(x).ToTestDisplayString());
8462
Assert.Equal("(System.Int16 a, System.String b)? x", model.
GetDeclaredSymbol
(x).ToTestDisplayString());
8559
Assert.Equal("(System.Int32 a, System.String b)? x", model.
GetDeclaredSymbol
(x).ToTestDisplayString());
8606
Assert.Equal("(System.Int32 a, System.String b)? x", model.
GetDeclaredSymbol
(x).ToTestDisplayString());
8641
Assert.Equal("(System.Int32 a, System.String b)? x", model.
GetDeclaredSymbol
(x).ToTestDisplayString());
8670
Assert.Equal("(System.Int32 a, System.String b) x", model.
GetDeclaredSymbol
(x).ToTestDisplayString());
8699
Assert.Equal("(System.Int32 a, System.String b) x", model.
GetDeclaredSymbol
(x).ToTestDisplayString());
8728
Assert.Equal("(System.Int16 a, System.String b) x", model.
GetDeclaredSymbol
(x).ToTestDisplayString());
8784
Assert.Equal("(System.Int16 a, System.String b) x", model.
GetDeclaredSymbol
(x).ToTestDisplayString());
8813
Assert.Equal("(System.Int16 a, System.String b) x", model.
GetDeclaredSymbol
(x).ToTestDisplayString());
8857
Assert.Equal("(System.Int16 a, System.String b) x", model.
GetDeclaredSymbol
(x).ToTestDisplayString());
8902
Assert.Equal("(System.Int16 a, System.String b) x", model.
GetDeclaredSymbol
(x).ToTestDisplayString());
8967
Assert.Equal("(System.Int16 a, System.String b) x", model.
GetDeclaredSymbol
(x).ToTestDisplayString());
9857
Assert.Equal("(System.Int32 a, dynamic) t1", model.
GetDeclaredSymbol
(t1).ToTestDisplayString());
9860
Assert.Equal("(System.Int32 a, dynamic) t2", model.
GetDeclaredSymbol
(t2).ToTestDisplayString());
9863
Assert.Equal("(System.Int32 a, dynamic) t3", model.
GetDeclaredSymbol
(t3).ToTestDisplayString());
9866
Assert.Equal("dynamic d1", model.
GetDeclaredSymbol
(d1).ToTestDisplayString());
9869
Assert.Equal("dynamic d2", model.
GetDeclaredSymbol
(d2).ToTestDisplayString());
9872
Assert.Equal("T d3", model.
GetDeclaredSymbol
(d3).ToTestDisplayString());
9908
Assert.Equal("((System.Int32 a, dynamic), System.Int32 c)[] t1", model.
GetDeclaredSymbol
(t1).ToTestDisplayString());
9911
Assert.Equal("((System.Int32 a, dynamic), System.Int32 c)[] t2", model.
GetDeclaredSymbol
(t2).ToTestDisplayString());
9914
Assert.Equal("((System.Int32 a, dynamic), System.Int32 c)[] t3", model.
GetDeclaredSymbol
(t3).ToTestDisplayString());
9951
model.
GetDeclaredSymbol
(t1).ToTestDisplayString());
9955
model.
GetDeclaredSymbol
(t2).ToTestDisplayString());
9959
model.
GetDeclaredSymbol
(t3).ToTestDisplayString());
9997
model.
GetDeclaredSymbol
(t1).ToTestDisplayString());
10001
model.
GetDeclaredSymbol
(t2).ToTestDisplayString());
10005
model.
GetDeclaredSymbol
(t3).ToTestDisplayString());
10060
Assert.Equal("(System.Int32, System.Int32, System.Int32) t1", model.
GetDeclaredSymbol
(t1).ToTestDisplayString());
10099
Assert.Equal("System.Collections.Generic.IEnumerable<(System.Int32 a, dynamic)> t1", model.
GetDeclaredSymbol
(t1).ToTestDisplayString());
10102
Assert.Equal("System.Collections.Generic.IEnumerable<(System.Int32 a, dynamic)> t2", model.
GetDeclaredSymbol
(t2).ToTestDisplayString());
10135
Assert.Equal("(System.Int64 a, System.Int64 d) t1", model.
GetDeclaredSymbol
(t1).ToTestDisplayString());
10138
Assert.Equal("(System.Int64 a, System.Int64 d) t2", model.
GetDeclaredSymbol
(t2).ToTestDisplayString());
16569
var xSymbol = (INamedTypeSymbol)((ILocalSymbol)model.
GetDeclaredSymbol
(x)).Type;
16606
var xSymbol = (INamedTypeSymbol)((ILocalSymbol)model.
GetDeclaredSymbol
(x)).Type;
17438
var x1Symbol = (ILocalSymbol)model.
GetDeclaredSymbol
(x1);
19231
var x1 = model.
GetDeclaredSymbol
(nodes.OfType<VariableDeclaratorSyntax>().Skip(1).First());
19234
var x2 = model.
GetDeclaredSymbol
(nodes.OfType<VariableDeclaratorSyntax>().Skip(5).First());
19293
var x1 = model.
GetDeclaredSymbol
(nodes.OfType<VariableDeclaratorSyntax>().ElementAt(2));
19296
var x2 = model.
GetDeclaredSymbol
(nodes.OfType<VariableDeclaratorSyntax>().ElementAt(3));
19299
var x3 = model.
GetDeclaredSymbol
(nodes.OfType<VariableDeclaratorSyntax>().ElementAt(4));
19302
var x4 = model.
GetDeclaredSymbol
(nodes.OfType<VariableDeclaratorSyntax>().ElementAt(5));
19305
var x5 = model.
GetDeclaredSymbol
(nodes.OfType<VariableDeclaratorSyntax>().ElementAt(6));
19308
var x6 = model.
GetDeclaredSymbol
(nodes.OfType<VariableDeclaratorSyntax>().ElementAt(7));
19311
var x7 = model.
GetDeclaredSymbol
(nodes.OfType<VariableDeclaratorSyntax>().ElementAt(8));
19314
var x8 = model.
GetDeclaredSymbol
(nodes.OfType<VariableDeclaratorSyntax>().ElementAt(9));
19317
var x9 = model.
GetDeclaredSymbol
(nodes.OfType<VariableDeclaratorSyntax>().ElementAt(10));
19320
var x6double = model.
GetDeclaredSymbol
(nodes.OfType<VariableDeclaratorSyntax>().ElementAt(11));
19396
var x1 = model.
GetDeclaredSymbol
(nodes.OfType<VariableDeclaratorSyntax>().Skip(1).First());
19399
var x2 = model.
GetDeclaredSymbol
(nodes.OfType<VariableDeclaratorSyntax>().Skip(2).First());
19426
var x1 = model.
GetDeclaredSymbol
(nodes.OfType<VariableDeclaratorSyntax>().Skip(1).First());
19480
var x1 = model.
GetDeclaredSymbol
(nodes.OfType<VariableDeclaratorSyntax>().First());
19538
var x1 = model.
GetDeclaredSymbol
(nodes.OfType<VariableDeclaratorSyntax>().First());
21353
Assert.Equal("<anonymous type: (System.Int32 a, System.Int32 b) Tuple> x1", model.
GetDeclaredSymbol
(x1).ToTestDisplayString());
21356
Assert.Equal("<anonymous type: (System.Int32 c, System.Int32) Tuple> x2", model.
GetDeclaredSymbol
(x2).ToTestDisplayString());
22858
var xSymbol = ((ILocalSymbol)model.
GetDeclaredSymbol
(x)).Type;
24397
var collectionSymbol = (model.
GetDeclaredSymbol
(collection) as ILocalSymbol)?.Type;
24470
var collectionSymbol = (model.
GetDeclaredSymbol
(collection) as ILocalSymbol)?.Type;
24543
var collectionSymbol = (model.
GetDeclaredSymbol
(collection) as ILocalSymbol)?.Type;
24617
var collectionSymbol = (model.
GetDeclaredSymbol
(collection) as ILocalSymbol)?.Type;
25026
var xSymbol = ((ILocalSymbol)model.
GetDeclaredSymbol
(x)).Type;
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (1)
Emit\NumericIntPtrTests.cs (1)
705
var actualLocals = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Select(d => model.
GetDeclaredSymbol
(d).ToDisplayString(TestFormat));
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (17)
FirstClassSpanTests.cs (1)
5033
var aSymbol = (ILocalSymbol)model.
GetDeclaredSymbol
(aVariable)!;
PartialEventsAndConstructorsTests.cs (3)
1995
var defSymbol = (IEventSymbol)model.
GetDeclaredSymbol
(eventDefs[0])!;
2013
var defSymbol = (IEventSymbol)model.
GetDeclaredSymbol
(eventDefs[1])!;
2071
var defSymbol = (IEventSymbol)model.
GetDeclaredSymbol
(tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single())!;
RefReadonlyParameterTests.cs (1)
1523
var symbol = model.
GetDeclaredSymbol
(local).GetSymbol<LocalSymbol>()!.Type as FunctionPointerTypeSymbol;
RefStructInterfacesTests.cs (1)
21706
var local = model.
GetDeclaredSymbol
(declarator).GetSymbol<LocalSymbol>();
Semantics\LockTests.cs (1)
184
var localSymbol = (ILocalSymbol)model.
GetDeclaredSymbol
(localDecl.Declaration.Variables.Single())!;
Semantics\OutVarTests.cs (6)
9703
Assert.Equal("System.Boolean d", model.
GetDeclaredSymbol
(d).ToTestDisplayString());
21371
var symbol = (ILocalSymbol)model.
GetDeclaredSymbol
(e);
32232
var b = (IFieldSymbol)model.
GetDeclaredSymbol
(tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(d => d.Identifier.ValueText == "b").Single());
32272
var b = (IFieldSymbol)model.
GetDeclaredSymbol
(tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(d => d.Identifier.ValueText == "b").Single());
32312
var a = (IFieldSymbol)model.
GetDeclaredSymbol
(tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(d => d.Identifier.ValueText == "a").Single());
32386
var b = (IFieldSymbol)model.
GetDeclaredSymbol
(bDecl);
Semantics\PatternMatchingTestBase.cs (1)
167
var symbol = model.
GetDeclaredSymbol
(declarator);
Semantics\PatternMatchingTests_ListPatterns.cs (1)
3337
var local = (ILocalSymbol)model.
GetDeclaredSymbol
(declaration)!;
Semantics\PatternMatchingTests_Scope.cs (2)
6526
Assert.Equal("System.Boolean d", model.
GetDeclaredSymbol
(d).ToTestDisplayString());
12212
var symbol = (ILocalSymbol)model.
GetDeclaredSymbol
(e);
Microsoft.CodeAnalysis.CSharp.Features (13)
CodeRefactorings\InlineTemporary\InlineTemporaryCodeRefactoringProvider.cs (1)
451
var localSymbol = (ILocalSymbol)semanticModel.
GetDeclaredSymbol
(variableDeclarator, cancellationToken);
ConvertProgram\ConvertProgramTransform_TopLevelStatements.cs (1)
298
var field = (IFieldSymbol?)semanticModel.
GetDeclaredSymbol
(variable, cancellationToken);
EncapsulateField\CSharpEncapsulateFieldService.cs (2)
93
var field = semanticModel.
GetDeclaredSymbol
(declarator, cancellationToken) as IFieldSymbol;
148
.Select(d => semanticModel.
GetDeclaredSymbol
(d, cancellationToken) as IFieldSymbol)
QuickInfo\CSharpSemanticQuickInfoProvider.cs (1)
113
var variable = semanticModel.
GetDeclaredSymbol
(declarator, cancellationToken);
ReverseForStatement\CSharpReverseForStatementCodeRefactoringProvider.cs (1)
90
var local = semanticModel.
GetDeclaredSymbol
(variable, cancellationToken) as ILocalSymbol;
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForBuilderDiagnosticAnalyzer.cs (1)
160
initializedSymbol: semanticModel.
GetDeclaredSymbol
(declarator, cancellationToken));
src\Analyzers\CSharp\Analyzers\UseLocalFunction\CSharpUseLocalFunctionDiagnosticAnalyzer.cs (1)
110
var local = semanticModel.
GetDeclaredSymbol
(localDeclaration.Declaration.Variables[0], cancellationToken);
src\Analyzers\CSharp\CodeFixes\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.cs (1)
80
declaratorToRemoveType = semanticModel.
GetDeclaredSymbol
(declaratorToRemoveNode, cancellationToken).GetSymbolType();
src\Analyzers\CSharp\CodeFixes\InlineDeclaration\CSharpInlineDeclarationCodeFixProvider.cs (1)
218
var local = (ILocalSymbol)semanticModel.
GetDeclaredSymbol
(declarator, cancellationToken);
src\Analyzers\CSharp\CodeFixes\UseLocalFunction\CSharpUseLocalFunctionCodeFixProvider.cs (1)
136
var localSymbol = semanticModel.
GetDeclaredSymbol
(
src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpAsAndNullCheckCodeFixProvider.cs (1)
138
if (semanticModel.
GetDeclaredSymbol
(declarator, cancellationToken) is ILocalSymbol local)
src\Analyzers\CSharp\CodeFixes\UseSystemThreadingLock\CSharpUseSystemThreadingLockCodeFixProvider.cs (1)
93
if (semanticModel.
GetDeclaredSymbol
(variableDeclarator, cancellationToken) is not IFieldSymbol field)
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (122)
Semantics\AwaitExpressionTests.cs (1)
447
var symbolV = (ILocalSymbol)semanticModel.
GetDeclaredSymbol
(decl);
Semantics\ConstantTests.cs (2)
4082
Assert.Equal("System.String x", model.
GetDeclaredSymbol
(xDeclarator).ToTestDisplayString(includeNonNullable: false));
4103
Assert.Equal("System.String x", model.
GetDeclaredSymbol
(xDeclarator).ToTestDisplayString(includeNonNullable: false));
Semantics\DeconstructionTests.cs (1)
1845
model.
GetDeclaredSymbol
(y).ToTestDisplayString());
Semantics\DelegateTypeTests.cs (4)
10469
var symbol = model.
GetDeclaredSymbol
(variable);
14455
var local = (ILocalSymbol)model.
GetDeclaredSymbol
(variable)!;
19866
Assert.Equal("System.Func<?>[] tests", model.
GetDeclaredSymbol
(declarator).ToTestDisplayString());
19908
Assert.Equal("?[] tests", model.
GetDeclaredSymbol
(declarator).ToTestDisplayString());
Semantics\FunctionPointerTests.cs (3)
2090
var local = (ILocalSymbol)model.
GetDeclaredSymbol
(localSyntax)!;
3807
Assert.Equal("delegate*<System.Void> C.field", model.
GetDeclaredSymbol
(fieldVariable).ToTestDisplayString());
3823
Assert.Equal("delegate*<System.Void> local", model.
GetDeclaredSymbol
(localVariable).ToTestDisplayString());
Semantics\LambdaTests.cs (1)
8114
var constSymbol = model.
GetDeclaredSymbol
(decls[0].Declaration.Variables.Single());
Semantics\LocalFunctionTests.cs (3)
1721
var localSymbol = model.
GetDeclaredSymbol
(x).ContainingSymbol.GetSymbol<LocalFunctionSymbol>();
4734
var symbol = (ILocalSymbol)model.
GetDeclaredSymbol
(declarator);
7101
var actualSymbols = nodes.Select(n => model.
GetDeclaredSymbol
(n)).ToTestDisplayStrings();
Semantics\LockTests.cs (3)
46
var localSymbol = (ILocalSymbol)model.
GetDeclaredSymbol
(localDecl.Declaration.Variables.Single());
605
var symbol = (ILocalSymbol)model.
GetDeclaredSymbol
(localDecl.Declaration.Variables.Single());
629
var symbol = (ILocalSymbol)model.
GetDeclaredSymbol
(localDecl.Declaration.Variables.Single());
Semantics\NativeIntegerTests.cs (3)
1794
var actualLocals = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Select(d => model.
GetDeclaredSymbol
(d).ToDisplayString(TestFormat));
2351
var actualLocals = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Select(d => model.
GetDeclaredSymbol
(d).ToDisplayString(TestFormat));
2471
var actualLocals = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Select(d => model.
GetDeclaredSymbol
(d).ToDisplayString(TestFormat));
Semantics\NullableReferenceTypesTests.cs (42)
5171
var local = (ILocalSymbol)model.
GetDeclaredSymbol
(declaration);
35002
var symbol = model.
GetDeclaredSymbol
(variable).GetSymbol<LocalSymbol>();
59060
var symbol = model.
GetDeclaredSymbol
(declarator).GetSymbol<LocalSymbol>();
59094
var symbol = model.
GetDeclaredSymbol
(declarator).GetSymbol<LocalSymbol>();
59122
var symbol = model.
GetDeclaredSymbol
(declarator).GetSymbol<LocalSymbol>();
59154
var symbol = model.
GetDeclaredSymbol
(declarator).GetSymbol<LocalSymbol>();
59183
var symbol = model.
GetDeclaredSymbol
(declarator).GetSymbol<LocalSymbol>();
59216
var symbol = model.
GetDeclaredSymbol
(declarator).GetSymbol<LocalSymbol>();
59248
var symbol = model.
GetDeclaredSymbol
(declarator).GetSymbol<LocalSymbol>();
59281
var symbol = model.
GetDeclaredSymbol
(declarator).GetSymbol<LocalSymbol>();
59315
var symbol = model.
GetDeclaredSymbol
(declarator).GetSymbol<LocalSymbol>();
59342
var symbol = model.
GetDeclaredSymbol
(declarator).GetSymbol<LocalSymbol>();
59370
var symbol = model.
GetDeclaredSymbol
(declarator).GetSymbol<LocalSymbol>();
59400
var symbol = model.
GetDeclaredSymbol
(declarators[0]).GetSymbol<LocalSymbol>();
59404
symbol = model.
GetDeclaredSymbol
(declarators[1]).GetSymbol<LocalSymbol>();
59408
symbol = model.
GetDeclaredSymbol
(declarators[2]).GetSymbol<LocalSymbol>();
71318
var symbol = model.
GetDeclaredSymbol
(declarators[0]).GetSymbol<LocalSymbol>();
71321
symbol = model.
GetDeclaredSymbol
(declarators[1]).GetSymbol<LocalSymbol>();
71354
var symbol = model.
GetDeclaredSymbol
(declarators[0]).GetSymbol<LocalSymbol>();
71357
symbol = model.
GetDeclaredSymbol
(declarators[1]).GetSymbol<LocalSymbol>();
71395
var symbol = model.
GetDeclaredSymbol
(declarators[0]).GetSymbol<LocalSymbol>();
71398
symbol = model.
GetDeclaredSymbol
(declarators[1]).GetSymbol<LocalSymbol>();
71432
var symbol = model.
GetDeclaredSymbol
(declarators[0]).GetSymbol<LocalSymbol>();
71435
symbol = model.
GetDeclaredSymbol
(declarators[1]).GetSymbol<LocalSymbol>();
71469
var symbol = model.
GetDeclaredSymbol
(declarators[0]).GetSymbol<LocalSymbol>();
71472
symbol = model.
GetDeclaredSymbol
(declarators[1]).GetSymbol<LocalSymbol>();
71504
var symbol = model.
GetDeclaredSymbol
(declarators[0]).GetSymbol<LocalSymbol>();
71507
symbol = model.
GetDeclaredSymbol
(declarators[1]).GetSymbol<LocalSymbol>();
71537
var symbol = model.
GetDeclaredSymbol
(declarators[0]).GetSymbol<LocalSymbol>();
71574
var symbol = model.
GetDeclaredSymbol
(declarators[0]).GetSymbol<LocalSymbol>();
71577
symbol = model.
GetDeclaredSymbol
(declarators[1]).GetSymbol<LocalSymbol>();
81325
var symbol = model.
GetDeclaredSymbol
(declarator).GetSymbol<LocalSymbol>();
94347
var symbol = model.
GetDeclaredSymbol
(localDeclaration);
145442
var local = (ILocalSymbol)model.
GetDeclaredSymbol
(declaration);
145483
var local = (ILocalSymbol)model.
GetDeclaredSymbol
(declaration);
145523
var local = (ILocalSymbol)model.
GetDeclaredSymbol
(declaration);
145561
var local = (ILocalSymbol)model.
GetDeclaredSymbol
(declaration);
145599
var local = (ILocalSymbol)model.
GetDeclaredSymbol
(declaration);
145703
var local = (ILocalSymbol)model.
GetDeclaredSymbol
(declaration);
145742
var local = (ILocalSymbol)model.
GetDeclaredSymbol
(declaration);
154972
var symbol = (ILocalSymbol)model.
GetDeclaredSymbol
(syntax);
158909
var local = (ILocalSymbol)model.
GetDeclaredSymbol
(declaration.Variables.Single());
Semantics\RefEscapingTests.cs (1)
72
return ((ILocalSymbol)model.
GetDeclaredSymbol
(decl)).Type;
Semantics\RefFieldTests.cs (30)
11189
var delegateType = (NamedTypeSymbol)model.
GetDeclaredSymbol
(decl).GetSymbol<LocalSymbol>().Type;
11284
var methods = decls.Select(d => ((FunctionPointerTypeSymbol)model.
GetDeclaredSymbol
(d).GetSymbol<LocalSymbol>().Type).Signature).ToArray();
12129
var locals = decls.Select(d => model.
GetDeclaredSymbol
(d).GetSymbol<LocalSymbol>()).ToArray();
12203
var f = model.
GetDeclaredSymbol
(decl).GetSymbol<FieldSymbol>();
12266
var locals = decls.Select(d => model.
GetDeclaredSymbol
(d).GetSymbol<LocalSymbol>()).ToArray();
13219
var locals = decls.Select(d => model.
GetDeclaredSymbol
(d).GetSymbol<LocalSymbol>()).ToArray();
13274
var locals = decls.Select(d => model.
GetDeclaredSymbol
(d).GetSymbol<LocalSymbol>()).ToArray();
13405
var locals = decls.Select(d => model.
GetDeclaredSymbol
(d).GetSymbol<LocalSymbol>()).ToArray();
13430
var locals = decls.Select(d => model.
GetDeclaredSymbol
(d).GetSymbol<LocalSymbol>()).ToArray();
13507
var locals = decls.Select(d => model.
GetDeclaredSymbol
(d).GetSymbol<LocalSymbol>()).ToArray();
13571
var locals = decls.Select(d => model.
GetDeclaredSymbol
(d).GetSymbol<LocalSymbol>()).ToArray();
13782
var locals = decls.Select(d => model.
GetDeclaredSymbol
(d).GetSymbol<LocalSymbol>()).ToArray();
14423
var locals = decls.Select(d => model.
GetDeclaredSymbol
(d).GetSymbol<LocalSymbol>()).ToArray();
14465
var locals = decls.Select(d => model.
GetDeclaredSymbol
(d).GetSymbol<LocalSymbol>()).ToArray();
14590
var locals = decls.Select(d => model.
GetDeclaredSymbol
(d).GetSymbol<LocalSymbol>()).ToArray();
18014
var delegateInvokeMethods = decls.Select(d => ((ILocalSymbol)model.
GetDeclaredSymbol
(d)).Type.GetSymbol<NamedTypeSymbol>().DelegateInvokeMethod).ToArray();
23439
var types = decls.Select(d => (NamedTypeSymbol)model.
GetDeclaredSymbol
(d).GetSymbol<LocalSymbol>().Type).ToArray();
23507
var types = decls.Select(d => (NamedTypeSymbol)model.
GetDeclaredSymbol
(d).GetSymbol<LocalSymbol>().Type).ToArray();
25367
var delegateType = (NamedTypeSymbol)model.
GetDeclaredSymbol
(decl).GetSymbol<LocalSymbol>().Type;
27408
var type = (NamedTypeSymbol)model.
GetDeclaredSymbol
(node).GetSymbol<LocalSymbol>().Type;
27460
var type = (NamedTypeSymbol)model.
GetDeclaredSymbol
(node).GetSymbol<LocalSymbol>().Type;
27512
var type = (NamedTypeSymbol)model.
GetDeclaredSymbol
(node).GetSymbol<LocalSymbol>().Type;
27665
var locals = decls.Select(d => model.
GetDeclaredSymbol
(d).GetSymbol<LocalSymbol>()).ToArray();
27755
var locals = decls.Select(d => model.
GetDeclaredSymbol
(d).GetSymbol<LocalSymbol>()).ToArray();
27875
var locals = decls.Select(d => model.
GetDeclaredSymbol
(d).GetSymbol<LocalSymbol>()).ToArray();
27976
var locals = decls.Select(d => model.
GetDeclaredSymbol
(d).GetSymbol<LocalSymbol>()).ToArray();
28021
var locals = decls.Select(d => model.
GetDeclaredSymbol
(d).GetSymbol<LocalSymbol>()).ToArray();
28081
var locals = decls.Select(d => model.
GetDeclaredSymbol
(d).GetSymbol<LocalSymbol>()).ToArray();
28311
var locals = decls.Select(d => model.
GetDeclaredSymbol
(d).GetSymbol<LocalSymbol>()).ToArray();
28359
var locals = decls.Select(d => model.
GetDeclaredSymbol
(d).GetSymbol<LocalSymbol>()).ToArray();
Semantics\ScriptSemanticsTests.cs (1)
539
var symbol0 = model.
GetDeclaredSymbol
(declarations[0]);
Semantics\TopLevelStatementsTests.cs (16)
483
var declSymbol = model1.
GetDeclaredSymbol
(localDecl);
535
var declSymbol = model1.
GetDeclaredSymbol
(localDecl);
575
var declSymbol = model1.
GetDeclaredSymbol
(localDecl);
702
var local = model.
GetDeclaredSymbol
(declarator);
872
var symbol1 = model1.
GetDeclaredSymbol
(tree1.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single());
878
var symbol2 = model2.
GetDeclaredSymbol
(tree2.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single());
986
var symbol1 = model1.
GetDeclaredSymbol
(tree1.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().First());
990
var symbol2 = model1.
GetDeclaredSymbol
(tree1.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Skip(1).Single());
1041
var symbol1 = model1.
GetDeclaredSymbol
(tree1.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().First());
1687
var declSymbol = model1.
GetDeclaredSymbol
(localDecl);
1860
var declSymbol = model1.
GetDeclaredSymbol
(localDecl);
6086
var declSymbol = model1.
GetDeclaredSymbol
(localDecl);
6102
declSymbol = model1.
GetDeclaredSymbol
(localDecl);
6336
var x = semanticModel.
GetDeclaredSymbol
(localDecl);
6381
var xDecl = semanticModel1.
GetDeclaredSymbol
(localDecl);
6432
var xDecl = semanticModel1.
GetDeclaredSymbol
(localDecl);
Semantics\UnsafeTests.cs (5)
6332
return ((ILocalSymbol)model.
GetDeclaredSymbol
(decl)).Type;
6391
return ((ILocalSymbol)model.
GetDeclaredSymbol
(decl)).Type;
7274
var declaredSymbol = model.
GetDeclaredSymbol
(syntax.Ancestors().OfType<VariableDeclaratorSyntax>().First());
10178
var declaredSymbols = declarators.Select(syntax => (ILocalSymbol)model.
GetDeclaredSymbol
(syntax)).ToArray();
10227
var declaredSymbols = declarators.Select(syntax => (ILocalSymbol)model.
GetDeclaredSymbol
(syntax)).ToArray();
Semantics\UsingStatementTests.cs (6)
62
var declaredSymbol = model.
GetDeclaredSymbol
(usingStatement.Declaration.Variables.Single());
1343
var declaredSymbol = model.
GetDeclaredSymbol
(usingStatement.Declaration.Variables.Single());
1378
var firstDeclaredSymbol = model.
GetDeclaredSymbol
(usingStatement.Declaration.Variables.First());
1382
var secondDeclaredSymbol = model.
GetDeclaredSymbol
(usingStatement.Declaration.Variables.Last());
1389
Assert.Equal(((ILocalSymbol)model.
GetDeclaredSymbol
(usingStatement.Declaration.Variables.First())).Type, typeInfo.Symbol);
1869
var symbol = model.
GetDeclaredSymbol
(x);
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (76)
Compilation\SemanticModelAPITests.cs (14)
210
Assert.Same(model.
GetDeclaredSymbol
(rxDecl.Variables.Single()), rxSymbol);
257
var symbol1 = model1.
GetDeclaredSymbol
(vardecl);
258
var symbol2 = model2.
GetDeclaredSymbol
(vardecl);
277
var symbol1 = model1.
GetDeclaredSymbol
(vardecl);
278
var symbol2 = model2.
GetDeclaredSymbol
(vardecl);
1741
var fieldSymbol = model.
GetDeclaredSymbol
(fieldDecl.Declaration.Variables.Single());
1787
var local = speculativeModel.
GetDeclaredSymbol
(declarator);
1840
var local = speculativeModel.
GetDeclaredSymbol
(declarator);
1853
local = speculativeModel.
GetDeclaredSymbol
(declarator);
2284
var symbol = speculativeModel.
GetDeclaredSymbol
(declarator);
2393
var local = speculativeModel.
GetDeclaredSymbol
(declarator);
2576
var local = speculativeModel.
GetDeclaredSymbol
(declarator);
2590
local = speculativeModel.
GetDeclaredSymbol
(declarator);
2604
local = speculativeModel.
GetDeclaredSymbol
(declarator);
Compilation\SemanticModelGetDeclaredSymbolAPITests.cs (9)
62
ISymbol rx = model.
GetDeclaredSymbol
(rxDecl.Variables.Single());
409
var eventSymbol = model.
GetDeclaredSymbol
(eventDecl.Declaration.Variables[0]);
570
var symbol = model.
GetDeclaredSymbol
(localDecl.Declaration.Variables[0]);
592
var symbol = model.
GetDeclaredSymbol
(localDecl.Declaration.Variables[0]);
596
symbol = model.
GetDeclaredSymbol
(localDecl.Declaration.Variables[1]);
778
var symbol = model.
GetDeclaredSymbol
(fieldDecl.Declaration.Variables[0]);
800
var symbol = model.
GetDeclaredSymbol
(fieldDecl.Declaration.Variables[0]);
804
symbol = model.
GetDeclaredSymbol
(fieldDecl.Declaration.Variables[1]);
949
var fSymbol = model.
GetDeclaredSymbol
(fieldDecl.Declaration.Variables[0]) as IFieldSymbol;
DocumentationComments\DocumentationCommentIDTests.cs (1)
166
var symbol = model.
GetDeclaredSymbol
(syntax);
SymbolDisplay\SymbolDisplayTests.cs (4)
6958
var local = (ILocalSymbol)semanticModel.
GetDeclaredSymbol
(declarator);
6991
var local = (ILocalSymbol)semanticModel.
GetDeclaredSymbol
(declarator);
7036
var local = (ILocalSymbol)semanticModel.
GetDeclaredSymbol
(declarator);
8991
var locals = decls.Select(d => model.
GetDeclaredSymbol
(d)).ToArray();
Symbols\AnonymousTypesSymbolTests.cs (2)
1689
var localA3 = model.
GetDeclaredSymbol
(statement3.Declaration.Variables[0]) as ILocalSymbol;
1690
var localA4 = model.
GetDeclaredSymbol
(statement4.Declaration.Variables[0]) as ILocalSymbol;
Symbols\ConversionTests.cs (1)
398
ITypeSymbol targetType = ((ILocalSymbol)model.
GetDeclaredSymbol
(variableDeclarator)).Type;
Symbols\FunctionPointerTypeSymbolTests.cs (5)
1932
Assert.Equal("delegate*<System.Int32> ptr1", model.
GetDeclaredSymbol
(decls[0]).ToTestDisplayString());
1933
Assert.Equal("delegate*<System.Int32> ptr2", model.
GetDeclaredSymbol
(decls[1]).ToTestDisplayString());
1934
Assert.Equal("delegate*<ref readonly modopt(System.Runtime.CompilerServices.RequiresLocationAttribute[missing]) System.Int32, System.Void> ptr3", model.
GetDeclaredSymbol
(decls[2]).ToTestDisplayString());
1935
Assert.Equal("delegate*<System.Void, System.Void> ptr4", model.
GetDeclaredSymbol
(decls[3]).ToTestDisplayString());
1936
Assert.Equal("delegate*<ref System.Void> ptr5", model.
GetDeclaredSymbol
(decls[4]).ToTestDisplayString());
Symbols\Source\DeclaringSyntaxNodeTests.cs (4)
264
var localA1 = (ILocalSymbol)model.
GetDeclaredSymbol
(declaratorA1);
309
(ILocalSymbol)model.
GetDeclaredSymbol
(declaratorQ),
316
(ILocalSymbol)model.
GetDeclaredSymbol
(declaratorX),
323
(ILocalSymbol)model.
GetDeclaredSymbol
(declaratorZ),
Symbols\Source\NullablePublicAPITests.cs (17)
1005
var localSymbol = (ILocalSymbol)model.
GetDeclaredSymbol
(v);
1177
var declaredSymbol = (ILocalSymbol)context.SemanticModel.
GetDeclaredSymbol
(declarator);
1948
var symbol = (ILocalSymbol)model.
GetDeclaredSymbol
(variable);
1995
var symbol = (ILocalSymbol)model.
GetDeclaredSymbol
(variable);
2139
Assert.Equal(PublicNullableAnnotation.Annotated, ((ILocalSymbol)specModel.
GetDeclaredSymbol
(newDeclarator)).NullableAnnotation);
2140
Assert.Equal(PublicNullableAnnotation.Annotated, ((ILocalSymbol)specModel.
GetDeclaredSymbol
(newDeclarator)).Type.NullableAnnotation);
2143
Assert.Equal(PublicNullableAnnotation.Annotated, ((ILocalSymbol)specModel.
GetDeclaredSymbol
(newDeclarator)).NullableAnnotation);
2144
Assert.Equal(PublicNullableAnnotation.Annotated, ((ILocalSymbol)specModel.
GetDeclaredSymbol
(newDeclarator)).Type.NullableAnnotation);
2187
var symbol = (ILocalSymbol)model.
GetDeclaredSymbol
(variable);
2219
var symbol = (ILocalSymbol)model.
GetDeclaredSymbol
(declaration);
2257
var symbol = (ILocalSymbol)model.
GetDeclaredSymbol
(variable);
2420
var symbol = (ILocalSymbol)model.
GetDeclaredSymbol
(variable);
3857
var o2Symbol = model.
GetDeclaredSymbol
(o2Declaration);
3880
Assert.Equal(localFunctionSymbol, model.
GetDeclaredSymbol
(o8Declaration).ContainingSymbol, SymbolEqualityComparer.IncludeNullability);
3918
var o2Symbol = (ILocalSymbol)model.
GetDeclaredSymbol
(o2Decl);
3932
var o4Symbol = (ILocalSymbol)model.
GetDeclaredSymbol
(o4Decl);
4048
var o2Symbol = model.
GetDeclaredSymbol
(o2Decl);
Symbols\Source\UpdatedContainingSymbolAndNullableAnntotationTests.cs (2)
38
var local1 = model.
GetDeclaredSymbol
(varDeclarators.First()).GetSymbol<SourceLocalSymbol>();
39
var local2 = model.
GetDeclaredSymbol
(varDeclarators.ElementAt(1)).GetSymbol<SourceLocalSymbol>();
Symbols\SymbolEqualityTests.cs (16)
416
var member1 = model.
GetDeclaredSymbol
(member1Syntax.Declaration.Variables[0]);
417
var member2 = model.
GetDeclaredSymbol
(member2Syntax.Declaration.Variables[0]);
454
var type1 = ((IFieldSymbol)model.
GetDeclaredSymbol
(member1Syntax.Declaration.Variables[0])).Type;
455
var type2 = ((IFieldSymbol)model.
GetDeclaredSymbol
(member2Syntax.Declaration.Variables[0])).Type;
485
var type1 = ((IFieldSymbol)model.
GetDeclaredSymbol
(member1Syntax.Declaration.Variables[0])).Type;
486
var type2 = ((IFieldSymbol)model.
GetDeclaredSymbol
(member2Syntax.Declaration.Variables[0])).Type;
528
var type1 = ((IFieldSymbol)model.
GetDeclaredSymbol
(member1Syntax.Declaration.Variables[0])).Type;
529
var type2 = ((IFieldSymbol)model.
GetDeclaredSymbol
(member2Syntax.Declaration.Variables[0])).Type;
559
var type1 = ((IFieldSymbol)model.
GetDeclaredSymbol
(member1Syntax.Declaration.Variables[0])).Type;
560
var type2 = ((IFieldSymbol)model.
GetDeclaredSymbol
(member2Syntax.Declaration.Variables[0])).Type;
630
var type1 = ((IFieldSymbol)model.
GetDeclaredSymbol
(member1Syntax.Declaration.Variables[0])).Type;
631
var type2 = ((IFieldSymbol)model.
GetDeclaredSymbol
(member2Syntax.Declaration.Variables[0])).Type;
679
var type1 = ((IFieldSymbol)model.
GetDeclaredSymbol
(member1Syntax.Declaration.Variables[0])).Type;
680
var type2 = ((IFieldSymbol)model.
GetDeclaredSymbol
(member2Syntax.Declaration.Variables[0])).Type;
731
var type1 = ((IFieldSymbol)model.
GetDeclaredSymbol
(member1Syntax.Declaration.Variables[0])).Type;
732
var type2 = ((IFieldSymbol)model.
GetDeclaredSymbol
(member2Syntax.Declaration.Variables[0])).Type;
Symbols\TypeTests.cs (1)
1765
var sym = model.
GetDeclaredSymbol
(node1.Declaration.Variables.First()) as ILocalSymbol;
Microsoft.CodeAnalysis.CSharp.Workspaces (6)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SemanticModelExtensions.cs (4)
228
return semanticModel.
GetDeclaredSymbol
(
239
return semanticModel.
GetDeclaredSymbol
(
300
var symbol = semanticModel.
GetDeclaredSymbol
(variableDeclaration.Variables[0], cancellationToken);
498
return semanticModel.
GetDeclaredSymbol
(syntax, cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (1)
1231
var symbol = semanticModel.
GetDeclaredSymbol
(variableDeclarator, cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (1)
2178
var symbol = SemanticModel.
GetDeclaredSymbol
(variableDeclarator);
Roslyn.Diagnostics.CSharp.Analyzers (6)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SemanticModelExtensions.cs (4)
228
return semanticModel.
GetDeclaredSymbol
(
239
return semanticModel.
GetDeclaredSymbol
(
300
var symbol = semanticModel.
GetDeclaredSymbol
(variableDeclaration.Variables[0], cancellationToken);
498
return semanticModel.
GetDeclaredSymbol
(syntax, cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (1)
1231
var symbol = semanticModel.
GetDeclaredSymbol
(variableDeclarator, cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (1)
2178
var symbol = SemanticModel.
GetDeclaredSymbol
(variableDeclarator);