2 implementations of ILocalSymbol
Microsoft.CodeAnalysis.CSharp (1)
Symbols\PublicModel\LocalSymbol.cs (1)
12internal sealed class LocalSymbol : Symbol, ILocalSymbol
Microsoft.CodeAnalysis.VisualBasic (1)
Symbols\Source\LocalSymbol.vb (1)
19Implements ILocalSymbol, ILocalSymbolInternal
799 references to ILocalSymbol
ILLink.RoslynAnalyzer (3)
DataFlow\LocalDataFlowVisitor.cs (1)
200 var local = localReference.Local;
DataFlow\LocalStateLattice.cs (2)
13 readonly ILocalSymbol? Local; 17 public LocalKey (ILocalSymbol symbol) => (Local, CaptureId) = (symbol, null);
Microsoft.Analyzers.Extra (7)
AsyncCallInsideUsingBlockAnalyzer.cs (7)
47var disposable = GetDisposableSymbol(operation.DeclarationGroup); 67var disposable = GetDisposableSymbol(declarationGroup); 72ILocalSymbol disposable, 145private static ILocalSymbol GetDisposableSymbol(IVariableDeclarationGroupOperation declarationGroup) 153private static bool IsTaskAwaited(IOperation block, ILocalSymbol taskSymbol) 182private static bool ReferencesSymbol(IOperation? operation, ILocalSymbol symbol) 207private static bool SymbolInArguments(IInvocationOperation invocation, ILocalSymbol symbol)
Microsoft.AspNetCore.App.CodeFixes (2)
Dependencies\AddPackageFixer.cs (1)
71ILocalSymbol localSymbol => localSymbol.Type,
Dependencies\ExtensionMethodsCompletionProvider.cs (1)
68ILocalSymbol localSymbol => localSymbol.Type,
Microsoft.CodeAnalysis (86)
Generated\FlowAnalysis.Generated.cs (1)
117ILocalSymbol Local { get; }
Generated\Operations.Generated.cs (53)
66ImmutableArray<ILocalSymbol> Locals { get; } 123ImmutableArray<ILocalSymbol> Locals { get; } 164ImmutableArray<ILocalSymbol> Locals { get; } 233ImmutableArray<ILocalSymbol> ConditionLocals { get; } 523ImmutableArray<ILocalSymbol> Locals { get; } 851ILocalSymbol Local { get; } 2323ImmutableArray<ILocalSymbol> Locals { get; } 2477ILocalSymbol Symbol { get; } 2616ImmutableArray<ILocalSymbol> Locals { get; } 2657ImmutableArray<ILocalSymbol> Locals { get; } 3054ImmutableArray<ILocalSymbol> Locals { get; } 3321ImmutableArray<ILocalSymbol> Locals { get; } 3371ImmutableArray<ILocalSymbol> Locals { get; } 4001internal BlockOperation(ImmutableArray<IOperation> operations, ImmutableArray<ILocalSymbol> locals, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 4008public ImmutableArray<ILocalSymbol> Locals { get; } 4113internal SwitchOperation(ImmutableArray<ILocalSymbol> locals, IOperation value, ImmutableArray<ISwitchCaseOperation> cases, ILabelSymbol exitLabel, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 4121public ImmutableArray<ILocalSymbol> Locals { get; } 4183protected BaseLoopOperation(IOperation body, ImmutableArray<ILocalSymbol> locals, ILabelSymbol continueLabel, ILabelSymbol exitLabel, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 4193public ImmutableArray<ILocalSymbol> Locals { get; } 4199internal ForEachLoopOperation(IOperation loopControlVariable, IOperation collection, ImmutableArray<IOperation> nextVariables, ForEachLoopOperationInfo? info, bool isAsynchronous, IOperation body, ImmutableArray<ILocalSymbol> locals, ILabelSymbol continueLabel, ILabelSymbol exitLabel, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 4289internal ForLoopOperation(ImmutableArray<IOperation> before, ImmutableArray<ILocalSymbol> conditionLocals, IOperation? condition, ImmutableArray<IOperation> atLoopBottom, IOperation body, ImmutableArray<ILocalSymbol> locals, ILabelSymbol continueLabel, ILabelSymbol exitLabel, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 4298public ImmutableArray<ILocalSymbol> ConditionLocals { get; } 4381internal ForToLoopOperation(IOperation loopControlVariable, IOperation initialValue, IOperation limitValue, IOperation stepValue, bool isChecked, ImmutableArray<IOperation> nextVariables, (ILocalSymbol LoopObject, ForToLoopOperationUserDefinedInfo UserDefinedInfo) info, IOperation body, ImmutableArray<ILocalSymbol> locals, ILabelSymbol continueLabel, ILabelSymbol exitLabel, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 4398public (ILocalSymbol LoopObject, ForToLoopOperationUserDefinedInfo UserDefinedInfo) Info { get; } 4493internal WhileLoopOperation(IOperation? condition, bool conditionIsTop, bool conditionIsUntil, IOperation? ignoredCondition, IOperation body, ImmutableArray<ILocalSymbol> locals, ILabelSymbol continueLabel, ILabelSymbol exitLabel, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 4656internal LockOperation(IOperation lockedValue, IOperation body, ILocalSymbol? lockTakenSymbol, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 4665public ILocalSymbol? LockTakenSymbol { get; } 4799internal UsingOperation(IOperation resources, IOperation body, ImmutableArray<ILocalSymbol> locals, bool isAsynchronous, DisposeOperationInfo disposeInfo, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 4810public ImmutableArray<ILocalSymbol> Locals { get; } 5294internal LocalReferenceOperation(ILocalSymbol local, bool isDeclaration, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, ConstantValue? constantValue, bool isImplicit) 5302public ILocalSymbol Local { get; } 7499protected BaseSymbolInitializerOperation(ImmutableArray<ILocalSymbol> locals, IOperation value, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 7505public ImmutableArray<ILocalSymbol> Locals { get; } 7510internal FieldInitializerOperation(ImmutableArray<IFieldSymbol> initializedFields, ImmutableArray<ILocalSymbol> locals, IOperation value, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 7561internal VariableInitializerOperation(ImmutableArray<ILocalSymbol> locals, IOperation value, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 7608internal PropertyInitializerOperation(ImmutableArray<IPropertySymbol> initializedProperties, ImmutableArray<ILocalSymbol> locals, IOperation value, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 7659internal ParameterInitializerOperation(IParameterSymbol parameter, ImmutableArray<ILocalSymbol> locals, IOperation value, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 7765internal VariableDeclaratorOperation(ILocalSymbol symbol, IVariableInitializerOperation? initializer, ImmutableArray<IOperation> ignoredArguments, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 7772public ILocalSymbol Symbol { get; } 7975internal CatchClauseOperation(IOperation? exceptionDeclarationOrExpression, ITypeSymbol exceptionType, ImmutableArray<ILocalSymbol> locals, IOperation? filter, IBlockOperation handler, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 7986public ImmutableArray<ILocalSymbol> Locals { get; } 8052internal SwitchCaseOperation(ImmutableArray<ICaseClauseOperation> clauses, ImmutableArray<IOperation> body, ImmutableArray<ILocalSymbol> locals, IOperation? condition, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 8062public ImmutableArray<ILocalSymbol> Locals { get; } 8724internal ConstructorBodyOperation(ImmutableArray<ILocalSymbol> locals, IOperation? initializer, IBlockOperation? blockBody, IBlockOperation? expressionBody, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 8730public ImmutableArray<ILocalSymbol> Locals { get; } 8959internal StaticLocalInitializationSemaphoreOperation(ILocalSymbol local, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 8965public ILocalSymbol Local { get; } 9386internal SwitchExpressionArmOperation(IPatternOperation pattern, IOperation? guard, IOperation value, ImmutableArray<ILocalSymbol> locals, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 9397public ImmutableArray<ILocalSymbol> Locals { get; } 9586internal FixedOperation(ImmutableArray<ILocalSymbol> locals, IVariableDeclarationGroupOperation variables, IOperation body, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 9593public ImmutableArray<ILocalSymbol> Locals { get; }
Operations\ControlFlowGraphBuilder.cs (15)
3793ILocalSymbol local = ((IVariableDeclaratorOperation)exceptionDeclarationOrExpression).Symbol; 3955private void HandleUsingOperationParts(IOperation resources, IOperation body, IMethodSymbol? disposeMethod, ImmutableArray<IArgumentOperation> disposeArguments, ImmutableArray<ILocalSymbol> locals, bool isAsynchronous, 4018ILocalSymbol localSymbol = declarator.Symbol; 4232locals: ImmutableArray<ILocalSymbol>.Empty, 4311ImmutableArray<ILocalSymbol>.Empty); 4476ILocalSymbol local = declarator.Symbol; 4660ILocalSymbol local = declarator.Symbol; 4733(ILocalSymbol loopObject, ForToLoopOperationUserDefinedInfo userDefinedInfo) = ((ForToLoopOperation)operation).Info; 4735ImmutableArray<ILocalSymbol> locals = operation.Locals; 5429ILocalSymbol local = declarator.Symbol; 5469ImmutableArray<ILocalSymbol> locals = getLocals(); 5493ImmutableArray<ILocalSymbol> getLocals() 5495ImmutableArray<ILocalSymbol> l = operation.Locals; 5824ILocalSymbol localSymbol = declarator.Symbol; 7842locals: ImmutableArray<ILocalSymbol>.Empty,
Operations\ControlFlowGraphBuilder.RegionBuilder.cs (2)
23public ImmutableArray<ILocalSymbol> Locals; 31public RegionBuilder(ControlFlowRegionKind kind, ITypeSymbol? exceptionType = null, ImmutableArray<ILocalSymbol> locals = default, bool isStackSpillRegion = false)
Operations\ControlFlowRegion.cs (2)
51public ImmutableArray<ILocalSymbol> Locals { get; } 65ImmutableArray<ILocalSymbol> locals,
Operations\OperationExtensions.cs (5)
128public static ImmutableArray<ILocalSymbol> GetDeclaredVariables(this IVariableDeclarationGroupOperation declarationGroup) 135var arrayBuilder = ArrayBuilder<ILocalSymbol>.GetInstance(); 148public static ImmutableArray<ILocalSymbol> GetDeclaredVariables(this IVariableDeclarationOperation declaration) 155var arrayBuilder = ArrayBuilder<ILocalSymbol>.GetInstance(); 160private static void GetDeclaredVariables(this IVariableDeclarationOperation declaration, ArrayBuilder<ILocalSymbol> arrayBuilder)
Operations\OperationNodes.cs (2)
675public StaticLocalInitializationSemaphoreOperation(ILocalSymbol local, SyntaxNode syntax, ITypeSymbol type) : 701Locals = ImmutableArray<ILocalSymbol>.Empty;
SymbolDisplay\AbstractSymbolDisplayVisitor_Minimal.cs (2)
99var localSymbol = symbol as ILocalSymbol;
Symbols\ILabelSymbol.cs (1)
19/// Gets the immediately containing <see cref="IMethodSymbol"/> of this <see cref="ILocalSymbol"/>.
Symbols\SymbolVisitor.cs (1)
58public virtual void VisitLocal(ILocalSymbol symbol)
Symbols\SymbolVisitor`1.cs (1)
61public virtual TResult? VisitLocal(ILocalSymbol symbol)
Symbols\SymbolVisitor`2.cs (1)
66public virtual TResult VisitLocal(ILocalSymbol symbol, TArgument argument)
Microsoft.CodeAnalysis.CodeStyle (34)
src\Analyzers\Core\Analyzers\Helpers\HashCodeAnalyzer\HashCodeAnalyzer.cs (2)
158var hashCodeVariable = declarator.Symbol; 224private static bool IsLocalReference(IOperation value, ILocalSymbol accumulatorVariable)
src\Analyzers\Core\Analyzers\Helpers\HashCodeAnalyzer\HashCodeAnalyzer.OperationDeconstructor.cs (2)
22HashCodeAnalyzer analyzer, IMethodSymbol method, ILocalSymbol? hashCodeVariable) : IDisposable 26private readonly ILocalSymbol? _hashCodeVariable = hashCodeVariable;
src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.BlockAnalyzer.cs (2)
594Debug.Assert(symbol is not ILocalSymbol local || !local.IsRef); 613var isUnusedLocalAssignment = symbol is ILocalSymbol localSymbol &&
src\Analyzers\Core\Analyzers\UseCoalesceExpression\AbstractUseCoalesceExpressionForIfNullCheckDiagnosticAnalyzer.cs (2)
175var localSymbol = (ILocalSymbol)semanticModel.GetRequiredDeclaredSymbol(GetDeclarationNode(declarator), cancellationToken);
src\Analyzers\Core\Analyzers\UseCollectionInitializer\AbstractObjectCreationExpressionAnalyzer.cs (1)
142if (initializedSymbol is not ILocalSymbol local)
src\Analyzers\Core\Analyzers\UseConditionalExpression\ForAssignment\UseConditionalExpressionForAssignmentHelpers.cs (3)
97using var _1 = PooledHashSet<ILocalSymbol>.GetInstance(out var symbolsDeclaredInConditional); 101if (operation is IDeclarationPatternOperation { DeclaredSymbol: ILocalSymbol local }) 119static bool ContainsLocalReference(HashSet<ILocalSymbol> declaredPatternSymbols, IOperation? target)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions.cs (3)
333ILocalSymbol localSymbol => localSymbol.Type, 390=> symbol is ILocalSymbol { IsFunctionValue: true }; 615ILocalSymbol localSymbol => localSymbol.Type,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.DataFlowAnalyzer.cs (1)
179foreach (var local in region.Locals)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.DataFlowAnalyzer.FlowGraphAnalysisData.cs (5)
75ImmutableHashSet<ILocalSymbol> capturedLocals, 114public ImmutableHashSet<ILocalSymbol> CapturedLocals { get; } 187private static ImmutableHashSet<ILocalSymbol> GetCapturedLocals(ControlFlowGraph cfg) 189using var _ = PooledHashSet<ILocalSymbol>.GetInstance(out var builder); 195builder.AddRange(dataFlow.Captured.OfType<ILocalSymbol>());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SymbolSpecification.cs (1)
519(kind == SymbolKind.Local && ((ILocalSymbol)symbol).IsConst))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.cs (2)
74/// Interior-method-level symbols (i.e. <see cref="ILabelSymbol"/>, <see cref="ILocalSymbol"/>, <see 320ILocalSymbol => true,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyWriter.cs (1)
359public override void VisitLocal(ILocalSymbol localSymbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AbstractSpeculationAnalyzer.cs (3)
114SemanticModel model, TForEachStatementSyntax forEach, out IMethodSymbol getEnumeratorMethod, out ITypeSymbol elementType, out ImmutableArray<ILocalSymbol> localVariables); 454if (symbol is ILocalSymbol localSymbol && newSymbol is ILocalSymbol newLocalSymbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SymbolEquivalenceComparer.EquivalenceVisitor.cs (4)
122SymbolKind.Local => LocalsAreEquivalent((ILocalSymbol)x, (ILocalSymbol)y), 166private static bool LocalsAreEquivalent(ILocalSymbol x, ILocalSymbol y)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (2)
64SymbolKind.Local => CombineHashCodes((ILocalSymbol)x, currentHash), 103private static int CombineHashCodes(ILocalSymbol x, int currentHash)
Microsoft.CodeAnalysis.CodeStyle.Fixes (12)
src\Analyzers\Core\CodeFixes\RemoveUnusedParametersAndValues\AbstractRemoveUnusedValuesCodeFixProvider.cs (4)
482var declaredLocal = semanticModel.GetDeclaredSymbol(node, cancellationToken) as ILocalSymbol; 485declaredLocal = semanticModel.GetDeclaredSymbol(node.Parent, cancellationToken) as ILocalSymbol; 918var local = localDeclarationOperation.GetDeclaredVariables().Single();
src\Analyzers\Core\CodeFixes\UseConditionalExpression\ForAssignment\AbstractUseConditionalExpressionForAssignmentCodeFixProvider.cs (3)
161ILocalSymbol? local = null; 222var variable = declarator.Symbol; 247private static bool ReferencesLocalVariable(IOperation operation, ILocalSymbol variable)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\MoveDeclarationNearReference\AbstractMoveDeclarationNearReferenceService.cs (3)
31protected abstract bool CanMoveToBlock(ILocalSymbol localSymbol, SyntaxNode currentBlock, SyntaxNode destinationBlock); 35protected abstract Task<bool> TypesAreCompatibleAsync(Document document, ILocalSymbol localSymbol, TLocalDeclarationStatementSyntax declarationStatement, SyntaxNode right, CancellationToken cancellationToken); 219var localSymbol = state.LocalSymbol;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\MoveDeclarationNearReference\AbstractMoveDeclarationNearReferenceService.State.cs (2)
29public ILocalSymbol LocalSymbol { get; private set; } 83LocalSymbol = (ILocalSymbol)semanticModel.GetDeclaredSymbol(
Microsoft.CodeAnalysis.CSharp (38)
Compilation\CSharpSemanticModel.cs (3)
595case ILocalSymbol local: 3264public ILocalSymbol GetDeclaredSymbol(ForEachStatementSyntax forEachStatement) 3300public ILocalSymbol GetDeclaredSymbol(CatchDeclarationSyntax catchDeclaration)
CSharpExtensions.cs (2)
1581public static ILocalSymbol? GetDeclaredSymbol(this SemanticModel? semanticModel, ForEachStatementSyntax forEachStatement, CancellationToken cancellationToken = default(CancellationToken)) 1592public static ILocalSymbol? GetDeclaredSymbol(this SemanticModel? semanticModel, CatchDeclarationSyntax catchDeclaration, CancellationToken cancellationToken = default(CancellationToken))
Operations\CSharpOperationFactory.cs (13)
554ILocalSymbol local = boundLocal.LocalSymbol.GetPublicSymbol(); 1754ImmutableArray<ILocalSymbol> locals = boundBlock.Locals.GetPublicSymbols(); 1848ImmutableArray<ILocalSymbol> locals = boundWhileStatement.Locals.GetPublicSymbols(); 1866ImmutableArray<ILocalSymbol> locals = boundDoStatement.Locals.GetPublicSymbols(); 1878ImmutableArray<ILocalSymbol> locals = boundForStatement.OuterLocals.GetPublicSymbols(); 1879ImmutableArray<ILocalSymbol> conditionLocals = boundForStatement.InnerLocals.GetPublicSymbols(); 1985ImmutableArray<ILocalSymbol> locals = boundForEachStatement.IterationVariables.GetPublicSymbols(); 2013ImmutableArray<ILocalSymbol> locals = boundCatchBlock.Locals.GetPublicSymbols(); 2023ImmutableArray<ILocalSymbol> locals = boundFixedStatement.Locals.GetPublicSymbols(); 2035ImmutableArray<ILocalSymbol> locals = boundUsingStatement.Locals.GetPublicSymbols(); 2076ILocalSymbol? lockTakenSymbol = 2688ImmutableArray<ILocalSymbol> locals = boundSwitchStatement.InnerLocals.GetPublicSymbols(); 2699ImmutableArray<ILocalSymbol> locals = boundSwitchSection.Locals.GetPublicSymbols();
Operations\CSharpOperationFactory_Methods.cs (2)
75return new VariableInitializerOperation(locals: ImmutableArray<ILocalSymbol>.Empty, value, _semanticModel, initializerSyntax, initializerIsImplicit); 83ILocalSymbol symbol = boundLocalDeclaration.LocalSymbol.GetPublicSymbol();
SymbolDisplay\SymbolDisplayVisitor.cs (1)
239public override void VisitLocal(ILocalSymbol symbol)
Symbols\PublicModel\LocalSymbol.cs (12)
25ITypeSymbol ILocalSymbol.Type 38CodeAnalysis.NullableAnnotation ILocalSymbol.NullableAnnotation => _underlying.TypeWithAnnotations.ToPublicAnnotation(); 40bool ILocalSymbol.IsFunctionValue 48bool ILocalSymbol.IsConst => _underlying.IsConst; 50bool ILocalSymbol.IsRef => _underlying.IsRef; 52RefKind ILocalSymbol.RefKind => _underlying.RefKind; 54ScopedKind ILocalSymbol.ScopedKind => _underlying.Scope; 56bool ILocalSymbol.HasConstantValue => _underlying.HasConstantValue; 58object ILocalSymbol.ConstantValue => _underlying.ConstantValue; 60bool ILocalSymbol.IsFixed => _underlying.IsFixed; 62bool ILocalSymbol.IsForEach => _underlying.IsForEach; 64bool ILocalSymbol.IsUsing => _underlying.IsUsing;
Symbols\SymbolExtensions.cs (5)
599internal static ILocalSymbol? GetPublicSymbol(this LocalSymbol? symbol) 601return symbol.GetPublicSymbol<ILocalSymbol>(); 724internal static ImmutableArray<ILocalSymbol> GetPublicSymbols(this ImmutableArray<LocalSymbol> symbols) 726return GetPublicSymbols<ILocalSymbol>(StaticCast<Symbol>.From(symbols)); 796internal static LocalSymbol? GetSymbol(this ILocalSymbol? symbol)
Microsoft.CodeAnalysis.CSharp.CodeStyle (33)
src\Analyzers\CSharp\Analyzers\InlineDeclaration\CSharpInlineDeclarationDiagnosticAnalyzer.cs (2)
132if (semanticModel.GetSymbolInfo(argumentExpression, cancellationToken).Symbol is not ILocalSymbol outLocalSymbol) 286ILocalSymbol outLocalSymbol)
src\Analyzers\CSharp\Analyzers\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessAnalyzer.cs (2)
309var localSymbol = (ILocalSymbol)semanticModel.GetRequiredDeclaredSymbol(declarator, cancellationToken);
src\Analyzers\CSharp\Analyzers\UseAutoProperty\CSharpUseAutoPropertyAnalyzer.cs (1)
137if (exprSymbol is not IParameterSymbol and not ILocalSymbol)
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (3)
420using var _3 = PooledHashSet<ILocalSymbol>.GetInstance(out var seenLocals); 502if (leftSymbol is not ILocalSymbol { ScopedKind: ScopedKind.ScopedValue }) 523if (semanticModel.GetDeclaredSymbol(declarator, cancellationToken) is not ILocalSymbol local)
src\Analyzers\CSharp\Analyzers\UseDeconstruction\CSharpUseDeconstructionDiagnosticAnalyzer.cs (6)
106var local = (ILocalSymbol)semanticModel.GetRequiredDeclaredSymbol(declarator, cancellationToken); 126var local = (ILocalSymbol)semanticModel.GetRequiredDeclaredSymbol(forEachStatement, cancellationToken); 136ILocalSymbol local, 247SemanticModel semanticModel, SyntaxNode searchScope, ILocalSymbol local,
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.Analyzer.cs (3)
19private readonly ILocalSymbol _localSymbol; 28ILocalSymbol localSymbol, 53ILocalSymbol localSymbol,
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.cs (4)
102out var localSymbol)) 282[NotNullWhen(true)] out ILocalSymbol? localSymbol) 328[NotNullWhen(true)] out ILocalSymbol? localSymbol, 331localSymbol = semanticModel.GetSymbolInfo(identifier).Symbol as ILocalSymbol;
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpIsAndCastCheckDiagnosticAnalyzer.cs (2)
112var localSymbol = (ILocalSymbol)semanticModel.GetRequiredDeclaredSymbol(declarator, cancellationToken);
src\Analyzers\CSharp\Analyzers\UseSimpleUsingStatement\UseSimpleUsingStatementDiagnosticAnalyzer.cs (1)
170private static bool DeclaredLocalCausesCollision(Dictionary<string, ArrayBuilder<ISymbol>> symbolNameToExistingSymbol, ImmutableArray<ILocalSymbol> locals)
src\Analyzers\CSharp\Analyzers\UseTupleSwap\CSharpUseTupleSwapDiagnosticAnalyzer.cs (2)
109var local = (ILocalSymbol)semanticModel.GetRequiredDeclaredSymbol(variableDeclarator, cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ILocalSymbolExtensions.cs (1)
12public static bool CanSafelyMoveLocalToBlock(this ILocalSymbol localSymbol, SyntaxNode currentBlock, SyntaxNode destinationBlock)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (1)
687if (castedSymbol is not IFieldSymbol and not ILocalSymbol and not IParameterSymbol and not IParameterSymbol { RefKind: RefKind.Ref })
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\SpeculationAnalyzer.cs (5)
890out ImmutableArray<ILocalSymbol> localVariables) 898localVariables = [(ILocalSymbol)model.GetRequiredDeclaredSymbol(foreachStatement, this.CancellationToken)]; 902using var variables = TemporaryArray<ILocalSymbol>.Empty; 914void AddVariables(VariableDesignationSyntax designation, ref TemporaryArray<ILocalSymbol> variables) 919variables.Add((ILocalSymbol)model.GetRequiredDeclaredSymbol(singleVariableDesignation, CancellationToken));
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (7)
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordHelpers.cs (1)
579Symbol: ILocalSymbol castOther,
src\Analyzers\CSharp\CodeFixes\InlineDeclaration\CSharpInlineDeclarationCodeFixProvider.cs (2)
217var local = (ILocalSymbol)semanticModel.GetDeclaredSymbol(declarator, cancellationToken);
src\Analyzers\CSharp\CodeFixes\Nullable\CSharpDeclareAsNullableCodeFixProvider.cs (1)
174if (symbol is ILocalSymbol { DeclaringSyntaxReferences.Length: > 0 } local)
src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpAsAndNullCheckCodeFixProvider.cs (1)
138if (semanticModel.GetDeclaredSymbol(declarator, cancellationToken) is ILocalSymbol local)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpMoveDeclarationNearReferenceService.cs (2)
53Document document, ILocalSymbol localSymbol, 69protected override bool CanMoveToBlock(ILocalSymbol localSymbol, SyntaxNode currentBlock, SyntaxNode destinationBlock)
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (5)
SymbolKey\SymbolKeyMetadataVsSourceTests.cs (1)
264var localType = ((ILocalSymbol)local).Type;
SymbolKey\SymbolKeyTestBase.cs (1)
341if (v is ILocalSymbol local && (local.Type.Kind == SymbolKind.ArrayType || local.Type.Kind == SymbolKind.PointerType))
SymbolKey\SymbolKeyTests.cs (3)
290async Task<ILocalSymbol> GetBodyLocalSymbol(Compilation bodyCompilation) 298var local = (ILocalSymbol)semanticModel.GetDeclaredSymbol(varDecl);
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (25)
CodeGen\CodeGenDeconstructTests.cs (6)
1676var x = (ILocalSymbol)model.GetDeclaredSymbol(declarations.ElementAt(7)); 6256var symbol = (ILocalSymbol)model.GetSymbolInfo(discard).Symbol; 6369var symbol = (ILocalSymbol)model.GetSymbolInfo(discard).Symbol;
CodeGen\CodeGenTupleTest.cs (19)
12695var m1Tuple = model.LookupSymbols(node.SpanStart, name: "v1").OfType<ILocalSymbol>().Single().Type.GetSymbol<NamedTypeSymbol>(); 12696var m2Tuple = model.LookupSymbols(node.SpanStart, name: "v2").OfType<ILocalSymbol>().Single().Type.GetSymbol<NamedTypeSymbol>(); 12697var m6Tuple = model.LookupSymbols(node.SpanStart, name: "v6").OfType<ILocalSymbol>().Single().Type.GetSymbol<NamedTypeSymbol>(); 14456var v1Type = ((ILocalSymbol)symbolInfo.Symbol).Type; 14466var v2Type = ((ILocalSymbol)symbolInfo.Symbol).Type; 16569var xSymbol = (INamedTypeSymbol)((ILocalSymbol)model.GetDeclaredSymbol(x)).Type; 16606var xSymbol = (INamedTypeSymbol)((ILocalSymbol)model.GetDeclaredSymbol(x)).Type; 17405var x1Symbol = model.GetSymbolInfo(x1Bob.Expression).Symbol as ILocalSymbol; 17438var x1Symbol = (ILocalSymbol)model.GetDeclaredSymbol(x1); 22858var xSymbol = ((ILocalSymbol)model.GetDeclaredSymbol(x)).Type; 24269var xSymbol = model.GetDeclaredSymbol(tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single()); 24332var xSymbol = model.GetDeclaredSymbol(tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single()); 24397var collectionSymbol = (model.GetDeclaredSymbol(collection) as ILocalSymbol)?.Type; 24470var collectionSymbol = (model.GetDeclaredSymbol(collection) as ILocalSymbol)?.Type; 24543var collectionSymbol = (model.GetDeclaredSymbol(collection) as ILocalSymbol)?.Type; 24617var collectionSymbol = (model.GetDeclaredSymbol(collection) as ILocalSymbol)?.Type; 25026var xSymbol = ((ILocalSymbol)model.GetDeclaredSymbol(x)).Type;
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (96)
FirstClassSpanTests.cs (2)
5001var aSymbol = (ILocalSymbol)model.GetDeclaredSymbol(aVariable)!;
FlowAnalysis\RegionAnalysisTests.cs (4)
3333var intsym = analysis.VariablesDeclared.First() as ILocalSymbol; 3334var longsym = analysis.VariablesDeclared.Last() as ILocalSymbol;
Semantics\LockTests.cs (2)
184var localSymbol = (ILocalSymbol)model.GetDeclaredSymbol(localDecl.Declaration.Variables.Single())!;
Semantics\OutVarTests.cs (59)
970Assert.False(((ILocalSymbol)symbol).IsFixed); 985var local = (ILocalSymbol)symbol; 1148var local = (ILocalSymbol)symbol; 5756Assert.Equal("System.Int32", ((ILocalSymbol)compilation.GetSemanticModel(tree).GetDeclaredSymbol(GetVariableDesignation(x1Decl))).Type.ToTestDisplayString()); 12875Assert.Equal("System.Int32", ((ILocalSymbol)compilation.GetSemanticModel(tree).GetDeclaredSymbol(GetVariableDesignation(yDecl))).Type.ToTestDisplayString()); 18036Assert.Equal("Cls.var", ((ILocalSymbol)model.GetDeclaredSymbol(GetVariableDesignation(x1Decl))).Type.ToTestDisplayString()); 18436Assert.Equal("System.Int32", ((ILocalSymbol)compilation.GetSemanticModel(tree).GetDeclaredSymbol(GetVariableDesignation(x1Decl))).Type.ToTestDisplayString()); 18500Assert.Equal("System.Int32", ((ILocalSymbol)compilation.GetSemanticModel(tree).GetDeclaredSymbol(GetVariableDesignation(x1Decl))).Type.ToTestDisplayString()); 18549Assert.Equal("System.Int32", ((ILocalSymbol)compilation.GetSemanticModel(tree).GetDeclaredSymbol(GetVariableDesignation(x1Decl))).Type.ToTestDisplayString()); 18594Assert.Equal("System.Int32", ((ILocalSymbol)compilation.GetSemanticModel(tree).GetDeclaredSymbol(GetVariableDesignation(x1Decl))).Type.ToTestDisplayString()); 20224var x1 = (ILocalSymbol)model.GetDeclaredSymbol(GetVariableDesignation(x1Decl)); 20253var x1 = (ILocalSymbol)model.GetDeclaredSymbol(GetVariableDesignation(x1Decl)); 21313Assert.True(((ILocalSymbol)y1).Type.IsErrorType()); 21371var symbol = (ILocalSymbol)model.GetDeclaredSymbol(e); 33621var symbol = (ILocalSymbol)model.GetDeclaredSymbol(decl.Designation); 33707var symbol = (ILocalSymbol)model.GetDeclaredSymbol(decl.Designation); 34763var symbol = (ILocalSymbol)model.GetDeclaredSymbol(decl.Designation); 34844var symbol = (ILocalSymbol)model.GetDeclaredSymbol(decl.Designation); 34896var symbol = (ILocalSymbol)model.GetDeclaredSymbol(decl.Designation); 34950var symbol = (ILocalSymbol)model.GetDeclaredSymbol(decl.Designation); 35008var symbol = (ILocalSymbol)model.GetDeclaredSymbol(decl.Designation); 35059var symbol = (ILocalSymbol)model.GetDeclaredSymbol(decl.Designation); 35112var symbol = (ILocalSymbol)model.GetDeclaredSymbol(decl.Designation); 35151var symbol = (ILocalSymbol)model.GetDeclaredSymbol(decl.Designation); 35185var symbol = (ILocalSymbol)model.GetDeclaredSymbol(decl.Designation); 35224var symbol = (ILocalSymbol)model.GetDeclaredSymbol(decl.Designation); 35268var symbol = (ILocalSymbol)model.GetDeclaredSymbol(decl.Designation); 35299var symbol = (ILocalSymbol)model.GetDeclaredSymbol(decl.Designation); 35338var symbol = (ILocalSymbol)model.GetDeclaredSymbol(decl.Designation); 35371var symbol = (ILocalSymbol)model.GetDeclaredSymbol(decl.Designation); 35407var symbol = (ILocalSymbol)model.GetDeclaredSymbol(decl.Designation); 35446var symbol = (ILocalSymbol)model.GetDeclaredSymbol(decl.Designation); 35476var symbol = (ILocalSymbol)model.GetDeclaredSymbol(decl.Designation); 35513var symbol = (ILocalSymbol)model.GetDeclaredSymbol(decl.Designation);
Semantics\PatternMatchingTestBase.cs (3)
107var local = ((ILocalSymbol)symbol); 150var type = ((ILocalSymbol)symbol).Type;
Semantics\PatternMatchingTests.cs (2)
1161Assert.Equal("System.Int32", ((ILocalSymbol)compilation.GetSemanticModel(tree).GetDeclaredSymbol(x1Decl[0])).Type.ToTestDisplayString()); 11390var types = locals.Select(local => ((ILocalSymbol)model.GetDeclaredSymbol(local)).Type.ToTestDisplayString()).ToArray();
Semantics\PatternMatchingTests_ListPatterns.cs (18)
3330var local = (ILocalSymbol)model.GetDeclaredSymbol(declaration.Designation)!; 3337var local = (ILocalSymbol)model.GetDeclaredSymbol(declaration)!; 3647Assert.Equal(declaredType, ((ILocalSymbol)symbol).Type.ToDisplayString()); 3727Assert.Equal("System.Int32", ((ILocalSymbol)symbol).Type.ToTestDisplayString()); 3742Assert.Equal("System.Int32", ((ILocalSymbol)symbol).Type.ToTestDisplayString()); 4095var local = (ILocalSymbol)model.GetDeclaredSymbol(declaration.Designation)!; 4182var local = (ILocalSymbol)model.GetDeclaredSymbol(declaration.Designation)!; 4259var local = (ILocalSymbol)model.GetDeclaredSymbol(declaration.Designation)!; 4374var local = (ILocalSymbol)model.GetDeclaredSymbol(declaration.Designation)!; 4417Assert.Equal(declaredType, ((ILocalSymbol)symbol).Type.ToDisplayString()); 4566var local = (ILocalSymbol)model.GetDeclaredSymbol(declaration.Designation)!;
Semantics\PatternMatchingTests_Scope.cs (5)
12160Assert.True(((ILocalSymbol)y1).Type.IsErrorType()); 12212var symbol = (ILocalSymbol)model.GetDeclaredSymbol(e); 13827var x1 = (ILocalSymbol)model.GetDeclaredSymbol(designation);
Semantics\PatternMatchingTests2.cs (1)
725Assert.Equal("int", ((ILocalSymbol)symbol).Type.ToDisplayString());
Microsoft.CodeAnalysis.CSharp.Features (45)
CodeRefactorings\InlineTemporary\InlineTemporaryCodeRefactoringProvider.cs (2)
382var localSymbol = (ILocalSymbol)semanticModel.GetDeclaredSymbol(variableDeclarator, cancellationToken);
ConvertForEachToFor\CSharpConvertForEachToForCodeRefactoringProvider.cs (1)
152protected override bool IsSupported(ILocalSymbol foreachVariable, IForEachLoopOperation forEachOperation, ForEachStatementSyntax foreachStatement)
ConvertLinq\ConvertForEachToLinqQuery\AbstractToMethodConverter.cs (1)
108if (expresisonSymbol is ILocalSymbol &&
EditAndContinue\CSharpEditAndContinueAnalyzer.cs (1)
191Debug.Assert(localOrParameter is IParameterSymbol or ILocalSymbol or IRangeVariableSymbol);
InlineHints\CSharpInlineTypeHintsService.cs (2)
58var local = semanticModel.GetDeclaredSymbol(variableDesignation, cancellationToken) as ILocalSymbol;
LanguageServices\CSharpSymbolDisplayService.SymbolDescriptionBuilder.cs (2)
103else if (symbol is ILocalSymbol local) 198ILocalSymbol symbol)
QuickInfo\CSharpSemanticQuickInfoProvider.cs (2)
111case ILocalSymbol { HasConstantValue: true }: return default; 115case ILocalSymbol:
ReplaceConditionalWithStatements\CSharpReplaceConditionalWithStatementsCodeRefactoringProvider.cs (1)
66ILocalSymbol symbol)
ReverseForStatement\CSharpReverseForStatementCodeRefactoringProvider.cs (2)
91var local = semanticModel.GetDeclaredSymbol(variable, cancellationToken) as ILocalSymbol;
src\Analyzers\CSharp\Analyzers\InlineDeclaration\CSharpInlineDeclarationDiagnosticAnalyzer.cs (2)
132if (semanticModel.GetSymbolInfo(argumentExpression, cancellationToken).Symbol is not ILocalSymbol outLocalSymbol) 286ILocalSymbol outLocalSymbol)
src\Analyzers\CSharp\Analyzers\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessAnalyzer.cs (2)
309var localSymbol = (ILocalSymbol)semanticModel.GetRequiredDeclaredSymbol(declarator, cancellationToken);
src\Analyzers\CSharp\Analyzers\UseAutoProperty\CSharpUseAutoPropertyAnalyzer.cs (1)
137if (exprSymbol is not IParameterSymbol and not ILocalSymbol)
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (3)
420using var _3 = PooledHashSet<ILocalSymbol>.GetInstance(out var seenLocals); 502if (leftSymbol is not ILocalSymbol { ScopedKind: ScopedKind.ScopedValue }) 523if (semanticModel.GetDeclaredSymbol(declarator, cancellationToken) is not ILocalSymbol local)
src\Analyzers\CSharp\Analyzers\UseDeconstruction\CSharpUseDeconstructionDiagnosticAnalyzer.cs (6)
106var local = (ILocalSymbol)semanticModel.GetRequiredDeclaredSymbol(declarator, cancellationToken); 126var local = (ILocalSymbol)semanticModel.GetRequiredDeclaredSymbol(forEachStatement, cancellationToken); 136ILocalSymbol local, 247SemanticModel semanticModel, SyntaxNode searchScope, ILocalSymbol local,
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.Analyzer.cs (3)
19private readonly ILocalSymbol _localSymbol; 28ILocalSymbol localSymbol, 53ILocalSymbol localSymbol,
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.cs (4)
102out var localSymbol)) 282[NotNullWhen(true)] out ILocalSymbol? localSymbol) 328[NotNullWhen(true)] out ILocalSymbol? localSymbol, 331localSymbol = semanticModel.GetSymbolInfo(identifier).Symbol as ILocalSymbol;
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpIsAndCastCheckDiagnosticAnalyzer.cs (2)
112var localSymbol = (ILocalSymbol)semanticModel.GetRequiredDeclaredSymbol(declarator, cancellationToken);
src\Analyzers\CSharp\Analyzers\UseSimpleUsingStatement\UseSimpleUsingStatementDiagnosticAnalyzer.cs (1)
170private static bool DeclaredLocalCausesCollision(Dictionary<string, ArrayBuilder<ISymbol>> symbolNameToExistingSymbol, ImmutableArray<ILocalSymbol> locals)
src\Analyzers\CSharp\Analyzers\UseTupleSwap\CSharpUseTupleSwapDiagnosticAnalyzer.cs (2)
109var local = (ILocalSymbol)semanticModel.GetRequiredDeclaredSymbol(variableDeclarator, cancellationToken);
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordHelpers.cs (1)
579Symbol: ILocalSymbol castOther,
src\Analyzers\CSharp\CodeFixes\InlineDeclaration\CSharpInlineDeclarationCodeFixProvider.cs (2)
217var local = (ILocalSymbol)semanticModel.GetDeclaredSymbol(declarator, cancellationToken);
src\Analyzers\CSharp\CodeFixes\Nullable\CSharpDeclareAsNullableCodeFixProvider.cs (1)
174if (symbol is ILocalSymbol { DeclaringSyntaxReferences.Length: > 0 } local)
src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpAsAndNullCheckCodeFixProvider.cs (1)
138if (semanticModel.GetDeclaredSymbol(declarator, cancellationToken) is ILocalSymbol local)
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (2)
Diagnostics\Suppression\RemoveUnnecessaryPragmaSuppressionsTests.cs (2)
68var localsToIsAssignedMap = new ConcurrentDictionary<ILocalSymbol, bool>(); 69var usedLocals = new HashSet<ILocalSymbol>();
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (78)
Semantics\AwaitExpressionTests.cs (2)
274var symbolV = (ILocalSymbol)semanticModel.GetDeclaredSymbol(decl);
Semantics\DeconstructionTests.cs (2)
4175Assert.Equal("System.Int32", ((ILocalSymbol)x1).Type.ToTestDisplayString()); 4180Assert.Equal("System.Int32", ((ILocalSymbol)x2).Type.ToTestDisplayString());
Semantics\DelegateTypeTests.cs (2)
14351var local = (ILocalSymbol)model.GetDeclaredSymbol(variable)!;
Semantics\ForEachTests.cs (1)
2886var localSymbol = model.GetDeclaredSymbol(foreachSyntax);
Semantics\FunctionPointerTests.cs (2)
2090var local = (ILocalSymbol)model.GetDeclaredSymbol(localSyntax)!;
Semantics\LocalFunctionTests.cs (4)
4691var symbol = (ILocalSymbol)model.GetDeclaredSymbol(designation); 4732var symbol = (ILocalSymbol)model.GetDeclaredSymbol(declarator);
Semantics\LockTests.cs (6)
46var localSymbol = (ILocalSymbol)model.GetDeclaredSymbol(localDecl.Declaration.Variables.Single()); 605var symbol = (ILocalSymbol)model.GetDeclaredSymbol(localDecl.Declaration.Variables.Single()); 629var symbol = (ILocalSymbol)model.GetDeclaredSymbol(localDecl.Declaration.Variables.Single());
Semantics\NullableReferenceTypesTests.cs (20)
5171var local = (ILocalSymbol)model.GetDeclaredSymbol(declaration); 145377var local = (ILocalSymbol)model.GetDeclaredSymbol(declaration); 145418var local = (ILocalSymbol)model.GetDeclaredSymbol(declaration); 145458var local = (ILocalSymbol)model.GetDeclaredSymbol(declaration); 145496var local = (ILocalSymbol)model.GetDeclaredSymbol(declaration); 145534var local = (ILocalSymbol)model.GetDeclaredSymbol(declaration); 145638var local = (ILocalSymbol)model.GetDeclaredSymbol(declaration); 145677var local = (ILocalSymbol)model.GetDeclaredSymbol(declaration); 154881var symbol = (ILocalSymbol)model.GetDeclaredSymbol(syntax); 158818var local = (ILocalSymbol)model.GetDeclaredSymbol(declaration.Variables.Single());
Semantics\RefEscapingTests.cs (1)
72return ((ILocalSymbol)model.GetDeclaredSymbol(decl)).Type;
Semantics\RefFieldTests.cs (2)
15721private static void VerifyLocalSymbol(ILocalSymbol local, string expectedDisplayString, RefKind expectedRefKind, ScopedKind expectedScope) 17947var delegateInvokeMethods = decls.Select(d => ((ILocalSymbol)model.GetDeclaredSymbol(d)).Type.GetSymbol<NamedTypeSymbol>().DelegateInvokeMethod).ToArray();
Semantics\TopLevelStatementsTests.cs (4)
6330Assert.Equal(expectedType, ((ILocalSymbol)xRef).Type.ToTestDisplayString()); 6331Assert.Equal(expectedType, ((ILocalSymbol)xDecl).Type.ToTestDisplayString()); 6379Assert.Equal(expectedType, ((ILocalSymbol)xDecl).Type.ToTestDisplayString()); 6385Assert.Equal(expectedType, ((ILocalSymbol)xRef).Type.ToTestDisplayString());
Semantics\TryCatchTests.cs (2)
46var localSymbol = (ILocalSymbol)model.GetDeclaredSymbol(catchClause.Declaration);
Semantics\UnsafeTests.cs (13)
6332return ((ILocalSymbol)model.GetDeclaredSymbol(decl)).Type; 6391return ((ILocalSymbol)model.GetDeclaredSymbol(decl)).Type; 7278Assert.Equal(type, ((ILocalSymbol)declaredSymbol).Type); 7860Assert.Equal(structPointerType.GetPublicSymbol(), ((ILocalSymbol)receiverSymbol).Type); 7927Assert.Equal(structType.GetPublicSymbol(), ((ILocalSymbol)receiverSymbol).Type); 8171Assert.Equal(intPointerType.GetPublicSymbol(), ((ILocalSymbol)receiverSymbol).Type); 8183Assert.Equal(intType.GetPublicSymbol(), ((ILocalSymbol)indexSymbol).Type); 10178var declaredSymbols = declarators.Select(syntax => (ILocalSymbol)model.GetDeclaredSymbol(syntax)).ToArray(); 10180foreach (var symbol in declaredSymbols) 10184Assert.True(((ILocalSymbol)symbol).IsFixed); 10227var declaredSymbols = declarators.Select(syntax => (ILocalSymbol)model.GetDeclaredSymbol(syntax)).ToArray(); 11338var countSymbol = (ILocalSymbol)countSummary.Symbol;
Semantics\UsingStatementTests.cs (17)
65var declaredLocal = (ILocalSymbol)declaredSymbol; 1348Assert.Equal(((ILocalSymbol)declaredSymbol).Type, typeInfo.Symbol); 1389Assert.Equal(((ILocalSymbol)model.GetDeclaredSymbol(usingStatement.Declaration.Variables.First())).Type, typeInfo.Symbol); 1523foreach (var x in symbols) 1552foreach (var x in symbols) 1554var localSymbol = x; 1581foreach (var x in symbols) 1583var localSymbol = x; 1609foreach (var x in symbols) 1611var localSymbol = x; 1638foreach (var x in symbols) 1640var localSymbol = x; 1666foreach (var x in symbols) 1668var localSymbol = x; 1860private IEnumerable<ILocalSymbol> VerifyDeclaredSymbolForUsingStatements(CSharpCompilation compilation, int index = 1, params string[] variables) 1872yield return (ILocalSymbol)symbol;
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (99)
Compilation\GetSemanticInfoTests.cs (1)
2729Assert.Equal(type, ((ILocalSymbol)symbol).Type);
Compilation\SemanticModelAPITests.cs (11)
206var rxSymbol = Assert.IsAssignableFrom<ILocalSymbol>(rxInfo.Symbol); 238var rxSymbol = Assert.IsAssignableFrom<ILocalSymbol>(rxInfo.Symbol); 1791Assert.Equal("Int32", ((ILocalSymbol)local).Type.Name); 1844Assert.Equal("Int32", ((ILocalSymbol)local).Type.Name); 1857Assert.Equal("String", ((ILocalSymbol)local).Type.Name); 2397Assert.Equal("Int32", ((ILocalSymbol)local).Type.Name); 2580Assert.Equal("Int32", ((ILocalSymbol)local).Type.Name); 2594Assert.Equal("String", ((ILocalSymbol)local).Type.Name); 2608Assert.Equal("Int32", ((ILocalSymbol)local).Type.Name);
Compilation\SemanticModelGetDeclaredSymbolAPITests.cs (3)
40ILocalSymbol rx = model.GetDeclaredSymbol(rxDecl); 64var rxLocal = Assert.IsAssignableFrom<ILocalSymbol>(rx);
Compilation\SemanticModelGetSemanticInfoTests.cs (2)
4583var symbol = (ILocalSymbol)semanticInfo.Symbol;
Compilation\SymbolVisitorTests.cs (2)
93public override void VisitLocal(ILocalSymbol symbol) 270public override string VisitLocal(ILocalSymbol symbol)
SymbolDisplay\SymbolDisplayTests.cs (7)
6843var local = (ILocalSymbol)semanticModel.GetDeclaredSymbol(declarator); 6876var local = (ILocalSymbol)semanticModel.GetDeclaredSymbol(declarator); 6921var local = (ILocalSymbol)semanticModel.GetDeclaredSymbol(declarator); 8485var type = ((ILocalSymbol)model.GetDeclaredSymbol(name.Names[0])).Type;
Symbols\AccessorOverriddenOrHiddenMembersTests.cs (2)
1028var localD = (ILocalSymbol)semanticModel.GetSymbolInfo(identifierSyntax).Symbol;
Symbols\AnonymousTypesSymbolTests.cs (4)
1689var localA3 = model.GetDeclaredSymbol(statement3.Declaration.Variables[0]) as ILocalSymbol; 1690var localA4 = model.GetDeclaredSymbol(statement4.Declaration.Variables[0]) as ILocalSymbol;
Symbols\ConversionTests.cs (1)
397ITypeSymbol targetType = ((ILocalSymbol)model.GetDeclaredSymbol(variableDeclarator)).Type;
Symbols\FunctionPointerTypeSymbolTests.cs (2)
1164var a = (ILocalSymbol)model.GetSymbolInfo(misplacedDeclaration).Symbol!;
Symbols\Source\DeclaringSyntaxNodeTests.cs (6)
264var localA1 = (ILocalSymbol)model.GetDeclaredSymbol(declaratorA1); 309(ILocalSymbol)model.GetDeclaredSymbol(declaratorQ), 316(ILocalSymbol)model.GetDeclaredSymbol(declaratorX), 323(ILocalSymbol)model.GetDeclaredSymbol(declaratorZ), 327private void CheckAnonymousType(SemanticModel model, ILocalSymbol local, AnonymousObjectCreationExpressionSyntax anonObjectCreation)
Symbols\Source\LocalTests.cs (12)
35var symbol = (ILocalSymbol)semanticInfo.Symbol; 63var local = (ILocalSymbol)model.GetSymbolInfo(expressionSyntax).Symbol!; 89var symbol = (ILocalSymbol)semanticInfo.Symbol; 114var symbol = (ILocalSymbol)semanticInfo.Symbol; 139var symbol = (ILocalSymbol)semanticInfo.Symbol; 162var symbol = (ILocalSymbol)semanticInfo.Symbol;
Symbols\Source\NullablePublicAPITests.cs (40)
1005var localSymbol = (ILocalSymbol)model.GetDeclaredSymbol(v); 1177var declaredSymbol = (ILocalSymbol)context.SemanticModel.GetDeclaredSymbol(declarator); 1948var symbol = (ILocalSymbol)model.GetDeclaredSymbol(variable); 1995var symbol = (ILocalSymbol)model.GetDeclaredSymbol(variable); 2056var symbols = variable.DescendantNodes().OfType<SingleVariableDesignationSyntax>().Select(s => model.GetDeclaredSymbol(s)).Cast<ILocalSymbol>().ToList(); 2099var symbols = variable.DescendantNodes().OfType<SingleVariableDesignationSyntax>().Select(s => model.GetDeclaredSymbol(s)).Cast<ILocalSymbol>().ToList(); 2139Assert.Equal(PublicNullableAnnotation.Annotated, ((ILocalSymbol)specModel.GetDeclaredSymbol(newDeclarator)).NullableAnnotation); 2140Assert.Equal(PublicNullableAnnotation.Annotated, ((ILocalSymbol)specModel.GetDeclaredSymbol(newDeclarator)).Type.NullableAnnotation); 2143Assert.Equal(PublicNullableAnnotation.Annotated, ((ILocalSymbol)specModel.GetDeclaredSymbol(newDeclarator)).NullableAnnotation); 2144Assert.Equal(PublicNullableAnnotation.Annotated, ((ILocalSymbol)specModel.GetDeclaredSymbol(newDeclarator)).Type.NullableAnnotation); 2187var symbol = (ILocalSymbol)model.GetDeclaredSymbol(variable); 2219var symbol = (ILocalSymbol)model.GetDeclaredSymbol(declaration); 2257var symbol = (ILocalSymbol)model.GetDeclaredSymbol(variable); 2289var symbol = (ILocalSymbol)model.GetDeclaredSymbol(variable); 2335var symbol = (ILocalSymbol)model.GetDeclaredSymbol(variable); 2377var symbol = (ILocalSymbol)model.GetDeclaredSymbol(variable); 2420var symbol = (ILocalSymbol)model.GetDeclaredSymbol(variable); 2462var symbol = model.GetDeclaredSymbol(foreachStatement); 2510var symbol = model.GetDeclaredSymbol(variable); 2559var symbol = (ILocalSymbol)model.GetDeclaredSymbol(variable); 3918var o2Symbol = (ILocalSymbol)model.GetDeclaredSymbol(o2Decl); 3932var o4Symbol = (ILocalSymbol)model.GetDeclaredSymbol(o4Decl); 4124var o2Result = lookupResults.OfType<ILocalSymbol>().First(l => l.Name == "o2"); 4125var o8Result = lookupResults.OfType<ILocalSymbol>().First(l => l.Name == "o8");
Symbols\TypeTests.cs (6)
1685var anonymousType = (locals[3] as ILocalSymbol).Type; 1692Assert.Equal((locals[0] as ILocalSymbol).Type, memType, SymbolEqualityComparer.ConsiderEverything); 1700Assert.Same((locals[1] as ILocalSymbol).Type, memType); 1713Assert.Same((locals[2] as ILocalSymbol).Type, memType); 1765var sym = model.GetDeclaredSymbol(node1.Declaration.Variables.First()) as ILocalSymbol;
Microsoft.CodeAnalysis.CSharp.Test.Utilities (1)
Extensions.cs (1)
823return ((ILocalSymbol)symbol).Type;
Microsoft.CodeAnalysis.CSharp.Workspaces (13)
Classification\SyntaxClassification\NameSyntaxClassifier.cs (2)
220case ILocalSymbol localSymbol: 244private static string GetClassificationForLocal(ILocalSymbol localSymbol)
Rename\CSharpRenameRewriterLanguageService.cs (1)
775(matchingLocal.IsKind(SymbolKind.Local) && ((ILocalSymbol)matchingLocal).Type.IsDelegateType()) ||
Simplification\Simplifiers\AbstractCSharpSimplifier.cs (1)
413return symbols.Any(static s => s is ILocalSymbol);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ILocalSymbolExtensions.cs (1)
12public static bool CanSafelyMoveLocalToBlock(this ILocalSymbol localSymbol, SyntaxNode currentBlock, SyntaxNode destinationBlock)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (1)
687if (castedSymbol is not IFieldSymbol and not ILocalSymbol and not IParameterSymbol and not IParameterSymbol { RefKind: RefKind.Ref })
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\SpeculationAnalyzer.cs (5)
890out ImmutableArray<ILocalSymbol> localVariables) 898localVariables = [(ILocalSymbol)model.GetRequiredDeclaredSymbol(foreachStatement, this.CancellationToken)]; 902using var variables = TemporaryArray<ILocalSymbol>.Empty; 914void AddVariables(VariableDesignationSyntax designation, ref TemporaryArray<ILocalSymbol> variables) 919variables.Add((ILocalSymbol)model.GetRequiredDeclaredSymbol(singleVariableDesignation, CancellationToken));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpMoveDeclarationNearReferenceService.cs (2)
53Document document, ILocalSymbol localSymbol, 69protected override bool CanMoveToBlock(ILocalSymbol localSymbol, SyntaxNode currentBlock, SyntaxNode destinationBlock)
Microsoft.CodeAnalysis.ExpressionEvaluator.ExpressionCompiler (1)
AbstractTypeParameterChecker.cs (1)
66public sealed override void VisitLocal(ILocalSymbol symbol)
Microsoft.CodeAnalysis.Features (44)
Completion\Providers\AbstractContextVariableArgumentProvider.cs (1)
43else if (symbol.IsKind(SymbolKind.Local, out ILocalSymbol? local))
Completion\Providers\AbstractSymbolCompletionProvider.cs (2)
74var local = (ILocalSymbol)symbol;
Completion\Providers\ImportCompletionProvider\AbstractExtensionMethodImportCompletionProvider.cs (1)
106ILocalSymbol localSymbol => localSymbol.Type,
ConvertForEachToFor\AbstractConvertForEachToForCodeRefactoringProvider.cs (3)
54protected abstract bool IsSupported(ILocalSymbol foreachVariable, IForEachLoopOperation forEachOperation, TForEachStatement foreachStatement); 158var foreachVariable = operation.Locals[0]; 193SemanticModel model, ILocalSymbol foreachVariable, IOperation foreachCollection,
EmbeddedLanguages\EmbeddedLanguageDetector.cs (1)
339if (symbol is not ILocalSymbol localSymbol)
ExtractMethod\MethodExtractor.Analyzer.cs (3)
653ILocalSymbol local => local.Type, 751case ILocalSymbol local: 947ILocalSymbol local => new VariableInfo(
ExtractMethod\MethodExtractor.VariableSymbol.cs (2)
194private readonly ILocalSymbol _localSymbol; 197public LocalVariableSymbol(Compilation compilation, ILocalSymbol localSymbol, ITypeSymbol type, HashSet<int> nonNoisySet)
IntroduceParameter\AbstractIntroduceParameterCodeRefactoringProvider.cs (1)
208if (symbol is IRangeVariableSymbol or ILocalSymbol)
IntroduceVariable\AbstractIntroduceVariableService.cs (1)
186!state.GetSemanticMap(cancellationToken).AllReferencedSymbols.OfType<ILocalSymbol>().Any() &&
LanguageServices\AnonymousTypeDisplayService\AbstractStructuralTypeDisplayService.StructuralTypeCollectorVisitor.cs (1)
44public override void VisitLocal(ILocalSymbol symbol)
LanguageServices\SymbolDisplayService\AbstractSymbolDisplayService.AbstractSymbolDescriptionBuilder.cs (3)
319else if (symbol is ILocalSymbol local) 579private async Task AddDescriptionForLocalAsync(ILocalSymbol symbol) 590private async Task<ImmutableArray<SymbolDisplayPart>> GetLocalPartsAsync(ILocalSymbol symbol)
QuickInfo\CommonSemanticQuickInfoProvider.ErrorVisitor.cs (1)
35public override bool VisitLocal(ILocalSymbol symbol)
ReplaceConditionalWithStatements\AbstractReplaceConditionalWithStatementsCodeRefactoringProvider.cs (3)
43protected abstract TLocalDeclarationStatementSyntax GetUpdatedLocalDeclarationStatement(SyntaxGenerator generator, TLocalDeclarationStatementSyntax localDeclarationStatement, ILocalSymbol symbol); 237var symbol = (ILocalSymbol)semanticModel.GetRequiredDeclaredSymbol(variable, cancellationToken);
src\Analyzers\Core\Analyzers\Helpers\HashCodeAnalyzer\HashCodeAnalyzer.cs (2)
158var hashCodeVariable = declarator.Symbol; 224private static bool IsLocalReference(IOperation value, ILocalSymbol accumulatorVariable)
src\Analyzers\Core\Analyzers\Helpers\HashCodeAnalyzer\HashCodeAnalyzer.OperationDeconstructor.cs (2)
22HashCodeAnalyzer analyzer, IMethodSymbol method, ILocalSymbol? hashCodeVariable) : IDisposable 26private readonly ILocalSymbol? _hashCodeVariable = hashCodeVariable;
src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.BlockAnalyzer.cs (2)
594Debug.Assert(symbol is not ILocalSymbol local || !local.IsRef); 613var isUnusedLocalAssignment = symbol is ILocalSymbol localSymbol &&
src\Analyzers\Core\Analyzers\UseCoalesceExpression\AbstractUseCoalesceExpressionForIfNullCheckDiagnosticAnalyzer.cs (2)
175var localSymbol = (ILocalSymbol)semanticModel.GetRequiredDeclaredSymbol(GetDeclarationNode(declarator), cancellationToken);
src\Analyzers\Core\Analyzers\UseCollectionInitializer\AbstractObjectCreationExpressionAnalyzer.cs (1)
142if (initializedSymbol is not ILocalSymbol local)
src\Analyzers\Core\Analyzers\UseConditionalExpression\ForAssignment\UseConditionalExpressionForAssignmentHelpers.cs (3)
97using var _1 = PooledHashSet<ILocalSymbol>.GetInstance(out var symbolsDeclaredInConditional); 101if (operation is IDeclarationPatternOperation { DeclaredSymbol: ILocalSymbol local }) 119static bool ContainsLocalReference(HashSet<ILocalSymbol> declaredPatternSymbols, IOperation? target)
src\Analyzers\Core\CodeFixes\RemoveUnusedParametersAndValues\AbstractRemoveUnusedValuesCodeFixProvider.cs (4)
482var declaredLocal = semanticModel.GetDeclaredSymbol(node, cancellationToken) as ILocalSymbol; 485declaredLocal = semanticModel.GetDeclaredSymbol(node.Parent, cancellationToken) as ILocalSymbol; 918var local = localDeclarationOperation.GetDeclaredVariables().Single();
src\Analyzers\Core\CodeFixes\UseConditionalExpression\ForAssignment\AbstractUseConditionalExpressionForAssignmentCodeFixProvider.cs (3)
161ILocalSymbol? local = null; 222var variable = declarator.Symbol; 247private static bool ReferencesLocalVariable(IOperation operation, ILocalSymbol variable)
ValueTracking\ValueTracker.cs (2)
31or ILocalSymbol 85case ILocalSymbol:
Microsoft.CodeAnalysis.Test.Utilities (31)
Compilation\ControlFlowGraphVerifier.cs (2)
1383foreach (ILocalSymbol local in region.Locals) 1665foreach (ILocalSymbol l in region.Locals)
Compilation\OperationTreeVerifier.cs (3)
591(ILocalSymbol loopObject, ForToLoopOperationUserDefinedInfo userDefinedInfo) = ((ForToLoopOperation)operation).Info; 602private void LogLocals(IEnumerable<ILocalSymbol> locals, string header = "Locals") 615foreach (var local in locals)
Compilation\TestOperationVisitor.cs (3)
242private static void VisitLocals(ImmutableArray<ILocalSymbol> locals) 244foreach (var local in locals) 313(ILocalSymbol loopObject, ForToLoopOperationUserDefinedInfo userDefinedInfo) = ((ForToLoopOperation)operation).Info;
Diagnostics\CouldHaveMoreSpecificTypeAnalyzer.cs (9)
54Dictionary<ILocalSymbol, HashSet<INamedTypeSymbol>> localsSourceTypes = new Dictionary<ILocalSymbol, HashSet<INamedTypeSymbol>>(); 107ILocalSymbol local = singleVariableDeclaration.Symbol; 112foreach (ILocalSymbol local in multiVariableDeclaration.GetDeclaredVariables()) 124foreach (ILocalSymbol local in localsSourceTypes.Keys) 232private static void AssignTo(IOperation target, Dictionary<ILocalSymbol, HashSet<INamedTypeSymbol>> localsSourceTypes, Dictionary<IFieldSymbol, HashSet<INamedTypeSymbol>> fieldsSourceTypes, IOperation sourceValue) 237private static void AssignTo(IOperation target, Dictionary<ILocalSymbol, HashSet<INamedTypeSymbol>> localsSourceTypes, Dictionary<IFieldSymbol, HashSet<INamedTypeSymbol>> fieldsSourceTypes, ITypeSymbol sourceType) 242ILocalSymbol targetLocal = ((ILocalReferenceOperation)target).Local; 293private void Report(OperationBlockAnalysisContext context, ILocalSymbol local, ITypeSymbol moreSpecificType, DiagnosticDescriptor descriptor)
Diagnostics\LocalCouldBeConstAnalyzer.cs (10)
42HashSet<ILocalSymbol> mightBecomeConstLocals = new HashSet<ILocalSymbol>(); 43HashSet<ILocalSymbol> assignedToLocals = new HashSet<ILocalSymbol>(); 85ILocalSymbol local = variable.Symbol; 105foreach (ILocalSymbol couldBeConstLocal in mightBecomeConstLocals) 114private static void AssignTo(IOperation target, HashSet<ILocalSymbol> assignedToLocals, HashSet<ILocalSymbol> mightBecomeConstLocals) 118ILocalSymbol targetLocal = ((ILocalReferenceOperation)target).Local; 133private void Report(OperationBlockAnalysisContext context, ILocalSymbol local, DiagnosticDescriptor descriptor)
Diagnostics\OperationTestAnalyzer.cs (4)
165ILocalSymbol testVariable = ((ILocalReferenceOperation)conditionLeft).Local; 228ILocalSymbol testVariable, IOperation advanceExpression, 1617var leftLocal = ((ILocalReferenceOperation)left).Local; 1644var operandLocal = ((ILocalReferenceOperation)operand).Local;
Microsoft.CodeAnalysis.UnitTests (6)
Diagnostics\OperationTests.cs (6)
132IOperation parent = new BlockOperation(ImmutableArray<IOperation>.Empty, ImmutableArray<ILocalSymbol>.Empty, 151ImmutableArray<IOperation>.Empty, ImmutableArray<ILocalSymbol>.Empty, 168ImmutableArray<IFieldSymbol>.Empty, ImmutableArray<ILocalSymbol>.Empty, 186ImmutableArray<IPropertySymbol>.Empty, ImmutableArray<ILocalSymbol>.Empty, 204parameter: null, locals: ImmutableArray<ILocalSymbol>.Empty, 222ImmutableArray<ILocalSymbol>.Empty,
Microsoft.CodeAnalysis.VisualBasic (45)
Compilation\SemanticModel.vb (1)
2713Public Overloads Function GetDeclaredSymbol(declarationSyntax As CatchStatementSyntax, Optional cancellationToken As CancellationToken = Nothing) As ILocalSymbol
Operations\VisualBasicOperationFactory.vb (24)
956Dim local As ILocalSymbol = boundLocal.LocalSymbol 995Return New FieldInitializerOperation(initializedFields, ImmutableArray(Of ILocalSymbol).Empty, value, _semanticModel, syntax, isImplicit) 1003Return New PropertyInitializerOperation(initializedProperties, ImmutableArray(Of ILocalSymbol).Empty, value, _semanticModel, syntax, isImplicit) 1011Return New ParameterInitializerOperation(parameter, ImmutableArray(Of ILocalSymbol).Empty, value, _semanticModel, syntax, isImplicit) 1079Return New SwitchOperation(ImmutableArray(Of ILocalSymbol).Empty, value, cases, exitLabel, _semanticModel, syntax, isImplicit) 1113Return New SwitchCaseOperation(clauses, body, ImmutableArray(Of ILocalSymbol).Empty, condition, _semanticModel, syntax, isImplicit) 1145Dim locals As ImmutableArray(Of ILocalSymbol) = ImmutableArray(Of ILocalSymbol).Empty 1164Dim locals As ImmutableArray(Of ILocalSymbol) = If(boundForToStatement.DeclaredOrInferredLocalOpt IsNot Nothing, 1165ImmutableArray.Create(Of ILocalSymbol)(boundForToStatement.DeclaredOrInferredLocalOpt), 1166ImmutableArray(Of ILocalSymbol).Empty) 1245Dim locals As ImmutableArray(Of ILocalSymbol) = If(boundForEachStatement.DeclaredOrInferredLocalOpt IsNot Nothing, 1246ImmutableArray.Create(Of ILocalSymbol)(boundForEachStatement.DeclaredOrInferredLocalOpt), 1247ImmutableArray(Of ILocalSymbol).Empty) 1288Dim locals As ImmutableArray(Of ILocalSymbol) = If(boundCatchBlock.LocalOpt IsNot Nothing, 1289ImmutableArray.Create(Of ILocalSymbol)(boundCatchBlock.LocalOpt), 1290ImmutableArray(Of ILocalSymbol).Empty) 1298Dim locals As ImmutableArray(Of ILocalSymbol) = boundBlock.Locals.As(Of ILocalSymbol)() 1347Dim locals As ImmutableArray(Of ILocalSymbol) = ImmutableArray(Of ILocalSymbol).Empty 1414Dim lockTakenSymbol As ILocalSymbol = 1466Dim locals As ImmutableArray(Of ILocalSymbol) = ImmutableArray(Of ILocalSymbol).CastUp(boundUsingStatement.Locals)
Operations\VisualBasicOperationFactory_Methods.vb (3)
432initializer = New VariableInitializerOperation(locals:=ImmutableArray(Of ILocalSymbol).Empty, value, _semanticModel, initializerSyntax, isImplicit) 441initializer = New VariableInitializerOperation(locals:=ImmutableArray(Of ILocalSymbol).Empty, value, _semanticModel, initializerSyntax, isImplicit:=False) 460initializer = New VariableInitializerOperation(locals:=ImmutableArray(Of ILocalSymbol).Empty, initializerValue, _semanticModel, syntax, isImplicit:=True)
SymbolDisplay\SymbolDisplayVisitor.vb (1)
272Public Overrides Sub VisitLocal(symbol As ILocalSymbol)
Symbols\Source\LocalSymbol.vb (12)
260Private ReadOnly Property ILocalSymbol_IsFixed As Boolean Implements ILocalSymbol.IsFixed 292Public ReadOnly Property IsRef As Boolean Implements ILocalSymbol.IsRef 298Public ReadOnly Property RefKind As RefKind Implements ILocalSymbol.RefKind 304Private ReadOnly Property ILocalSymbol_ScopedKind As ScopedKind Implements ILocalSymbol.ScopedKind 310Public MustOverride ReadOnly Property IsFunctionValue As Boolean Implements ILocalSymbol.IsFunctionValue 344Public ReadOnly Property HasConstantValue As Boolean Implements ILocalSymbol.HasConstantValue 354Public ReadOnly Property ConstantValue As Object Implements ILocalSymbol.ConstantValue 395Private ReadOnly Property ILocalSymbol_Type As ITypeSymbol Implements ILocalSymbol.Type 401Private ReadOnly Property ILocalSymbol_NullableAnnotation As NullableAnnotation Implements ILocalSymbol.NullableAnnotation 407Private ReadOnly Property ILocalSymbol_IsConst As Boolean Implements ILocalSymbol.IsConst 413Private ReadOnly Property ILocalSymbol_IsForEach As Boolean Implements ILocalSymbol.IsForEach 419Private ReadOnly Property ILocalSymbol_IsUsing As Boolean Implements ILocalSymbol.IsUsing
VisualBasicExtensions.vb (4)
581Public Function IsFor(localSymbol As ILocalSymbol) As Boolean 587Public Function IsForEach(localSymbol As ILocalSymbol) As Boolean 593Public Function IsCatch(localSymbol As ILocalSymbol) As Boolean 1201Public Function GetDeclaredSymbol(semanticModel As SemanticModel, declarationSyntax As CatchStatementSyntax, Optional cancellationToken As CancellationToken = Nothing) As ILocalSymbol
Microsoft.CodeAnalysis.VisualBasic.CodeStyle (3)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\VariableDeclaratorSyntaxExtensions.vb (1)
39Dim localSymbol = TryCast(semanticModel.GetDeclaredSymbol(name), ILocalSymbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Utilities\SpeculationAnalyzer.vb (2)
601ByRef localVariables As ImmutableArray(Of ILocalSymbol)) 605localVariables = ImmutableArray.Create(DirectCast(model.GetDeclaredSymbol(forEach), ILocalSymbol))
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (3)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\LanguageServices\VisualBasicMoveDeclarationNearReferenceService.vb (2)
45Protected Overrides Function TypesAreCompatibleAsync(document As Document, localSymbol As ILocalSymbol, declarationStatement As LocalDeclarationStatementSyntax, right As SyntaxNode, cancellationToken As CancellationToken) As Task(Of Boolean) 49Protected Overrides Function CanMoveToBlock(localSymbol As ILocalSymbol, currentBlock As SyntaxNode, destinationBlock As SyntaxNode) As Boolean
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\LanguageServices\VisualBasicTypeInferenceService.TypeInferrer.vb (1)
617Return CreateResult(DirectCast(symbol, ILocalSymbol).Type)
Microsoft.CodeAnalysis.VisualBasic.Emit.UnitTests (2)
Emit\EditAndContinue\EditAndContinueTestBase.vb (2)
107Friend Shared Function GetAllLocals(compilation As VisualBasicCompilation, method As IMethodSymbol) As ImmutableArray(Of KeyValuePair(Of ILocalSymbol, Integer)) 109Return locals.SelectAsArray(Function(local, index, arg) New KeyValuePair(Of ILocalSymbol, Integer)(local, index), DirectCast(Nothing, Object))
Microsoft.CodeAnalysis.VisualBasic.Features (14)
CodeRefactorings\InlineTemporary\VisualBasicInlineTemporaryCodeRefactoringProvider.ReferenceRewriter.vb (2)
22Private ReadOnly _localSymbol As ILocalSymbol 35_localSymbol = DirectCast(_semanticModel.GetDeclaredSymbol(_definition, cancellationToken), ILocalSymbol)
CodeRefactorings\InlineTemporary\VisualBasicInlineTemporaryCodeRefactoringProvider.vb (1)
393Dim local = DirectCast(semanticModel.GetDeclaredSymbol(modifiedIdentifier, cancellationToken), ILocalSymbol)
Completion\CompletionProviders\EnumCompletionProvider.vb (1)
92If(TryCast(symbol, ILocalSymbol)?.Type,
ConvertForEachToFor\VisualBasicConvertForEachToForCodeRefactoringProvider.vb (1)
167Protected Overrides Function IsSupported(foreachVariable As ILocalSymbol, foreachOperation As IForEachLoopOperation, foreachStatement As ForEachBlockSyntax) As Boolean
EditAndContinue\VisualBasicEditAndContinueAnalyzer.vb (1)
115Debug.Assert(TypeOf localOrParameter Is IParameterSymbol OrElse TypeOf localOrParameter Is ILocalSymbol OrElse TypeOf localOrParameter Is IRangeVariableSymbol)
ExtractMethod\Extensions.vb (1)
364Dim local = TryCast(symbol, ILocalSymbol)
ExtractMethod\VisualBasicSelectionValidator.vb (1)
204Dim local = TryCast(symbol, ILocalSymbol)
LanguageServices\VisualBasicSymbolDisplayService.SymbolDescriptionBuilder.vb (3)
80ElseIf TypeOf symbol Is ILocalSymbol Then 81Return GetInitializerSourcePartsAsync(DirectCast(symbol, ILocalSymbol)) 131Private Overloads Async Function GetInitializerSourcePartsAsync(symbol As ILocalSymbol) As Task(Of ImmutableArray(Of SymbolDisplayPart))
QuickInfo\VisualBasicSemanticQuickInfoProvider.vb (2)
183If TypeOf symbol Is ILocalSymbol Then 184Return DirectCast(symbol, ILocalSymbol).Type
ReplaceConditionalWithStatementsCodeRefactoringProvider\VisualBasicReplaceConditionalWithStatementsCodeRefactoringProvider.vb (1)
58symbol As ILocalSymbol) As LocalDeclarationStatementSyntax
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (8)
Compilation\SemanticModelAPITests.vb (2)
2948Return CType(model.GetDeclaredSymbol(decl), ILocalSymbol).Type 2989Return CType(model.GetDeclaredSymbol(decl), ILocalSymbol).Type
Compilation\SemanticModelGetDeclaredSymbolAPITests.vb (4)
2081Assert.False(DirectCast(varSymbol7, ILocalSymbol).IsFixed) 2275Assert.False(DirectCast(local, ILocalSymbol).IsFixed) 2862Assert.False(DirectCast(sym, ILocalSymbol).IsForEach) 2869Assert.True(DirectCast(sym, ILocalSymbol).IsForEach)
Semantics\InterpolatedStringTests.vb (2)
1224Dim vSymbol = CType(sm.GetDeclaredSymbol(root.DescendantNodes().OfType(Of ModifiedIdentifierSyntax).Single()), ILocalSymbol) 1273Dim vSymbol = CType(sm.GetDeclaredSymbol(root.DescendantNodes().OfType(Of ModifiedIdentifierSyntax).Single()), ILocalSymbol)
Microsoft.CodeAnalysis.VisualBasic.Symbol.UnitTests (3)
SymbolDisplay\SymbolDisplayTests.vb (1)
5512Dim type = DirectCast(model.GetDeclaredSymbol(declarator.Names(0)), ILocalSymbol).Type
SymbolsTests\Source\LocalTests.vb (2)
34Dim local = DirectCast(model.GetSymbolInfo(expressionSyntax).Symbol, ILocalSymbol) 61Dim local = DirectCast(model.GetSymbolInfo(expressionSyntax).Symbol, ILocalSymbol)
Microsoft.CodeAnalysis.VisualBasic.Workspaces (14)
Classification\SyntaxClassification\NameSyntaxClassifier.vb (2)
131Dim classification = GetClassificationForLocal(DirectCast(symbol, ILocalSymbol)) 204Private Shared Function GetClassificationForLocal(localSymbol As ILocalSymbol) As String
ObsoleteSymbol\VisualBasicObsoleteSymbolService.vb (1)
47Dim localSymbol = TryCast(semanticModel.GetDeclaredSymbol(declarator.Names(0), cancellationToken), ILocalSymbol)
Recommendations\VisualBasicRecommendationServiceRunner.vb (1)
90Dim local = DirectCast(symbol, ILocalSymbol)
Rename\LocalConflictVisitor.vb (2)
155Dim local = DirectCast(symbol, ILocalSymbol) 200Dim local = DirectCast(symbol, ILocalSymbol)
Simplification\Reducers\VisualBasicVariableDeclaratorReducer.vb (2)
149(Not TypeOf declaredSymbol Is ILocalSymbol AndAlso Not TypeOf declaredSymbol Is IFieldSymbol) Then 153Dim localSymbol = TryCast(declaredSymbol, ILocalSymbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\VariableDeclaratorSyntaxExtensions.vb (1)
39Dim localSymbol = TryCast(semanticModel.GetDeclaredSymbol(name), ILocalSymbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Utilities\SpeculationAnalyzer.vb (2)
601ByRef localVariables As ImmutableArray(Of ILocalSymbol)) 605localVariables = ImmutableArray.Create(DirectCast(model.GetDeclaredSymbol(forEach), ILocalSymbol))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\LanguageServices\VisualBasicMoveDeclarationNearReferenceService.vb (2)
45Protected Overrides Function TypesAreCompatibleAsync(document As Document, localSymbol As ILocalSymbol, declarationStatement As LocalDeclarationStatementSyntax, right As SyntaxNode, cancellationToken As CancellationToken) As Task(Of Boolean) 49Protected Overrides Function CanMoveToBlock(localSymbol As ILocalSymbol, currentBlock As SyntaxNode, destinationBlock As SyntaxNode) As Boolean
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\LanguageServices\VisualBasicTypeInferenceService.TypeInferrer.vb (1)
617Return CreateResult(DirectCast(symbol, ILocalSymbol).Type)
Microsoft.CodeAnalysis.Workspaces (35)
FindSymbols\FindReferences\Finders\LocalSymbolReferenceFinder.cs (1)
7internal sealed class LocalSymbolReferenceFinder : AbstractMemberScopedReferenceFinder<ILocalSymbol>
ReassignedVariable\AbstractReassignedVariableService.cs (7)
143var local = semanticModel.GetDeclaredSymbol(variable, cancellationToken) as ILocalSymbol; 150var local = semanticModel.GetDeclaredSymbol(designation, cancellationToken) as ILocalSymbol; 158if (symbol is not IParameterSymbol and not ILocalSymbol) 166ILocalSymbol local => ComputeLocalIsAssigned(semanticModel, local), 266bool ComputeLocalIsAssigned(SemanticModel semanticModel, ILocalSymbol local)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions.cs (3)
333ILocalSymbol localSymbol => localSymbol.Type, 390=> symbol is ILocalSymbol { IsFunctionValue: true }; 615ILocalSymbol localSymbol => localSymbol.Type,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.DataFlowAnalyzer.cs (1)
179foreach (var local in region.Locals)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.DataFlowAnalyzer.FlowGraphAnalysisData.cs (5)
75ImmutableHashSet<ILocalSymbol> capturedLocals, 114public ImmutableHashSet<ILocalSymbol> CapturedLocals { get; } 187private static ImmutableHashSet<ILocalSymbol> GetCapturedLocals(ControlFlowGraph cfg) 189using var _ = PooledHashSet<ILocalSymbol>.GetInstance(out var builder); 195builder.AddRange(dataFlow.Captured.OfType<ILocalSymbol>());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SymbolSpecification.cs (1)
519(kind == SymbolKind.Local && ((ILocalSymbol)symbol).IsConst))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.cs (2)
74/// Interior-method-level symbols (i.e. <see cref="ILabelSymbol"/>, <see cref="ILocalSymbol"/>, <see 320ILocalSymbol => true,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyWriter.cs (1)
359public override void VisitLocal(ILocalSymbol localSymbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AbstractSpeculationAnalyzer.cs (3)
114SemanticModel model, TForEachStatementSyntax forEach, out IMethodSymbol getEnumeratorMethod, out ITypeSymbol elementType, out ImmutableArray<ILocalSymbol> localVariables); 454if (symbol is ILocalSymbol localSymbol && newSymbol is ILocalSymbol newLocalSymbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SymbolEquivalenceComparer.EquivalenceVisitor.cs (4)
122SymbolKind.Local => LocalsAreEquivalent((ILocalSymbol)x, (ILocalSymbol)y), 166private static bool LocalsAreEquivalent(ILocalSymbol x, ILocalSymbol y)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (2)
64SymbolKind.Local => CombineHashCodes((ILocalSymbol)x, currentHash), 103private static int CombineHashCodes(ILocalSymbol x, int currentHash)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\MoveDeclarationNearReference\AbstractMoveDeclarationNearReferenceService.cs (3)
31protected abstract bool CanMoveToBlock(ILocalSymbol localSymbol, SyntaxNode currentBlock, SyntaxNode destinationBlock); 35protected abstract Task<bool> TypesAreCompatibleAsync(Document document, ILocalSymbol localSymbol, TLocalDeclarationStatementSyntax declarationStatement, SyntaxNode right, CancellationToken cancellationToken); 219var localSymbol = state.LocalSymbol;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\MoveDeclarationNearReference\AbstractMoveDeclarationNearReferenceService.State.cs (2)
29public ILocalSymbol LocalSymbol { get; private set; } 83LocalSymbol = (ILocalSymbol)semanticModel.GetDeclaredSymbol(
Microsoft.CodeAnalysis.Workspaces.UnitTests (2)
SymbolKeyTests.cs (2)
542var symbols = GetDeclaredSymbols(compilation).OfType<IMethodSymbol>().SelectMany(ms => GetInteriorSymbols(ms, compilation).OfType<ILocalSymbol>()).ToList(); 1408Assert.True(symbols.Any(s => s is ILocalSymbol));
Microsoft.VisualStudio.LanguageServices.CSharp (1)
LanguageService\CSharpHelpContextService.cs (1)
186if (symbol is ILocalSymbol localSymbol && !symbol.DeclaringSyntaxReferences.Any(static (d, token) => d.GetSyntax().DescendantTokens().Contains(token), token))
Microsoft.VisualStudio.LanguageServices.VisualBasic (1)
Help\VisualBasicHelpContextService.Visitor.vb (1)
818Dim local = TryCast(_semanticModel.GetDeclaredSymbol(bestName, _cancellationToken), ILocalSymbol)