src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.BlockAnalyzer.cs (7)
32/// We use this value in <see cref="ShouldAnalyze(IOperation, ISymbol, ref bool)"/> to determine whether to bail from analysis or not.
45/// We use this value in <see cref="ShouldAnalyze(IOperation, ISymbol, ref bool)"/> to determine whether to bail from analysis or not.
51/// We use this value in <see cref="ShouldAnalyze(IOperation, ISymbol, ref bool)"/> to determine whether to bail from analysis or not.
253/// delegate escape, and corresponding bail out from flow analysis in <see cref="ShouldAnalyze(IOperation, ISymbol, ref bool)"/>.
301/// delegate escape, and corresponding bail out from flow analysis in <see cref="ShouldAnalyze(IOperation, ISymbol, ref bool)"/>.
366private bool ShouldAnalyze(IOperation operationBlock, ISymbol owningSymbol, ref bool hasUnknownOperationNoneDescendant)
589ISymbol symbol,
src\Analyzers\Core\Analyzers\UseConditionalExpression\ForReturn\UseConditionalExpressionForReturnHelpers.cs (1)
16ISymbol containingSymbol,
src\Analyzers\Core\Analyzers\UseThrowExpression\AbstractUseThrowExpressionDiagnosticAnalyzer.cs (6)
107if (!TryDecomposeIfCondition(ifOperation, out var localOrParameter))
139private static bool ValueIsAccessed(SemanticModel semanticModel, IConditionalOperation ifOperation, IBlockOperation containingBlock, ISymbol localOrParameter, IExpressionStatementOperation expressionStatement, IAssignmentOperation assignmentExpression)
168IBlockOperation containingBlock, IConditionalOperation ifOperation, ISymbol localOrParameter,
190if (!TryGetLocalOrParameterSymbol(assignmentExpression.Value, out var assignmentValue))
210[NotNullWhen(true)] out ISymbol? localOrParameter)
242[NotNullWhen(true)] out ISymbol? localOrParameter)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\INamedTypeSymbolExtensions.cs (63)
67public static ISymbol? FindImplementationForAbstractMember(this INamedTypeSymbol? type, ISymbol symbol)
78private static bool ImplementationExists(INamedTypeSymbol classOrStructType, ISymbol member)
83ISymbol member,
84Func<INamedTypeSymbol, ISymbol, bool> isValidImplementation,
152ISymbol member,
153Func<INamedTypeSymbol, ISymbol, bool> isValid,
156var implementation = classOrStructType.FindImplementationForInterfaceMember(member);
176public static ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)> GetAllUnimplementedMembers(
194static ImmutableArray<ISymbol> GetImplicitlyImplementableMembers(INamedTypeSymbol type, ISymbol within)
209static bool IsPropertyWithNonPublicImplementableAccessor(ISymbol member)
226static bool IsImplicitlyImplementable(ISymbol member, ISymbol within)
243private static bool IsImplementable(ISymbol m)
246public static ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)> GetAllUnimplementedMembersInThis(
256var implementation = classOrStructType.FindImplementationForInterfaceMember(m);
264public static ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)> GetAllUnimplementedMembersInThis(
267Func<INamedTypeSymbol, ISymbol, ImmutableArray<ISymbol>> interfaceMemberGetter,
275var implementation = classOrStructType.FindImplementationForInterfaceMember(m);
283public static ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)> GetAllUnimplementedExplicitMembers(
297private static ImmutableArray<ISymbol> GetExplicitlyImplementableMembers(INamedTypeSymbol type, ISymbol within)
309private static bool IsPropertyWithInaccessibleImplementableAccessor(ISymbol member, ISymbol within)
321private static bool IsInaccessibleImplementableAccessor(IMethodSymbol? accessor, ISymbol within)
324private static ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)> GetAllUnimplementedMembers(
327Func<INamedTypeSymbol, ISymbol, Func<INamedTypeSymbol, ISymbol, bool>, CancellationToken, bool> isImplemented,
328Func<INamedTypeSymbol, ISymbol, bool> isValidImplementation,
329Func<INamedTypeSymbol, ISymbol, ImmutableArray<ISymbol>> interfaceMemberGetter,
399private static ImmutableArray<ISymbol> GetUnimplementedMembers(
402Func<INamedTypeSymbol, ISymbol, Func<INamedTypeSymbol, ISymbol, bool>, CancellationToken, bool> isImplemented,
403Func<INamedTypeSymbol, ISymbol, bool> isValidImplementation,
404Func<INamedTypeSymbol, ISymbol, ImmutableArray<ISymbol>> interfaceMemberGetter,
407using var _ = ArrayBuilder<ISymbol>.GetInstance(out var results);
409foreach (var member in interfaceMemberGetter(interfaceType, classOrStructType))
438void AddIfNotImplemented(ISymbol member)
445public static IEnumerable<ISymbol> GetAttributeNamedParameters(
448ISymbol within)
461foreach (var member in type.GetMembers())
463var namedParameter = IsAttributeNamedParameter(member, within ?? compilation.Assembly);
472private static ISymbol? IsAttributeNamedParameter(
473ISymbol symbol,
474ISymbol within)
514private static ImmutableArray<ISymbol> GetMembers(INamedTypeSymbol type, ISymbol within)
527public static ImmutableArray<ISymbol> GetOverridableMembers(
533using var _ = PooledDictionary<ISymbol, int>.GetInstance(out var result);
566Dictionary<ISymbol, int> result, INamedTypeSymbol containingType, CancellationToken cancellationToken)
568foreach (var member in containingType.GetMembers())
579var overriddenMember = member.GetOverriddenMember();
587Dictionary<ISymbol, int> result, INamedTypeSymbol containingType, CancellationToken cancellationToken)
591foreach (var member in containingType.GetMembers())
609Dictionary<ISymbol, int> result, INamedTypeSymbol containingType,
612foreach (var member in type.GetMembers())
623private static bool IsOverridable(ISymbol member, INamedTypeSymbol containingType)
643private static bool IsEqualsObjectOverride(ISymbol? member)
654private static bool IsEqualsObject(ISymbol member)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions.cs (95)
20public static string ToNameDisplayString(this ISymbol symbol)
23public static string ToSignatureDisplayString(this ISymbol symbol)
26public static bool HasPublicResultantVisibility(this ISymbol symbol)
29public static SymbolVisibility GetResultantVisibility(this ISymbol symbol)
76public static ISymbol? GetOverriddenMember(this ISymbol? symbol, bool allowLooseMatch = false)
81ISymbol? exactMatch = symbol switch
97if (TryFindLooseMatch(symbol, baseType, out var looseMatch))
104bool TryFindLooseMatch(ISymbol symbol, INamedTypeSymbol baseType, [NotNullWhen(true)] out ISymbol? looseMatch)
109foreach (var member in baseType.GetMembers(symbol.Name))
137public static ImmutableArray<ISymbol> ExplicitInterfaceImplementations(this ISymbol symbol)
140IEventSymbol @event => ImmutableArray<ISymbol>.CastUp(@event.ExplicitInterfaceImplementations),
141IMethodSymbol method => ImmutableArray<ISymbol>.CastUp(method.ExplicitInterfaceImplementations),
142IPropertySymbol property => ImmutableArray<ISymbol>.CastUp(property.ExplicitInterfaceImplementations),
146public static ImmutableArray<ISymbol> ExplicitOrImplicitInterfaceImplementations(this ISymbol symbol)
151using var _ = ArrayBuilder<ISymbol>.GetInstance(out var result);
155foreach (var interfaceMember in iface.GetMembers())
157var impl = symbol.ContainingType.FindImplementationForInterfaceMember(interfaceMember);
171public static ImmutableArray<ISymbol> ImplicitInterfaceImplementations(this ISymbol symbol)
174public static bool IsOverridable([NotNullWhen(true)] this ISymbol? symbol)
181public static bool IsImplementableMember([NotNullWhen(true)] this ISymbol? symbol)
214public static INamedTypeSymbol? GetContainingTypeOrThis(this ISymbol symbol)
224public static bool IsErrorType([NotNullWhen(true)] this ISymbol? symbol)
227public static bool IsModuleType([NotNullWhen(true)] this ISymbol? symbol)
230public static bool IsInterfaceType([NotNullWhen(true)] this ISymbol? symbol)
233public static bool IsArrayType([NotNullWhen(true)] this ISymbol? symbol)
236public static bool IsTupleType([NotNullWhen(true)] this ISymbol? symbol)
239public static bool IsAnonymousFunction([NotNullWhen(true)] this ISymbol? symbol)
242public static bool IsKind([NotNullWhen(true)] this ISymbol? symbol, SymbolKind kind)
245public static bool MatchesKind([NotNullWhen(true)] this ISymbol? symbol, SymbolKind kind)
248public static bool MatchesKind([NotNullWhen(true)] this ISymbol? symbol, SymbolKind kind1, SymbolKind kind2)
254public static bool MatchesKind([NotNullWhen(true)] this ISymbol? symbol, SymbolKind kind1, SymbolKind kind2, SymbolKind kind3)
260public static bool MatchesKind([NotNullWhen(true)] this ISymbol? symbol, params SymbolKind[] kinds)
266public static bool IsReducedExtension([NotNullWhen(true)] this ISymbol? symbol)
269public static bool IsEnumMember([NotNullWhen(true)] this ISymbol? symbol)
272public static bool IsExtensionMethod(this ISymbol symbol)
275public static bool IsLocalFunction([NotNullWhen(true)] this ISymbol? symbol)
278public static bool IsAnonymousOrLocalFunction([NotNullWhen(true)] this ISymbol? symbol)
281public static bool IsModuleMember([NotNullWhen(true)] this ISymbol? symbol)
284public static bool IsConstructor([NotNullWhen(true)] this ISymbol? symbol)
287public static bool IsStaticConstructor([NotNullWhen(true)] this ISymbol? symbol)
290public static bool IsDestructor([NotNullWhen(true)] this ISymbol? symbol)
293public static bool IsUserDefinedOperator([NotNullWhen(true)] this ISymbol? symbol)
296public static bool IsConversion([NotNullWhen(true)] this ISymbol? symbol)
299public static bool IsOrdinaryMethod([NotNullWhen(true)] this ISymbol? symbol)
302public static bool IsOrdinaryMethodOrLocalFunction([NotNullWhen(true)] this ISymbol? symbol)
305public static bool IsDelegateType([NotNullWhen(true)] this ISymbol? symbol)
308public static bool IsAnonymousType([NotNullWhen(true)] this ISymbol? symbol)
311public static bool IsNormalAnonymousType([NotNullWhen(true)] this ISymbol? symbol)
314public static bool IsAnonymousDelegateType([NotNullWhen(true)] this ISymbol? symbol)
317public static bool IsAnonymousTypeProperty([NotNullWhen(true)] this ISymbol? symbol)
320public static bool IsTupleField([NotNullWhen(true)] this ISymbol? symbol)
323public static bool IsIndexer([NotNullWhen(true)] this ISymbol? symbol)
326public static bool IsWriteableFieldOrProperty([NotNullWhen(true)] this ISymbol? symbol)
334public static bool IsRequired([NotNullWhen(true)] this ISymbol? symbol)
337public static ITypeSymbol? GetMemberType(this ISymbol? symbol)
349public static int GetArity(this ISymbol symbol)
358public static ISymbol? GetOriginalUnreducedDefinition(this ISymbol? symbol)
401public static bool IsFunctionValue([NotNullWhen(true)] this ISymbol? symbol)
404public static bool IsThisParameter([NotNullWhen(true)] this ISymbol? symbol)
408public static ISymbol? ConvertThisParameterToType(this ISymbol? symbol)
418public static bool IsParams([NotNullWhen(true)] this ISymbol? symbol)
421public static ImmutableArray<IParameterSymbol> GetParameters(this ISymbol? symbol)
429public static ImmutableArray<ITypeParameterSymbol> GetTypeParameters(this ISymbol? symbol)
437public static ImmutableArray<ITypeParameterSymbol> GetAllTypeParameters(this ISymbol? symbol)
450public static ImmutableArray<ITypeSymbol> GetTypeArguments(this ISymbol? symbol)
458public static ImmutableArray<ITypeSymbol> GetAllTypeArguments(this ISymbol symbol)
473public static bool IsAttribute([NotNullWhen(true)] this ISymbol? symbol)
482public static bool RequiresUnsafeModifier([NotNullWhen(true)] this ISymbol? member)
489this ISymbol? symbol,
532public static bool IsStaticType([NotNullWhen(true)] this ISymbol? symbol)
535public static bool IsNamespace([NotNullWhen(true)] this ISymbol? symbol)
539[NotNullWhen(true)] this ISymbol? symbol, ISymbol withinType, IAssemblySymbol withinAssembly, CancellationToken cancellationToken)
559public static IEnumerable<IPropertySymbol> GetValidAnonymousTypeProperties(this ISymbol symbol)
565public static Accessibility ComputeResultantAccessibility(this ISymbol? symbol, ITypeSymbol finalDestination)
591public static bool IsInaccessibleLocal(this ISymbol symbol, int position)
609public static bool IsAccessor([NotNullWhen(true)] this ISymbol? symbol)
612public static bool IsPropertyAccessor([NotNullWhen(true)] this ISymbol? symbol)
615public static bool IsEventAccessor([NotNullWhen(true)] this ISymbol? symbol)
618public static bool IsFromSource(this ISymbol symbol)
621public static bool IsNonImplicitAndFromSource(this ISymbol symbol)
624public static ITypeSymbol? GetSymbolType(this ISymbol? symbol)
640public static bool IsAwaitableNonDynamic([NotNullWhen(true)] this ISymbol? symbol, SemanticModel semanticModel, int position)
779public static bool IsKind<TSymbol>(this ISymbol symbol, SymbolKind kind, [NotNullWhen(true)] out TSymbol? result) where TSymbol : class, ISymbol
796public static bool IsSymbolWithSpecialDiscardName(this ISymbol symbol)
805public static bool IsObsolete(this ISymbol symbol)
812public static bool HasAttribute([NotNullWhen(true)] this ISymbol? symbol, [NotNullWhen(true)] INamedTypeSymbol? attributeClass)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions_Accessibility.cs (11)
17this ISymbol symbol,
18ISymbol within,
39this ISymbol symbol,
51this ISymbol symbol,
64ISymbol symbol,
83ISymbol symbol,
84ISymbol within, // must be assembly or named type symbol
174private static bool IsNamedTypeAccessible(INamedTypeSymbol type, ISymbol within)
212ISymbol within)
247ISymbol within,
407ISymbol within,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.cs (13)
403public static bool CanSupportCollectionInitializer(this ITypeSymbol typeSymbol, ISymbol within)
434public static IEnumerable<T> GetAccessibleMembersInBaseTypes<T>(this ITypeSymbol containingType, ISymbol within) where T : class, ISymbol
443public static ImmutableArray<T> GetAccessibleMembersInThisAndBaseTypes<T>(this ITypeSymbol? containingType, ISymbol within) where T : class, ISymbol
453public static ImmutableArray<T> GetAccessibleMembersInThisAndBaseTypes<T>(this ITypeSymbol? containingType, string memberName, ISymbol within) where T : class, ISymbol
498public static IEnumerable<T> SelectAccessibleMembers<T>(this IEnumerable<ITypeSymbol>? types, ISymbol within) where T : class, ISymbol
508private static IEnumerable<T> SelectAccessibleMembers<T>(this IEnumerable<ITypeSymbol>? types, string memberName, ISymbol within) where T : class, ISymbol
693foreach (var member in type.GetMembers())
754public static bool IsReadOnlySpan([NotNullWhen(true)] this ISymbol? symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SemanticModelExtensions.cs (11)
47public static ISymbol GetRequiredDeclaredSymbol(this SemanticModel semanticModel, SyntaxNode declaration, CancellationToken cancellationToken)
59public static ISymbol GetRequiredEnclosingSymbol(this SemanticModel semanticModel, int position, CancellationToken cancellationToken)
66where TSymbol : class, ISymbol
68for (var symbol = semanticModel.GetEnclosingSymbol(position, cancellationToken);
81public static ISymbol GetEnclosingNamedTypeOrAssembly(this SemanticModel semanticModel, int position, CancellationToken cancellationToken)
84(ISymbol)semanticModel.Compilation.Assembly;
93public static IEnumerable<ISymbol> GetExistingSymbols(
115public static HashSet<ISymbol> GetAllDeclaredSymbols(
118var symbols = new HashSet<ISymbol>();
129HashSet<ISymbol> symbols, CancellationToken cancellationToken, Func<SyntaxNode, bool>? descendInto = null)
131var symbol = semanticModel.GetDeclaredSymbol(node, cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.AnalysisData.cs (14)
35private readonly PooledHashSet<ISymbol> _referenceTakenSymbolsBuilder;
40_referenceTakenSymbolsBuilder = PooledHashSet<ISymbol>.GetInstance();
61protected abstract PooledDictionary<(ISymbol symbol, IOperation operation), bool> SymbolsWriteBuilder { get; }
66protected abstract PooledHashSet<ISymbol> SymbolsReadBuilder { get; }
132public abstract void OnLValueCaptureFound(ISymbol symbol, IOperation operation, CaptureId captureId);
137public abstract void SetTargetsFromSymbolForDelegate(IOperation write, ISymbol symbol);
143protected static PooledDictionary<(ISymbol Symbol, IOperation Write), bool> CreateSymbolsWriteMap(
146var symbolsWriteMap = PooledDictionary<(ISymbol Symbol, IOperation Write), bool>.GetInstance();
150protected static PooledDictionary<(ISymbol Symbol, IOperation Write), bool> UpdateSymbolsWriteMap(
151PooledDictionary<(ISymbol Symbol, IOperation Write), bool> symbolsWriteMap,
158(ISymbol, IOperation) key = (parameter, null);
178public void OnReadReferenceFound(ISymbol symbol)
201public void OnWriteReferenceFound(ISymbol symbol, IOperation operation, bool maybeWritten, bool isRef)
237foreach (var symbol in SymbolsWriteBuilder.Keys.Select(d => d.symbol).ToArray())
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.BasicBlockAnalysisData.cs (7)
30private readonly Dictionary<ISymbol, PooledHashSet<IOperation>> _reachingWrites;
64public void Clear(ISymbol symbol)
76public void ForEachCurrentWrite<TArg>(ISymbol symbol, Action<IOperation, TArg> action, TArg arg)
88public bool ForEachCurrentWrite<TArg>(ISymbol symbol, Func<IOperation, TArg, bool> action, TArg arg)
106public void OnWriteReferenceFound(ISymbol symbol, IOperation operation, bool maybeWritten)
132foreach (var key in _reachingWrites.Keys)
225private static void AddEntries(Dictionary<ISymbol, PooledHashSet<IOperation>> result, BasicBlockAnalysisData source)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.DataFlowAnalyzer.FlowGraphAnalysisData.cs (17)
41private readonly PooledDictionary<CaptureId, PooledHashSet<(ISymbol, IOperation)>> _lValueFlowCapturesMap;
69private readonly PooledDictionary<(int firstBlockOrdinal, int lastBlockOrdinal), PooledHashSet<(ISymbol, IOperation)>> _symbolWritesInsideBlockRangeMap;
73ISymbol owningSymbol,
77PooledDictionary<(ISymbol symbol, IOperation operation), bool> symbolsWriteMap,
78PooledHashSet<ISymbol> symbolsRead,
99_lValueFlowCapturesMap = PooledDictionary<CaptureId, PooledHashSet<(ISymbol, IOperation)>>.GetInstance();
103_symbolWritesInsideBlockRangeMap = PooledDictionary<(int firstBlockOrdinal, int lastBlockOrdinal), PooledHashSet<(ISymbol, IOperation)>>.GetInstance();
106public ISymbol OwningSymbol { get; }
108protected override PooledHashSet<ISymbol> SymbolsReadBuilder { get; }
110protected override PooledDictionary<(ISymbol symbol, IOperation operation), bool> SymbolsWriteBuilder { get; }
118ISymbol owningSymbol,
131symbolsRead: PooledHashSet<ISymbol>.GetInstance(),
215private PooledHashSet<(ISymbol, IOperation)> GetOrCreateSymbolWritesInBlockRange(int firstBlockOrdinal, int lastBlockOrdinal, CancellationToken cancellationToken)
224writesInBlockRange = PooledHashSet<(ISymbol, IOperation)>.GetInstance();
462public override void OnLValueCaptureFound(ISymbol symbol, IOperation operation, CaptureId captureId)
466captures = PooledHashSet<(ISymbol, IOperation)>.GetInstance();
514public override void SetTargetsFromSymbolForDelegate(IOperation write, ISymbol symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.OperationTreeAnalysisData.cs (8)
24PooledDictionary<(ISymbol symbol, IOperation operation), bool> symbolsWriteMap,
25PooledHashSet<ISymbol> symbolsRead,
35protected override PooledHashSet<ISymbol> SymbolsReadBuilder { get; }
37protected override PooledDictionary<(ISymbol symbol, IOperation operation), bool> SymbolsWriteBuilder { get; }
42ISymbol owningSymbol,
47symbolsRead: PooledHashSet<ISymbol>.GetInstance(),
66public override void OnLValueCaptureFound(ISymbol symbol, IOperation operation, CaptureId captureId)
78public override void SetTargetsFromSymbolForDelegate(IOperation write, ISymbol symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.Walker.cs (13)
27private ISymbol _currentContainingSymbol;
30private PooledDictionary<IAssignmentOperation, PooledHashSet<(ISymbol, IOperation)>> _pendingWritesMap;
36ISymbol containingSymbol,
52private void Visit(ISymbol containingSymbol, IEnumerable<IOperation> operations, AnalysisData analysisData, CancellationToken cancellationToken)
59_pendingWritesMap = PooledDictionary<IAssignmentOperation, PooledHashSet<(ISymbol, IOperation)>>.GetInstance();
91private void OnReadReferenceFound(ISymbol symbol)
94private void OnWriteReferenceFound(ISymbol symbol, IOperation operation, ValueUsageInfo valueUsageInfo)
102private void OnLValueCaptureFound(ISymbol symbol, IOperation operation, CaptureId captureId)
108private void OnReferenceFound(ISymbol symbol, IOperation operation)
160private bool MakePendingWrite(IOperation operation, ISymbol symbolOpt)
167var set = PooledHashSet<(ISymbol, IOperation)>.GetInstance();
176set = PooledHashSet<(ISymbol, IOperation)>.GetInstance();
408private void ProcessPossibleDelegateCreationAssignment(ISymbol symbol, IOperation write)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SemanticFacts\ISemanticFacts.cs (6)
67ISymbol? GetDeclaredSymbol(SemanticModel semanticModel, SyntaxToken token, CancellationToken cancellationToken);
92IEnumerable<ISymbol> GetDeclaredSymbols(SemanticModel semanticModel, SyntaxNode memberDeclaration, CancellationToken cancellationToken);
97ISymbol? FindFieldOrPropertyForArgument(SemanticModel semanticModel, SyntaxNode argument, CancellationToken cancellationToken);
98ISymbol? FindFieldOrPropertyForAttributeArgument(SemanticModel semanticModel, SyntaxNode argument, CancellationToken cancellationToken);
100ImmutableArray<ISymbol> GetBestOrAllSymbols(SemanticModel semanticModel, SyntaxNode? node, SyntaxToken token, CancellationToken cancellationToken);
107ImmutableArray<IMethodSymbol> GetLocalFunctionSymbols(Compilation compilation, ISymbol symbol, CancellationToken cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.cs (31)
30/// the "same" <see cref="ISymbol.ContainingType"/> and
31/// equal <see cref="ISymbol.MetadataName"/>.</item>
33/// the "same" <see cref="ISymbol.ContainingType"/>,
34/// equal <see cref="ISymbol.MetadataName"/>,
40/// the "same" <see cref="ISymbol.ContainingAssembly"/>.
41/// <see cref="ISymbol.MetadataName"/> is not used because module identity is not important in practice.</item>
43/// the "same" <see cref="ISymbol.ContainingSymbol"/>,
44/// equal <see cref="ISymbol.MetadataName"/>,
48/// the "same" <see cref="ISymbol.ContainingSymbol"/> and
49/// equal <see cref="ISymbol.MetadataName"/>.
54/// the "same" <see cref="ISymbol.ContainingSymbol"/> and
55/// equal <see cref="ISymbol.MetadataName"/>.</item>
59/// the "same" the "same" <see cref="ISymbol.ContainingType"/>,
60/// the "same" <see cref="ISymbol.MetadataName"/>, and have
64/// the "same" <see cref="ISymbol.ContainingSymbol"/> and
65/// the "same" <see cref="ISymbol.MetadataName"/>.</item>
67/// the "same" <see cref="ISymbol.ContainingSymbol"/> and
68/// the "same" <see cref="ISymbol.MetadataName"/>.</item>
70/// the "same" <see cref="ISymbol.Name"/>.</item>
77/// cref="SyntaxTree"/> is enumerated to list all the symbols with the same <see cref="ISymbol.Name"/> and <see
78/// cref="ISymbol.Kind"/> as the original symbol. The symbol with the same index in the destination tree as the
128public static SymbolKey Create(ISymbol? symbol, CancellationToken cancellationToken = default)
147public static bool CanCreate(ISymbol symbol, CancellationToken cancellationToken)
200public static string CreateString(ISymbol? symbol, CancellationToken cancellationToken = default)
204internal static string CreateStringWorker(int version, ISymbol? symbol, CancellationToken cancellationToken = default)
231/// to the corresponding <see cref="ISymbol"/> in a future <see cref="Compilation"/>.
243where TSymbol : class, ISymbol
259ImmutableArray<ISymbol>.CastUp(symbols.Builder.ToImmutableAndClear()),
296string? metadataName) where TSymbol : ISymbol
305foreach (var member in members)
315public static bool IsBodyLevelSymbol(ISymbol symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (13)
332private readonly Stack<ISymbol?> _contextualSymbolStack = new();
385where TOwningSymbol : ISymbol
425public ContextualSymbolPopper PushContextualSymbol(ISymbol? contextualSymbol)
431private void PopContextualSymbol(ISymbol? contextualSymbol)
438public ISymbol? CurrentContextualSymbol
447public readonly ref struct ContextualSymbolPopper(SymbolKeyReader reader, ISymbol? contextualSymbol)
468public SymbolKeyResolution ReadSymbolKey(ISymbol? contextualSymbol, out string? failureReason)
539Func<TContextualSymbol, int, ISymbol?>? getContextualSymbol,
558var nextContextualSymbol = contextualSymbol is null ? null : getContextualSymbol?.Invoke(contextualSymbol, i);
591Func<TContextualSymbol, int, ISymbol?>? getContextualSymbol,
593where TContextualSymbol : ISymbol
594where TSymbol : ISymbol
729var symbol = semanticModel.GetDeclaredSymbol(node, CancellationToken);
src\Analyzers\Core\CodeFixes\ImplementAbstractClass\ImplementAbstractClassData.cs (19)
35ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)> unimplementedMembers)
41private readonly ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)> _unimplementedMembers = unimplementedMembers;
89ISymbol? throughMember, bool? canDelegateAllMembers, CancellationToken cancellationToken)
126private ImmutableArray<ISymbol> GenerateMembers(
127Compilation compilation, ISymbol? throughMember,
137private ISymbol? GenerateMember(
138Compilation compilation, ISymbol member, ISymbol? throughMember,
151private ISymbol? GenerateMember(
152Compilation compilation, ISymbol member, ISymbol? throughMember, bool addUnsafe,
175private ISymbol GenerateMethod(
176Compilation compilation, IMethodSymbol method, ISymbol? throughMember,
197ISymbol? throughMember,
238IEventSymbol @event, ISymbol? throughMember, Accessibility accessibility, DeclarationModifiers modifiers)
248IEventSymbol @event, IMethodSymbol? accessor, ISymbol? throughMember,
269public ImmutableArray<(ISymbol symbol, bool canDelegateAllMembers)> GetDelegatableMembers(CancellationToken cancellationToken)
277using var _ = ArrayBuilder<(ISymbol symbol, bool canDelegateAllMembers)>.GetInstance(out var result);
284foreach (var member in members)
src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementInterfaceGenerator.cs (29)
46private ISymbol? ThroughMember => Configuration.ThroughMember;
76ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)> unimplementedMembers,
77ImmutableArray<ISymbol> extraMembers,
106private ImmutableArray<ISymbol> GenerateMembers(
109ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)> unimplementedMembers,
126using var _1 = ArrayBuilder<ISymbol>.GetInstance(out var implementedVisibleMembers);
127using var _2 = ArrayBuilder<ISymbol>.GetInstance(out var implementedMembers);
131foreach (var unimplementedInterfaceMember in unimplementedInterfaceMembers)
160private string DetermineMemberName(ISymbol member, ArrayBuilder<ISymbol> implementedVisibleMembers, out ISymbol? conflictingMember)
167var memberNames = State.ClassOrStructType.GetAccessibleMembersInThisAndBaseTypes<ISymbol>(State.ClassOrStructType).Select(m => m.Name);
179private IEnumerable<ISymbol?> GenerateMembers(
182ISymbol member,
183ArrayBuilder<ISymbol> implementedVisibleMembers,
200var memberName = DetermineMemberName(member, implementedVisibleMembers, out var conflictingMember);
229ParseOptions options, ISymbol member, string memberName, bool supportsImplementingLessAccessibleMember)
257private bool HasUnexpressibleConstraint(ParseOptions options, ISymbol member)
284public ImmutableArray<ISymbol> GenerateMembers(
286ISymbol member,
287ISymbol? conflictingMember,
312private ISymbol GenerateEvent(Compilation compilation, string memberName, bool generateInvisibly, SyntaxGenerator factory, DeclarationModifiers modifiers, bool useExplicitInterfaceSymbol, Accessibility accessibility, IEventSymbol @event)
350ISymbol member,
364private static bool HasNameConflict(ISymbol member, ISymbol baseMember)
387private bool HasMatchingMember(ArrayBuilder<ISymbol> implementedVisibleMembers, ISymbol member)
412private bool MembersMatch(ISymbol existingMember, ISymbol memberToAdd)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService.cs (12)
66public TDeclarationNode AddMembers<TDeclarationNode>(TDeclarationNode destination, IEnumerable<ISymbol> members, CodeGenerationContextInfo info, CancellationToken cancellationToken)
116public TDeclarationNode UpdateDeclarationMembers<TDeclarationNode>(TDeclarationNode declaration, IList<ISymbol> newMembers, CodeGenerationContextInfo info, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode
141public abstract TDeclarationNode UpdateDeclarationMembers<TDeclarationNode>(TDeclarationNode declaration, IList<ISymbol> newMembers, TCodeGenerationContextInfo info, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode;
272IEnumerable<ISymbol> members,
295IEnumerable<ISymbol> members,
302foreach (var member in members)
326IEnumerable<ISymbol> members,
334foreach (var member in members)
343private SyntaxNode? GetNewMember(TCodeGenerationContextInfo info, CodeGenerationDestination codeGenerationDestination, ISymbol member, CancellationToken cancellationToken)
359ISymbol member,
374private static bool GeneratingEnum(IEnumerable<ISymbol> members)
456public Task<Document> AddMembersAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IEnumerable<ISymbol> members, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\ICodeGenerationService.cs (4)
84TDeclarationNode AddMembers<TDeclarationNode>(TDeclarationNode destination, IEnumerable<ISymbol> members, CodeGenerationContextInfo info, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode;
124TDeclarationNode UpdateDeclarationMembers<TDeclarationNode>(TDeclarationNode declaration, IList<ISymbol> newMembers, CodeGenerationContextInfo info, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode;
174Task<Document> AddMembersAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IEnumerable<ISymbol> members, CancellationToken cancellationToken);
179bool CanAddTo(ISymbol destination, Solution solution, CancellationToken cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\SyntaxAnnotationExtensions.cs (1)
16where TSymbol : ISymbol
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions.cs (14)
87private static ITypeSymbol GetType(Compilation compilation, ISymbol symbol)
102this SyntaxGenerator generator, IMethodSymbol method, ISymbol throughMember)
117this SyntaxGenerator generator, ISymbol member, ISymbol throughMember)
181static SyntaxNode GenerateContainerName(SyntaxGenerator factory, ISymbol throughMember)
195ISymbol? throughMember,
234ISymbol? throughMember,
278private static bool TryGetValue(IDictionary<string, ISymbol>? dictionary, string key, [NotNullWhen(true)] out string? value)
281if (dictionary != null && dictionary.TryGetValue(key, out var symbol))
290public static ImmutableArray<ISymbol> CreateFieldsForParameters(
293using var _ = ArrayBuilder<ISymbol>.GetInstance(out var result);
312public static ImmutableArray<ISymbol> CreatePropertiesForParameters(
315using var _ = ArrayBuilder<ISymbol>.GetInstance(out var result);
347IDictionary<string, ISymbol>? parameterToExistingFieldMap,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\SemanticsFactsService\AbstractSemanticFactsService.cs (10)
31private static readonly Func<ISymbol, bool> s_LocalNameFilter = s =>
74string baseName, Func<ISymbol, bool> filter,
91protected virtual IEnumerable<ISymbol> GetCollidableSymbols(SemanticModel semanticModel, SyntaxNode location, SyntaxNode container, CancellationToken cancellationToken)
114var impl = type.FindImplementationForInterfaceMember(disposeMethodToLookFor);
197public ISymbol GetDeclaredSymbol(SemanticModel semanticModel, SyntaxToken token, CancellationToken cancellationToken)
227public IEnumerable<ISymbol> GetDeclaredSymbols(SemanticModel semanticModel, SyntaxNode memberDeclaration, CancellationToken cancellationToken)
236public ISymbol FindFieldOrPropertyForArgument(SemanticModel semanticModel, SyntaxNode argumentNode, CancellationToken cancellationToken)
239public ISymbol FindFieldOrPropertyForAttributeArgument(SemanticModel semanticModel, SyntaxNode argumentNode, CancellationToken cancellationToken)
242public ImmutableArray<ISymbol> GetBestOrAllSymbols(SemanticModel semanticModel, SyntaxNode node, SyntaxToken token, CancellationToken cancellationToken)
248public ImmutableArray<IMethodSymbol> GetLocalFunctionSymbols(Compilation compilation, ISymbol symbol, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Utilities\NullableHelpers.cs (1)
55ISymbol symbol,
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordHelpers.cs (26)
314var positionalParam = param.ContainingSymbol.ContainingType.GetMembers().FirstOrDefault(member
378var dictionaryBuilder = ImmutableDictionary<ISymbol, ExpressionSyntax>.Empty.ToBuilder();
403ImmutableDictionary<ISymbol, ExpressionSyntax> assignmentValues)
419private static ImmutableDictionary<ISymbol, T> GetAssignmentValuesForConstructor<T>(
424var dictionaryBuilder = ImmutableDictionary<ISymbol, T>.Empty.ToBuilder();
430return ImmutableDictionary<ISymbol, T>.Empty;
445ISymbol? symbol = assignee switch
461return ImmutableDictionary<ISymbol, T>.Empty;
506ISymbol? otherC = null;
532value, successRequirement: true, type, fields, out var _2))
569[NotNullWhen(true)] out ISymbol? assignedVariable)
609private static ISymbol? GetReferencedSymbolObject(IOperation reference)
657ISymbol otherObject)
726ISymbol currentObject,
727ISymbol otherObject,
785ISymbol currentObject,
787[NotNullWhen(true)] out ISymbol? boundVariable,
833bool TryGetBoundVariableForIsPattern(IPatternOperation isPattern, [NotNullWhen(true)] out ISymbol? boundVariable)
854DeclaredSymbol: ISymbol otherVar,
880ISymbol otherC,
918ISymbol currentObject,
919ISymbol otherObject,
922var leftObject = GetReferencedSymbolObject(memberReference1.Instance!);
923var rightObject = GetReferencedSymbolObject(memberReference2.Instance!);
960[NotNullWhen(true)] out ISymbol? otherC,
1124private static IFieldSymbol? UnwrapPropertyToField(ISymbol propertyOrField)
ChangeSignature\CSharpChangeSignatureService.cs (14)
115public override async Task<(ISymbol? symbol, int selectedIndex)> GetInvocationSymbolAsync(
165var typeSymbol = semanticModel.GetSymbolInfo(objectCreation.Type, cancellationToken).Symbol;
291ISymbol declarationSymbol,
516ISymbol declarationSymbol,
553ISymbol declarationSymbol,
694ISymbol declarationSymbol,
715ISymbol declarationSymbol,
731ISymbol declarationSymbol,
771ISymbol declarationSymbol,
790private ImmutableArray<SyntaxNode> VerifyAndPermuteParamNodes(IEnumerable<XmlElementSyntax> paramNodes, ISymbol declarationSymbol, SignatureChange updatedSignature)
850public override async Task<ImmutableArray<ISymbol>> DetermineCascadedSymbolsFromDelegateInvokeAsync(
868var convertedType = (ISymbol?)semanticModel.GetTypeInfo(node, cancellationToken).ConvertedType;
924protected override ImmutableArray<IParameterSymbol> GetParameters(ISymbol declarationSymbol)
Completion\CompletionProviders\CrefCompletionProvider.cs (11)
89protected override async Task<(SyntaxToken, SemanticModel?, ImmutableArray<ISymbol>)> GetSymbolsAsync(
164private static ImmutableArray<ISymbol> GetSymbols(
179private static ImmutableArray<ISymbol> GetUnqualifiedSymbols(
182using var _ = ArrayBuilder<ISymbol>.GetInstance(out var result);
210private static ImmutableArray<ISymbol> GetQualifiedSymbols(
214var leftSymbol = semanticModel.GetSymbolInfo(parent.Container, cancellationToken).Symbol;
218using var _ = ArrayBuilder<ISymbol>.GetInstance(out var result);
237SemanticModel semanticModel, ImmutableArray<ISymbol> symbols, SyntaxToken token, int position, ImmutableArray<KeyValuePair<string, string>> options)
259SemanticModel semanticModel, ISymbol symbol, SyntaxToken token, int position, StringBuilder builder,
277ISymbol symbol,
329ISymbol symbol, int position, StringBuilder builder, string sortText, ImmutableArray<KeyValuePair<string, string>> options)
EditAndContinue\CSharpEditAndContinueAnalyzer.cs (23)
180internal override MemberBody? TryGetDeclarationBody(SyntaxNode node, ISymbol? symbol)
183internal override bool IsDeclarationWithSharedBody(SyntaxNode declaration, ISymbol member)
189protected override IEnumerable<SyntaxNode> GetVariableUseSites(IEnumerable<SyntaxNode> roots, ISymbol localOrParameter, SemanticModel model, CancellationToken cancellationToken)
945internal override bool IsConstructorWithMemberInitializers(ISymbol symbol, CancellationToken cancellationToken)
997protected override SyntaxNode? GetSymbolDeclarationSyntax(ISymbol symbol, Func<ImmutableArray<SyntaxReference>, SyntaxReference?> selector, CancellationToken cancellationToken)
1022protected override ISymbol? GetDeclaredSymbol(SemanticModel model, SyntaxNode declaration, CancellationToken cancellationToken)
1035protected override OneOrMany<(ISymbol? oldSymbol, ISymbol? newSymbol)> GetEditedSymbols(
1055OneOrMany<(ISymbol? oldSymbol, ISymbol? newSymbol)> AddFieldSymbolUpdates(SeparatedSyntaxList<VariableDeclaratorSyntax> oldVariables, SeparatedSyntaxList<VariableDeclaratorSyntax> newVariables)
1070var oldSymbol = (oldNode != null) ? GetSymbolForEdit(oldNode, oldModel!, cancellationToken) : null;
1071var newSymbol = (newNode != null) ? GetSymbolForEdit(newNode, newModel, cancellationToken) : null;
1074? OneOrMany<(ISymbol?, ISymbol?)>.Empty
1079ref TemporaryArray<(ISymbol?, ISymbol?, EditKind)> result,
1082ISymbol? oldSymbol,
1084ISymbol? newSymbol,
1095var oldContainingMemberOrType = GetParameterContainingMemberOrType(oldNode, newNode, oldModel, topMatch.ReverseMatches, cancellationToken);
1096var newContainingMemberOrType = GetParameterContainingMemberOrType(newNode, oldNode, newModel, topMatch.Matches, cancellationToken);
1392private ISymbol? GetSymbolForEdit(
1429private ISymbol? GetParameterContainingMemberOrType(SyntaxNode? node, SyntaxNode? otherNode, SemanticModel? model, IReadOnlyDictionary<SyntaxNode, SyntaxNode> fromOtherMap, CancellationToken cancellationToken)
2516internal override void ReportInsertedMemberSymbolRudeEdits(ArrayBuilder<RudeEditDiagnostic> diagnostics, ISymbol newSymbol, SyntaxNode newNode, bool insertingIntoExistingContainingType)
ImplementInterface\AbstractChangeImplementationCodeRefactoringProvider.cs (10)
27using MemberImplementationMap = OrderedMultiDictionary<ISymbol, ISymbol>;
42protected abstract bool CheckMemberCanBeConverted(ISymbol member);
43protected abstract SyntaxNode ChangeImplementation(SyntaxGenerator generator, SyntaxNode currentDecl, ISymbol implMember, ISymbol interfaceMember);
44protected abstract Task UpdateReferencesAsync(Project project, SolutionEditor solutionEditor, ISymbol implMember, INamedTypeSymbol containingType, CancellationToken cancellationToken);
193foreach (var interfaceMember in interfaceType.GetMembers())
195var impl = containingType.FindImplementationForInterfaceMember(interfaceMember);
229var documentToImplDeclarations = new OrderedMultiDictionary<Document, (SyntaxNode, ISymbol impl, SetWithInsertionOrder<ISymbol> interfaceMembers)>();
SignatureHelp\InvocationExpressionSignatureHelpProviderBase_MethodGroup.cs (1)
38ISymbol within,
src\Analyzers\CSharp\Analyzers\UsePrimaryConstructor\CSharpUsePrimaryConstructorDiagnosticAnalyzer.cs (13)
64private static readonly ObjectPool<ConcurrentSet<ISymbol>> s_concurrentSetPool = new(() => []);
86[NotNullWhen(true)] ISymbol? member,
144PooledDictionary<ISymbol, IParameterSymbol> candidateMembersToRemove,
153private readonly PooledDictionary<ISymbol, IParameterSymbol> _candidateMembersToRemove = candidateMembersToRemove;
160private readonly ConcurrentSet<ISymbol> _membersThatCannotBeRemoved = s_concurrentSetPool.Allocate();
323var candidateMembersToRemove = PooledDictionary<ISymbol, IParameterSymbol>.GetInstance();
387Dictionary<ISymbol, IParameterSymbol> candidateMembersToRemove)
409Dictionary<ISymbol, IParameterSymbol> candidateMembersToRemove)
415using var _1 = PooledHashSet<ISymbol>.GetInstance(out var assignedMembers);
422namedType, semanticModel, assignmentExpression, candidateMembersToRemove, orderedParameterAssignments, out var member))
466Dictionary<ISymbol, IParameterSymbol> candidateMembersToRemove,
468[NotNullWhen(true)] out ISymbol? member)
555var member = operation.Member.OriginalDefinition;
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordHelpers.cs (26)
314var positionalParam = param.ContainingSymbol.ContainingType.GetMembers().FirstOrDefault(member
378var dictionaryBuilder = ImmutableDictionary<ISymbol, ExpressionSyntax>.Empty.ToBuilder();
403ImmutableDictionary<ISymbol, ExpressionSyntax> assignmentValues)
419private static ImmutableDictionary<ISymbol, T> GetAssignmentValuesForConstructor<T>(
424var dictionaryBuilder = ImmutableDictionary<ISymbol, T>.Empty.ToBuilder();
430return ImmutableDictionary<ISymbol, T>.Empty;
445ISymbol? symbol = assignee switch
461return ImmutableDictionary<ISymbol, T>.Empty;
506ISymbol? otherC = null;
532value, successRequirement: true, type, fields, out var _2))
569[NotNullWhen(true)] out ISymbol? assignedVariable)
609private static ISymbol? GetReferencedSymbolObject(IOperation reference)
657ISymbol otherObject)
726ISymbol currentObject,
727ISymbol otherObject,
785ISymbol currentObject,
787[NotNullWhen(true)] out ISymbol? boundVariable,
833bool TryGetBoundVariableForIsPattern(IPatternOperation isPattern, [NotNullWhen(true)] out ISymbol? boundVariable)
854DeclaredSymbol: ISymbol otherVar,
880ISymbol otherC,
918ISymbol currentObject,
919ISymbol otherObject,
922var leftObject = GetReferencedSymbolObject(memberReference1.Instance!);
923var rightObject = GetReferencedSymbolObject(memberReference2.Instance!);
960[NotNullWhen(true)] out ISymbol? otherC,
1124private static IFieldSymbol? UnwrapPropertyToField(ISymbol propertyOrField)
ChangeSignature\AbstractChangeSignatureService.cs (13)
41public abstract Task<(ISymbol? symbol, int selectedIndex)> GetInvocationSymbolAsync(Document document, int position, bool restrictToDeclarations, CancellationToken cancellationToken);
49public abstract Task<ImmutableArray<ISymbol>> DetermineCascadedSymbolsFromDelegateInvokeAsync(
54ISymbol declarationSymbol,
89protected abstract ImmutableArray<IParameterSymbol> GetParameters(ISymbol declarationSymbol);
226ISymbol symbol,
255var definitionToUse = new Dictionary<SyntaxNode, ISymbol>();
445private static void AddUpdatableNodeToDictionaries(Dictionary<DocumentId, List<SyntaxNode>> nodesToUpdate, DocumentId documentId, SyntaxNode nodeToUpdate, Dictionary<SyntaxNode, ISymbol> definitionToUse, ISymbol symbolWithSemanticParameters)
448if (definitionToUse.TryGetValue(nodeToUpdate, out var sym) && sym != symbolWithSemanticParameters)
471ISymbol declarationSymbol,
581private SignatureChange UpdateSignatureChangeToIncludeExtraParametersFromTheDeclarationSymbol(ISymbol declarationSymbol, SignatureChange updatedSignature)
766ISymbol declarationSymbol,
1043protected static bool IsParamsArrayExpandedHelper(ISymbol symbol, int argumentCount, bool lastArgumentIsNamed, SemanticModel semanticModel, SyntaxNode lastArgumentExpression, CancellationToken cancellationToken)
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.GlobalSuppressMessageFixAllCodeAction.cs (12)
28private readonly IEnumerable<KeyValuePair<ISymbol, ImmutableArray<Diagnostic>>> _diagnosticsBySymbol;
33IEnumerable<KeyValuePair<ISymbol, ImmutableArray<Diagnostic>>> diagnosticsBySymbol,
152private static async Task<IEnumerable<KeyValuePair<ISymbol, ImmutableArray<Diagnostic>>>> CreateDiagnosticsBySymbolAsync(AbstractSuppressionCodeFixProvider fixer, IEnumerable<KeyValuePair<Document, ImmutableArray<Diagnostic>>> diagnosticsByDocument, CancellationToken cancellationToken)
154var diagnosticsMapBuilder = ImmutableDictionary.CreateBuilder<ISymbol, List<Diagnostic>>();
163var targetSymbol = suppressionTargetInfo.TargetSymbol;
173private static async Task<IEnumerable<KeyValuePair<ISymbol, ImmutableArray<Diagnostic>>>> CreateDiagnosticsBySymbolAsync(Project project, ImmutableArray<Diagnostic> diagnostics, CancellationToken cancellationToken)
175var diagnosticsMapBuilder = ImmutableDictionary.CreateBuilder<ISymbol, List<Diagnostic>>();
190private static void AddDiagnosticForSymbolIfNeeded(ISymbol targetSymbol, Diagnostic diagnostic, ImmutableDictionary<ISymbol, List<Diagnostic>>.Builder diagnosticsMapBuilder)
206private static IEnumerable<KeyValuePair<ISymbol, ImmutableArray<Diagnostic>>> CreateDiagnosticsBySymbol(ImmutableDictionary<ISymbol, List<Diagnostic>>.Builder diagnosticsMapBuilder)
211var builder = new List<KeyValuePair<ISymbol, ImmutableArray<Diagnostic>>>();
Completion\CommonCompletionUtilities.cs (4)
86SolutionServices workspaceServices, SemanticModel semanticModel, int position, ISymbol symbol, int overloadCount, SymbolDescriptionOptions options, SupportedPlatformData? supportedPlatforms, CancellationToken cancellationToken)
151SolutionServices workspaceServices, SemanticModel semanticModel, int position, ImmutableArray<ISymbol> symbols, SymbolDescriptionOptions options, SupportedPlatformData? supportedPlatforms, CancellationToken cancellationToken)
174List<TaggedText> textContentBuilder, ISymbol symbol, SemanticModel semanticModel, int position, IDocumentationCommentFormattingService formatter, CancellationToken cancellationToken)
208public static bool TryRemoveAttributeSuffix(ISymbol symbol, SyntaxContext context, [NotNullWhen(true)] out string? name)
Completion\Providers\AbstractSymbolCompletionProvider.cs (7)
28protected abstract (string displayText, string suffix, string insertionText) GetDisplayAndSuffixAndInsertionText(ISymbol symbol, TSyntaxContext context);
49ISymbol symbol,
101Dictionary<ISymbol, ArrayBuilder<ProjectId>>? invalidProjectMap,
200Dictionary<ISymbol, ArrayBuilder<ProjectId>>? invalidProjectMap,
242protected static string GetFilterTextDefault(ISymbol symbol, string displayText, TSyntaxContext context)
403private static Dictionary<ISymbol, ArrayBuilder<ProjectId>> FindSymbolsMissingInLinkedContexts(
407var missingSymbols = new Dictionary<ISymbol, ArrayBuilder<ProjectId>>(LinkedFilesSymbolEquivalenceComparer.Instance);
Completion\Providers\SymbolCompletionItem.cs (20)
25private static readonly Action<ImmutableArray<ISymbol>, ArrayBuilder<KeyValuePair<string, string>>> s_addSymbolEncoding = AddSymbolEncoding;
26private static readonly Action<ImmutableArray<ISymbol>, ArrayBuilder<KeyValuePair<string, string>>> s_addSymbolInfo = AddSymbolInfo;
32ImmutableArray<ISymbol> symbols,
35Action<ImmutableArray<ISymbol>, ArrayBuilder<KeyValuePair<string, string>>> symbolEncoder,
63var firstSymbol = symbols[0];
81private static void AddSymbolEncoding(ImmutableArray<ISymbol> symbols, ArrayBuilder<KeyValuePair<string, string>> properties)
84private static void AddSymbolInfo(ImmutableArray<ISymbol> symbols, ArrayBuilder<KeyValuePair<string, string>> properties)
86var symbol = symbols[0];
108public static string EncodeSymbols(ImmutableArray<ISymbol> symbols)
124public static string EncodeSymbol(ISymbol symbol)
132public static async Task<ImmutableArray<ISymbol>> GetSymbolsAsync(CompletionItem item, Document document, CancellationToken cancellationToken)
137using var _ = ArrayBuilder<ISymbol>.GetInstance(out var symbols);
163private static void DecodeSymbols(List<string> ids, Compilation compilation, ArrayBuilder<ISymbol> symbols)
168var symbol = DecodeSymbol(id, compilation);
181private static ISymbol? DecodeSymbol(string id, Compilation compilation)
192CompletionItem item, Document document, ImmutableArray<ISymbol> symbols, SymbolDescriptionOptions options, CancellationToken cancellationToken)
271ImmutableArray<ISymbol> symbols,
303ImmutableArray<ISymbol> symbols,
327ImmutableArray<ISymbol> symbols,
358CompletionItem item, ImmutableArray<ISymbol> symbols, Document document, SemanticModel semanticModel, SymbolDescriptionOptions options, CancellationToken cancellationToken)
DocumentationComments\AbstractDocumentationCommentFormattingService.cs (5)
83internal ISymbol TypeResolutionSymbol { get; set; }
289public ImmutableArray<TaggedText> Format(string rawXmlText, ISymbol symbol, SemanticModel semanticModel, int position, SymbolDisplayFormat format, CancellationToken cancellationToken)
453var symbol = DocumentationCommentId.GetFirstSymbolForDeclarationId(crefAttribute.Value, semanticModel.Compilation);
502var symbol = DocumentationCommentId.GetFirstSymbolForDeclarationId(crefValue, semanticModel.Compilation);
520string crefValue, ISymbol typeResolutionSymbol, int position, SemanticModel semanticModel, SymbolDisplayFormat format)
EditAndContinue\AbstractEditAndContinueAnalyzer.cs (27)
110internal abstract MemberBody? TryGetDeclarationBody(SyntaxNode node, ISymbol? symbol);
115internal abstract bool IsDeclarationWithSharedBody(SyntaxNode declaration, ISymbol member);
186/// Returns all symbols with declaring syntax (<see cref="GetSymbolDeclarationSyntax(ISymbol, CancellationToken)"/> must return a syntax node)
191ref TemporaryArray<(ISymbol?, ISymbol?, EditKind)> result,
194ISymbol? oldSymbol,
196ISymbol? newSymbol,
207protected abstract OneOrMany<(ISymbol? oldSymbol, ISymbol? newSymbol)> GetEditedSymbols(
215private OneOrMany<(ISymbol? oldSymbol, ISymbol? newSymbol, EditKind editKind)> GetSymbolEdits(
226var result = new TemporaryArray<(ISymbol?, ISymbol?, EditKind)>();
2550 => OneOrMany<(ISymbol?, ISymbol?, EditKind)>.Empty,
264protected abstract IEnumerable<SyntaxNode> GetVariableUseSites(IEnumerable<SyntaxNode> roots, ISymbol localOrParameter, SemanticModel model, CancellationToken cancellationToken);
298internal string GetDisplayKindAndName(ISymbol symbol, string? displayKind = null, bool fullyQualify = false)
319internal string GetDisplayKind(ISymbol symbol)
436internal abstract void ReportInsertedMemberSymbolRudeEdits(ArrayBuilder<RudeEditDiagnostic> diagnostics, ISymbol newSymbol, SyntaxNode newNode, bool insertingIntoExistingContainingType);
494/// <see cref="ISymbol.DeclaringSyntaxReferences"/> of a primary constructor returns the type declaration syntax.
503internal abstract bool IsConstructorWithMemberInitializers(ISymbol symbol, CancellationToken cancellationToken);
935ISymbol oldMember,
936ISymbol newMember,
2364protected static bool SymbolsEquivalent(ISymbol oldSymbol, ISymbol newSymbol)
2425protected static bool MemberOrDelegateSignaturesEquivalent(ISymbol? oldMember, ISymbol? newMember, bool exact = false)
ExtractMethod\MethodExtractor.Analyzer.cs (32)
50protected virtual bool IsReadOutside(ISymbol symbol, HashSet<ISymbol> readOutsideMap)
147GetSignatureInformation(Dictionary<ISymbol, VariableInfo> symbolMap, ExtractMethodFlowControlInformation flowControlInformation)
221MultiDictionary<ISymbol, SyntaxToken> symbolMap,
223IList<ISymbol> failedVariables,
283private MultiDictionary<ISymbol, SyntaxToken> GetSymbolMap()
285var symbolMap = new MultiDictionary<ISymbol, SyntaxToken>();
404MultiDictionary<ISymbol, SyntaxToken> symbolMap,
406out Dictionary<ISymbol, VariableInfo> variableInfoMap,
407out List<ISymbol> failedVariables)
427var candidates = new HashSet<ISymbol>(readInsideMap);
437foreach (var symbol in candidates)
523PooledDisposer<PooledHashSet<ISymbol>> GetPooledSymbolSet(ImmutableArray<ISymbol> symbols, out PooledHashSet<ISymbol> symbolSet)
525var disposer = PooledHashSet<ISymbol>.GetInstance(out symbolSet);
530ITypeSymbol? GetSymbolType(ISymbol symbol)
564ISymbol symbol,
581private static void AddVariableToMap(IDictionary<ISymbol, VariableInfo> variableInfoMap, ISymbol localOrParameter, VariableInfo variableInfo)
586MultiDictionary<ISymbol, SyntaxToken> symbolMap,
587ISymbol symbol,
641MultiDictionary<ISymbol, SyntaxToken> symbolMap, ISymbol symbol, bool writtenInside)
694private static bool IsThisParameter(ISymbol localOrParameter)
704private static bool IsInteractiveSynthesizedParameter(ISymbol localOrParameter)
739IDictionary<ISymbol, VariableInfo> variableInfoMap,
742foreach (var symbol in variableInfoMap.Keys)
792private static void AppendMethodTypeParameterUsedDirectly(MultiDictionary<ISymbol, SyntaxToken> symbolMap, IDictionary<int, ITypeParameterSymbol> sortedMap)
805IDictionary<ISymbol, VariableInfo> variableInfoMap,
806MultiDictionary<ISymbol, SyntaxToken> symbolMap,
890private OperationStatus CheckReadOnlyFields(MultiDictionary<ISymbol, SyntaxToken> symbolMap)
FindUsages\AbstractFindUsagesService_FindImplementations.cs (15)
42IFindUsagesContext context, ISymbol symbol, Project project, OptionsProvider<ClassificationOptions> classificationOptions, CancellationToken cancellationToken)
69ISymbol symbol, Project project, IFindUsagesContext context, OptionsProvider<ClassificationOptions> classificationOptions, CancellationToken cancellationToken)
85foreach (var implementation in implementations)
94private static async Task<ImmutableArray<ISymbol>> FindSourceImplementationsAsync(
95Solution solution, ISymbol symbol, CancellationToken cancellationToken)
97var builder = new HashSet<ISymbol>(SymbolEquivalenceComparer.Instance);
129static bool AddedAllLocations(ISymbol implementation, HashSet<(string filePath, TextSpan span)> seenLocations)
141private static async Task<ImmutableArray<ISymbol>> FindImplementationsWorkerAsync(
142Solution solution, ISymbol symbol, CancellationToken cancellationToken)
146using var _ = PooledHashSet<ISymbol>.GetInstance(out var result);
169private static async Task<ImmutableArray<ISymbol>> FindSourceAndMetadataImplementationsAsync(
170Solution solution, ISymbol symbol, CancellationToken cancellationToken)
180using var _ = PooledHashSet<ISymbol>.GetInstance(out var implementationsAndOverrides);
182foreach (var implementation in implementations)
200return ImmutableArray<ISymbol>.CastUp(await SymbolFinder.FindDerivedClassesArrayAsync(
FindUsages\DefinitionItemFactory.cs (9)
29this ISymbol definition,
35this ISymbol definition,
42ISymbol definition,
61this ISymbol definition,
93ISymbol definition,
147internal static ImmutableDictionary<string, string> WithMetadataSymbolProperties(this ImmutableDictionary<string, string> properties, ISymbol symbol, ProjectId originatingProjectId)
163internal static ImmutableArray<AssemblyLocation> GetMetadataLocations(ISymbol definition, Solution solution, out ProjectId? originatingProjectId)
223private static ImmutableArray<DocumentSpan> GetSourceLocations(ISymbol definition, ImmutableArray<Location> locations, Solution solution, bool includeHiddenLocations)
254private static ImmutableDictionary<string, string> GetProperties(ISymbol definition, bool isPrimary)
GenerateEqualsAndGetHashCodeFromMembers\GenerateEqualsAndGetHashCodeFromMembersCodeRefactoringProvider.cs (5)
102.SelectAccessibleMembers<ISymbol>(containingType)
201Document document, SyntaxNode typeDeclaration, INamedTypeSymbol containingType, ImmutableArray<ISymbol> selectedMembers,
241Document document, SyntaxNode typeDeclaration, INamedTypeSymbol containingType, ImmutableArray<ISymbol> members,
258Document document, SyntaxNode typeDeclaration, INamedTypeSymbol containingType, ImmutableArray<ISymbol> members,
295Document document, SyntaxNode typeDeclaration, INamedTypeSymbol containingType, ImmutableArray<ISymbol> members,
GenerateEqualsAndGetHashCodeFromMembers\IGenerateEqualsAndGetHashCodeService.cs (3)
29Task<IMethodSymbol> GenerateEqualsMethodAsync(Document document, INamedTypeSymbol namedType, ImmutableArray<ISymbol> members, string? localNameOpt, CancellationToken cancellationToken);
41Task<IMethodSymbol> GenerateIEquatableEqualsMethodAsync(Document document, INamedTypeSymbol namedType, ImmutableArray<ISymbol> members, INamedTypeSymbol constructedEquatableType, CancellationToken cancellationToken);
50Task<IMethodSymbol> GenerateGetHashCodeMethodAsync(Document document, INamedTypeSymbol namedType, ImmutableArray<ISymbol> members, CancellationToken cancellationToken);
InheritanceMargin\AbstractInheritanceMarginService_Helpers.cs (32)
25using SymbolAndLineNumberArray = ImmutableArray<(ISymbol symbol, int lineNumber)>;
89using var _ = ArrayBuilder<(ISymbol symbol, int lineNumber)>.GetInstance(out var builder);
102var member = semanticModel.GetDeclaredSymbol(memberDeclarationNode, cancellationToken);
321baseSymbols: baseSymbols.CastArray<ISymbol>(),
322derivedTypesSymbols: derivedSymbols.CastArray<ISymbol>(),
333baseSymbols: baseSymbols.CastArray<ISymbol>(),
334derivedTypesSymbols: derivedSymbols.CastArray<ISymbol>(),
343ISymbol memberSymbol,
403ImmutableArray<ISymbol> baseSymbols,
404ImmutableArray<ISymbol> derivedTypesSymbols,
438ISymbol memberSymbol,
440ImmutableArray<ISymbol> implementingMembers,
465ImmutableArray<ISymbol> baseSymbols,
466ImmutableArray<ISymbol> derivedTypesSymbols,
502ISymbol memberSymbol,
504ImmutableArray<ISymbol> implementedMembers,
505ImmutableArray<ISymbol> overridingMembers,
506ImmutableArray<ISymbol> overriddenMembers,
550ISymbol targetSymbol,
554var symbolInSource = SymbolFinder.FindSourceDefinition(targetSymbol, solution, cancellationToken);
584private static ImmutableArray<ISymbol> GetImplementedSymbolsForTypeMember(
585ISymbol memberSymbol,
586ImmutableArray<ISymbol> overriddenSymbols)
590using var _ = ArrayBuilder<ISymbol>.GetInstance(out var builder);
602foreach (var symbol in overriddenSymbols)
616private static async Task<ImmutableArray<ISymbol>> GetImplementingSymbolsForTypeMemberAsync(
618ISymbol memberSymbol,
624using var _ = ArrayBuilder<ISymbol>.GetInstance(out var builder);
651private static ImmutableArray<ISymbol> GetOverriddenSymbols(ISymbol memberSymbol, bool allowLooseMatch)
656using var _ = ArrayBuilder<ISymbol>.GetInstance(out var builder);
706private static DefinitionItem? ToSlimDefinitionItem(ISymbol symbol, Solution solution)
InitializeParameter\AbstractInitializeMemberFromParameterCodeRefactoringProviderMemberCreation.cs (19)
122var siblingFieldOrProperty = TryFindSiblingFieldOrProperty(parameter, blockStatement);
170var fields = parameters.SelectAsArray(p => (ISymbol)CreateField(p, accessibilityModifiersRequired, rules));
171var properties = parameters.SelectAsArray(p => (ISymbol)CreateProperty(p, accessibilityModifiersRequired, rules));
241ISymbol fieldOrProperty,
260private static ISymbol? TryFindSiblingFieldOrProperty(
265TryFindFieldOrPropertyAssignmentStatement(siblingParam, blockStatement, out var sibling);
361ImmutableArray<ISymbol> fieldsOrProperties,
382var fieldOrProperty = fieldsOrProperties[i];
425ISymbol fieldOrProperty,
449var finalFieldOrProperty = SymbolFinder.FindSimilarSymbols(currentFieldOrProperty, compilation, cancellationToken).FirstOrDefault();
469private static async Task<(Document documentWithMemberAdded, IParameterSymbol? currentParameter, ISymbol? currentFieldOrProperty)> AddMissingFieldOrPropertyAsync(
474ISymbol fieldOrProperty,
530var currentFieldOrProperty = currentParameter?.ContainingType
541where TSymbol : ISymbol
546sibling, blockStatement, out var fieldOrProperty);
574IParameterSymbol parameter, IBlockOperation? blockStatement, out ISymbol? fieldOrProperty)
614private async Task<(ISymbol?, bool isThrowNotImplementedProperty)> TryFindMatchingUninitializedFieldOrPropertySymbolAsync(
631foreach (var memberWithName in containingType.GetMembers(memberName))
668static bool ContainsMemberAssignment(IBlockOperation? blockStatement, ISymbol member)
InlineMethod\AbstractInlineMethodRefactoringProvider.InlineContext.cs (13)
251ImmutableDictionary<ISymbol, string> renameTable)
277ImmutableDictionary<ISymbol, string> renameTable,
289ImmutableDictionary<ISymbol, SyntaxNode> replacementTable,
322private ImmutableDictionary<ISymbol, SyntaxNode> ComputeReplacementTable(
327ImmutableDictionary<ISymbol, string> renameTable)
331(parameter, argument) => (parameter: (ISymbol)parameter,
334.Select(parameterAndExpressionPair => (parameter: (ISymbol)parameterAndExpressionPair.Key,
338.Select(parameterAndName => (parameter: (ISymbol)parameterAndName.parameter,
351private static ImmutableDictionary<ISymbol, string> ComputeRenameTable(
360var renameTable = new Dictionary<ISymbol, string>();
363foreach (var symbol in parametersNeedGenerateFreshVariableFor.Concat(localSymbolsInCallee))
382private readonly HashSet<ISymbol> _allSymbols = [];
389public static ImmutableHashSet<ISymbol> GetAllSymbols(
LanguageServices\SymbolDisplayService\AbstractSymbolDisplayService.AbstractSymbolDescriptionBuilder.cs (18)
84private readonly Func<ISymbol?, string?> _getNavigationHint;
110protected abstract Task<ImmutableArray<SymbolDisplayPart>> GetInitializerSourcePartsAsync(ISymbol symbol);
111protected abstract ImmutableArray<SymbolDisplayPart> ToMinimalDisplayParts(ISymbol symbol, SemanticModel semanticModel, int position, SymbolDisplayFormat format);
112protected abstract string? GetNavigationHint(ISymbol? symbol);
150protected virtual ImmutableArray<SymbolDisplayPart> WrapConstraints(ISymbol symbol, ImmutableArray<SymbolDisplayPart> displayParts)
153private async Task AddPartsAsync(ImmutableArray<ISymbol> symbols)
155var firstSymbol = symbols[0];
171private void AddDocumentationContent(ISymbol symbol, DocumentationComment documentationComment)
232protected abstract void AddCaptures(ISymbol symbol);
261foreach (var captured in captures)
282ImmutableArray<ISymbol> symbolGroup, SymbolDescriptionGroups groups)
291public async Task<IDictionary<SymbolDescriptionGroups, ImmutableArray<TaggedText>>> BuildDescriptionSectionsAsync(ImmutableArray<ISymbol> symbolGroup)
300private async Task AddDescriptionPartAsync(ISymbol symbol)
685private void AddDescriptionForArbitrarySymbol(ISymbol symbol)
703ImmutableArray<ISymbol> symbolGroup)
720private static int GetOverloadCount(ImmutableArray<ISymbol> symbolGroup)
804protected ImmutableArray<SymbolDisplayPart> ToMinimalDisplayParts(ISymbol symbol, SymbolDisplayFormat? format = null)
810private static IEnumerable<SymbolDisplayPart> Part(SymbolDisplayPartKind kind, ISymbol? symbol, string text)
LanguageServices\SymbolDisplayService\AbstractSymbolDisplayService.cs (4)
25public Task<string> ToDescriptionStringAsync(SemanticModel semanticModel, int position, ISymbol symbol, SymbolDescriptionOptions options, SymbolDescriptionGroups groups, CancellationToken cancellationToken)
28public async Task<string> ToDescriptionStringAsync(SemanticModel semanticModel, int position, ImmutableArray<ISymbol> symbols, SymbolDescriptionOptions options, SymbolDescriptionGroups groups, CancellationToken cancellationToken)
34public async Task<ImmutableArray<SymbolDisplayPart>> ToDescriptionPartsAsync(SemanticModel semanticModel, int position, ImmutableArray<ISymbol> symbols, SymbolDescriptionOptions options, SymbolDescriptionGroups groups, CancellationToken cancellationToken)
46SemanticModel semanticModel, int position, ImmutableArray<ISymbol> symbols, SymbolDescriptionOptions options, CancellationToken cancellationToken)
LanguageServices\SymbolDisplayService\ISymbolDisplayService.cs (4)
17Task<string> ToDescriptionStringAsync(SemanticModel semanticModel, int position, ISymbol symbol, SymbolDescriptionOptions options, SymbolDescriptionGroups groups = SymbolDescriptionGroups.All, CancellationToken cancellationToken = default);
18Task<string> ToDescriptionStringAsync(SemanticModel semanticModel, int position, ImmutableArray<ISymbol> symbols, SymbolDescriptionOptions options, SymbolDescriptionGroups groups = SymbolDescriptionGroups.All, CancellationToken cancellationToken = default);
19Task<ImmutableArray<SymbolDisplayPart>> ToDescriptionPartsAsync(SemanticModel semanticModel, int position, ImmutableArray<ISymbol> symbols, SymbolDescriptionOptions options, SymbolDescriptionGroups groups = SymbolDescriptionGroups.All, CancellationToken cancellationToken = default);
20Task<IDictionary<SymbolDescriptionGroups, ImmutableArray<TaggedText>>> ToDescriptionGroupsAsync(SemanticModel semanticModel, int position, ImmutableArray<ISymbol> symbols, SymbolDescriptionOptions options, CancellationToken cancellationToken = default);
NavigationBar\AbstractNavigationBarItemService.cs (3)
44Solution solution, ISymbol symbol, SyntaxTree tree, Func<SyntaxReference, TextSpan> computeFullSpan)
50Solution solution, ISymbol symbol, SyntaxTree tree,
91Solution solution, ISymbol symbol, SyntaxTree tree, ISymbolDeclarationService symbolDeclarationService)
SignatureHelp\AbstractSignatureHelpProvider.SymbolKeySignatureHelpItem.cs (1)
14ISymbol symbol,
src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.BlockAnalyzer.cs (7)
32/// We use this value in <see cref="ShouldAnalyze(IOperation, ISymbol, ref bool)"/> to determine whether to bail from analysis or not.
45/// We use this value in <see cref="ShouldAnalyze(IOperation, ISymbol, ref bool)"/> to determine whether to bail from analysis or not.
51/// We use this value in <see cref="ShouldAnalyze(IOperation, ISymbol, ref bool)"/> to determine whether to bail from analysis or not.
253/// delegate escape, and corresponding bail out from flow analysis in <see cref="ShouldAnalyze(IOperation, ISymbol, ref bool)"/>.
301/// delegate escape, and corresponding bail out from flow analysis in <see cref="ShouldAnalyze(IOperation, ISymbol, ref bool)"/>.
366private bool ShouldAnalyze(IOperation operationBlock, ISymbol owningSymbol, ref bool hasUnknownOperationNoneDescendant)
589ISymbol symbol,
src\Analyzers\Core\Analyzers\UseConditionalExpression\ForReturn\UseConditionalExpressionForReturnHelpers.cs (1)
16ISymbol containingSymbol,
src\Analyzers\Core\Analyzers\UseThrowExpression\AbstractUseThrowExpressionDiagnosticAnalyzer.cs (6)
107if (!TryDecomposeIfCondition(ifOperation, out var localOrParameter))
139private static bool ValueIsAccessed(SemanticModel semanticModel, IConditionalOperation ifOperation, IBlockOperation containingBlock, ISymbol localOrParameter, IExpressionStatementOperation expressionStatement, IAssignmentOperation assignmentExpression)
168IBlockOperation containingBlock, IConditionalOperation ifOperation, ISymbol localOrParameter,
190if (!TryGetLocalOrParameterSymbol(assignmentExpression.Value, out var assignmentValue))
210[NotNullWhen(true)] out ISymbol? localOrParameter)
242[NotNullWhen(true)] out ISymbol? localOrParameter)
src\Analyzers\Core\CodeFixes\ImplementAbstractClass\ImplementAbstractClassData.cs (19)
35ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)> unimplementedMembers)
41private readonly ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)> _unimplementedMembers = unimplementedMembers;
89ISymbol? throughMember, bool? canDelegateAllMembers, CancellationToken cancellationToken)
126private ImmutableArray<ISymbol> GenerateMembers(
127Compilation compilation, ISymbol? throughMember,
137private ISymbol? GenerateMember(
138Compilation compilation, ISymbol member, ISymbol? throughMember,
151private ISymbol? GenerateMember(
152Compilation compilation, ISymbol member, ISymbol? throughMember, bool addUnsafe,
175private ISymbol GenerateMethod(
176Compilation compilation, IMethodSymbol method, ISymbol? throughMember,
197ISymbol? throughMember,
238IEventSymbol @event, ISymbol? throughMember, Accessibility accessibility, DeclarationModifiers modifiers)
248IEventSymbol @event, IMethodSymbol? accessor, ISymbol? throughMember,
269public ImmutableArray<(ISymbol symbol, bool canDelegateAllMembers)> GetDelegatableMembers(CancellationToken cancellationToken)
277using var _ = ArrayBuilder<(ISymbol symbol, bool canDelegateAllMembers)>.GetInstance(out var result);
284foreach (var member in members)
src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementInterfaceGenerator.cs (29)
46private ISymbol? ThroughMember => Configuration.ThroughMember;
76ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)> unimplementedMembers,
77ImmutableArray<ISymbol> extraMembers,
106private ImmutableArray<ISymbol> GenerateMembers(
109ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)> unimplementedMembers,
126using var _1 = ArrayBuilder<ISymbol>.GetInstance(out var implementedVisibleMembers);
127using var _2 = ArrayBuilder<ISymbol>.GetInstance(out var implementedMembers);
131foreach (var unimplementedInterfaceMember in unimplementedInterfaceMembers)
160private string DetermineMemberName(ISymbol member, ArrayBuilder<ISymbol> implementedVisibleMembers, out ISymbol? conflictingMember)
167var memberNames = State.ClassOrStructType.GetAccessibleMembersInThisAndBaseTypes<ISymbol>(State.ClassOrStructType).Select(m => m.Name);
179private IEnumerable<ISymbol?> GenerateMembers(
182ISymbol member,
183ArrayBuilder<ISymbol> implementedVisibleMembers,
200var memberName = DetermineMemberName(member, implementedVisibleMembers, out var conflictingMember);
229ParseOptions options, ISymbol member, string memberName, bool supportsImplementingLessAccessibleMember)
257private bool HasUnexpressibleConstraint(ParseOptions options, ISymbol member)
284public ImmutableArray<ISymbol> GenerateMembers(
286ISymbol member,
287ISymbol? conflictingMember,
312private ISymbol GenerateEvent(Compilation compilation, string memberName, bool generateInvisibly, SyntaxGenerator factory, DeclarationModifiers modifiers, bool useExplicitInterfaceSymbol, Accessibility accessibility, IEventSymbol @event)
350ISymbol member,
364private static bool HasNameConflict(ISymbol member, ISymbol baseMember)
387private bool HasMatchingMember(ArrayBuilder<ISymbol> implementedVisibleMembers, ISymbol member)
412private bool MembersMatch(ISymbol existingMember, ISymbol memberToAdd)
ValueTracking\ValueTracker.cs (7)
81var symbol = await GetSymbolAsync(previousTrackedItem, solution, cancellationToken).ConfigureAwait(false);
98var previousSymbol = await GetSymbolAsync(previousTrackedItem.Parent, solution, cancellationToken).ConfigureAwait(false);
164private static async Task TrackVariableReferencesAsync(ISymbol symbol, OperationCollector collector, CancellationToken cancellationToken)
179var containingSymbol = parameterSymbol.ContainingSymbol;
255private static async Task<(ISymbol?, SyntaxNode?)> GetSelectedSymbolAsync(TextSpan textSpan, Document document, CancellationToken cancellationToken)
284private static async Task TrackVariableDefinitionsAsync(ISymbol symbol, OperationCollector collector, CancellationToken cancellationToken)
321private static async Task<ISymbol?> GetSymbolAsync(ValueTrackedItem? item, Solution solution, CancellationToken cancellationToken)
Editing\SymbolEditor.cs (39)
96public async Task<ISymbol> GetCurrentSymbolAsync(ISymbol symbol, CancellationToken cancellationToken = default)
119var currentSymbol = await GetSymbolAsync(ChangedSolution, projectId, symbolId, cancellationToken).ConfigureAwait(false);
145private static async Task<ISymbol> GetSymbolAsync(Solution solution, ProjectId projectId, string symbolId, CancellationToken cancellationToken)
183public async Task<IReadOnlyList<SyntaxNode>> GetCurrentDeclarationsAsync(ISymbol symbol, CancellationToken cancellationToken = default)
185var currentSymbol = await this.GetCurrentSymbolAsync(symbol, cancellationToken).ConfigureAwait(false);
192private IEnumerable<SyntaxNode> GetDeclarations(ISymbol symbol)
203private bool TryGetBestDeclarationForSingleEdit(ISymbol symbol, out SyntaxNode declaration)
232public async Task<ISymbol> EditOneDeclarationAsync(
233ISymbol symbol,
237var currentSymbol = await this.GetCurrentSymbolAsync(symbol, cancellationToken).ConfigureAwait(false);
256public Task<ISymbol> EditOneDeclarationAsync(
257ISymbol symbol,
271private static void CheckSymbolArgument(ISymbol currentSymbol, ISymbol argSymbol)
279private async Task<ISymbol> EditDeclarationAsync(
280ISymbol currentSymbol,
299var newSymbol = model.GetDeclaredSymbol(newDeclaration, cancellationToken);
319public Task<ISymbol> EditOneDeclarationAsync(
320ISymbol symbol,
345public Task<ISymbol> EditOneDeclarationAsync(
346ISymbol symbol,
362private async Task<ISymbol> EditOneDeclarationAsync(
363ISymbol symbol,
369var currentSymbol = await this.GetCurrentSymbolAsync(symbol, cancellationToken).ConfigureAwait(false);
395public async Task<ISymbol> EditOneDeclarationAsync(
396ISymbol symbol,
397ISymbol member,
401var currentSymbol = await this.GetCurrentSymbolAsync(symbol, cancellationToken).ConfigureAwait(false);
404var currentMember = await this.GetCurrentSymbolAsync(member, cancellationToken).ConfigureAwait(false);
428public Task<ISymbol> EditOneDeclarationAsync(
429ISymbol symbol,
430ISymbol member,
453public async Task<ISymbol> EditAllDeclarationsAsync(
454ISymbol symbol,
458var currentSymbol = await this.GetCurrentSymbolAsync(symbol, cancellationToken).ConfigureAwait(false);
490var newSymbol = model.GetDeclaredSymbol(newDeclaration, cancellationToken);
511public Task<ISymbol> EditAllDeclarationsAsync(
512ISymbol symbol,
FindSymbols\FindReferences\Finders\AbstractReferenceFinder.cs (33)
28ISymbol symbol, Project project, CancellationToken cancellationToken);
30public abstract ValueTask<ImmutableArray<ISymbol>> DetermineCascadedSymbolsAsync(
31ISymbol symbol, Solution solution, FindReferencesSearchOptions options, CancellationToken cancellationToken);
34ISymbol symbol, HashSet<string>? globalAliases, Project project, IImmutableSet<Document>? documents, Action<Document, TData> processResult, TData processResultData, FindReferencesSearchOptions options, CancellationToken cancellationToken);
37ISymbol symbol, FindReferencesDocumentState state, Action<FinderLocation, TData> processResult, TData processResultData, FindReferencesSearchOptions options, CancellationToken cancellationToken);
40ISymbol symbol, FindReferencesDocumentState state, SyntaxToken token, CancellationToken cancellationToken)
54ISymbol searchSymbol, FindReferencesDocumentState state, SyntaxNode node, CancellationToken cancellationToken)
61ISymbol searchSymbol, FindReferencesDocumentState state, SymbolInfo symbolInfo)
66foreach (var candidate in symbolInfo.CandidateSymbols)
165ISymbol symbol,
180ISymbol symbol,
244ISymbol symbol,
284ISymbol symbol,
393ISymbol symbol,
429ISymbol symbol,
472ISymbol symbol,
510ISymbol symbol,
541ISymbol symbol,
560var constructor = state.SemanticModel.GetSymbolInfo(node, cancellationToken).Symbol;
575protected static bool Matches(SymbolInfo info, ISymbol notNullOriginalUnreducedSymbol2)
580foreach (var symbol in info.CandidateSymbols)
589protected static bool Matches(ISymbol? symbol1, ISymbol notNullOriginalUnreducedSymbol2)
772var symbol = semanticModel.GetDeclaredSymbol(node);
779internal static ImmutableArray<(string key, string value)> GetAdditionalFindUsagesProperties(ISymbol definition)
789var containingSymbol = definition.ContainingSymbol;
798where TSymbol : ISymbol
819ISymbol symbol, Project project, CancellationToken cancellationToken)
827ISymbol symbol, HashSet<string>? globalAliases, Project project,
838ISymbol symbol, FindReferencesDocumentState state, Action<FinderLocation, TData> processResult, TData processResultData, FindReferencesSearchOptions options, CancellationToken cancellationToken)
844public sealed override ValueTask<ImmutableArray<ISymbol>> DetermineCascadedSymbolsAsync(
845ISymbol symbol, Solution solution, FindReferencesSearchOptions options, CancellationToken cancellationToken)
857protected virtual ValueTask<ImmutableArray<ISymbol>> DetermineCascadedSymbolsAsync(
FindSymbols\FindReferences\FindReferencesSearchEngine.cs (25)
36private static readonly ObjectPool<Dictionary<ISymbol, SymbolGroup>> s_symbolToGroupPool = new(() => new(MetadataUnifyingEquivalenceComparer.Instance));
60public Task FindReferencesAsync(ISymbol symbol, CancellationToken cancellationToken)
64ImmutableArray<ISymbol> symbols, CancellationToken cancellationToken)
83ImmutableArray<ISymbol> symbols, Action<Reference> onReferenceFound, CancellationToken cancellationToken)
126private async IAsyncEnumerable<(Project project, ImmutableArray<(ISymbol symbol, SymbolGroup group)> allSymbols)> GetProjectsAndSymbolsToSearchSeriallyAsync(
129Dictionary<ISymbol, SymbolGroup> symbolToGroup,
164private async Task<ImmutableArray<(ISymbol symbol, SymbolGroup group)>> ReportGroupsSeriallyAsync(
165ImmutableArray<ISymbol> symbols, Dictionary<ISymbol, SymbolGroup> symbolToGroup, CancellationToken cancellationToken)
167var result = new FixedSizeArrayBuilder<(ISymbol symbol, SymbolGroup group)>(symbols.Length);
170foreach (var symbol in symbols)
177ISymbol symbol, Dictionary<ISymbol, SymbolGroup> symbolToGroup, CancellationToken cancellationToken)
193foreach (var groupSymbol in group.Symbols)
207ImmutableArray<ISymbol> symbols, CancellationToken cancellationToken)
217Project project, ImmutableArray<(ISymbol symbol, SymbolGroup group)> allSymbols, Action<Reference> onReferenceFound, CancellationToken cancellationToken)
219using var _1 = PooledDictionary<ISymbol, PooledHashSet<string>>.GetInstance(out var symbolToGlobalAliases);
220using var _2 = PooledDictionary<Document, Dictionary<ISymbol, SymbolGroup>>.GetInstance(out var documentToSymbolsWithin);
275Dictionary<ISymbol, SymbolGroup> symbolsToSearchFor,
276Dictionary<ISymbol, PooledHashSet<string>> symbolToGlobalAliases,
320ISymbol symbolToSearchFor, SymbolGroup symbolGroup, FindReferencesDocumentState state, Action<Reference> onReferenceFound)
344ImmutableArray<(ISymbol symbol, SymbolGroup group)> allSymbols,
345PooledDictionary<ISymbol, PooledHashSet<string>> symbolToGlobalAliases,
363private static void FreeGlobalAliases(PooledDictionary<ISymbol, PooledHashSet<string>> symbolToGlobalAliases)
369private static bool InvolvesInheritance(ISymbol symbol)
FindSymbols\FindReferences\FindReferencesSearchEngine.SymbolSet.cs (25)
44public abstract ImmutableArray<ISymbol> GetAllSymbols();
97foreach (var symbol in symbols)
103private static ISymbol? TryMapToAppropriateSymbol(
104Solution solution, ISymbol symbol, CancellationToken cancellationToken)
109var searchSymbol = symbol;
136var sourceSymbol = SymbolFinder.FindSourceDefinition(searchSymbol, solution, cancellationToken);
151using var _ = ArrayBuilder<ISymbol>.GetInstance(out var workQueue);
154foreach (var symbol in symbols)
158while (workQueue.TryPop(out var currentSymbol))
171using var _ = ArrayBuilder<ISymbol>.GetInstance(out var workQueue);
176while (workQueue.TryPop(out var currentSymbol))
186FindReferencesSearchEngine engine, ImmutableArray<ISymbol> symbols, MetadataUnifyingSymbolHashSet seenSymbols, ArrayBuilder<ISymbol> workQueue, CancellationToken cancellationToken)
188foreach (var symbol in symbols)
193FindReferencesSearchEngine engine, ISymbol symbol, MetadataUnifyingSymbolHashSet seenSymbols, ArrayBuilder<ISymbol> workQueue, CancellationToken cancellationToken)
196var mapped = await TryMapAndAddLinkedSymbolsAsync(symbol).ConfigureAwait(false);
211async Task<ISymbol?> TryMapAndAddLinkedSymbolsAsync(ISymbol symbol)
213var mapped = TryMapToAppropriateSymbol(solution, symbol, cancellationToken);
238FindReferencesSearchEngine engine, ISymbol symbol,
239MetadataUnifyingSymbolHashSet seenSymbols, ArrayBuilder<ISymbol> workQueue,
272ISymbol symbol,
274ArrayBuilder<ISymbol> workQueue,
295if (symbol.GetOverriddenMember() is ISymbol overriddenMember)
FindSymbols\FindReferences\FindReferencesSearchEngine_FindReferencesInDocuments.cs (15)
22ISymbol originalSymbol, IImmutableSet<Document> documents, CancellationToken cancellationToken)
47var hasInheritanceRelationshipCache = new Dictionary<(ISymbol searchSymbol, ISymbol candidateSymbol), bool>();
75async ValueTask PerformSearchInProjectSeriallyAsync(ImmutableArray<(ISymbol symbol, SymbolGroup group)> symbols, Project project)
77using var _ = PooledDictionary<ISymbol, PooledHashSet<string>>.GetInstance(out var symbolToGlobalAliases);
100ImmutableArray<(ISymbol symbol, SymbolGroup group)> symbols,
102PooledDictionary<ISymbol, PooledHashSet<string>> symbolToGlobalAliases)
121ISymbol symbol, SymbolGroup group, FindReferencesDocumentState state)
133async ValueTask DirectSymbolSearchAsync(ISymbol symbol, SymbolGroup group, FindReferencesDocumentState state)
164static async Task<ImmutableArray<(SymbolGroup group, ISymbol symbol, ReferenceLocation location)>> ConvertLocationsAsync(
165FindReferencesSearchEngine @this, IAsyncEnumerable<FinderLocation> locations, ISymbol symbol, SymbolGroup group, CancellationToken cancellationToken)
167using var _ = ArrayBuilder<(SymbolGroup group, ISymbol symbol, ReferenceLocation location)>.GetInstance(out var result);
176async ValueTask InheritanceSymbolSearchSeriallyAsync(ISymbol symbol, FindReferencesDocumentState state)
245foreach (var symbolUp in searchSymbolUpSet.GetAllSymbols())
255foreach (var candidateUp in candidateSymbolUpSet.GetAllSymbols())
FindSymbols\SymbolFinder_Declarations_CustomQueries.cs (7)
28public static Task<IEnumerable<ISymbol>> FindSourceDeclarationsAsync(Solution solution, Func<string, bool> predicate, CancellationToken cancellationToken = default)
34public static async Task<IEnumerable<ISymbol>> FindSourceDeclarationsAsync(Solution solution, Func<string, bool> predicate, SymbolFilter filter, CancellationToken cancellationToken = default)
43internal static async Task<ImmutableArray<ISymbol>> FindSourceDeclarationsWithCustomQueryAsync(
58using var _ = ArrayBuilder<ISymbol>.GetInstance(out var result);
73public static Task<IEnumerable<ISymbol>> FindSourceDeclarationsAsync(Project project, Func<string, bool> predicate, CancellationToken cancellationToken = default)
79public static async Task<IEnumerable<ISymbol>> FindSourceDeclarationsAsync(Project project, Func<string, bool> predicate, SymbolFilter filter, CancellationToken cancellationToken = default)
88internal static async Task<ImmutableArray<ISymbol>> FindSourceDeclarationsWithCustomQueryAsync(
FindSymbols\SymbolFinder_Declarations_SourceDeclarations.cs (8)
20public static Task<IEnumerable<ISymbol>> FindSourceDeclarationsAsync(Solution solution, string name, bool ignoreCase, CancellationToken cancellationToken = default)
26public static async Task<IEnumerable<ISymbol>> FindSourceDeclarationsAsync(
40public static Task<IEnumerable<ISymbol>> FindSourceDeclarationsAsync(Project project, string name, bool ignoreCase, CancellationToken cancellationToken = default)
46public static async Task<IEnumerable<ISymbol>> FindSourceDeclarationsAsync(
67public static Task<IEnumerable<ISymbol>> FindSourceDeclarationsWithPatternAsync(Solution solution, string pattern, CancellationToken cancellationToken = default)
77public static async Task<IEnumerable<ISymbol>> FindSourceDeclarationsWithPatternAsync(
95public static Task<IEnumerable<ISymbol>> FindSourceDeclarationsWithPatternAsync(Project project, string pattern, CancellationToken cancellationToken = default)
105public static async Task<IEnumerable<ISymbol>> FindSourceDeclarationsWithPatternAsync(
FindSymbols\SymbolFinder_Hierarchy.cs (31)
26public static async Task<IEnumerable<ISymbol>> FindOverridesAsync(
27ISymbol symbol, Solution solution, IImmutableSet<Project>? projects = null, CancellationToken cancellationToken = default)
36internal static async Task<ImmutableArray<ISymbol>> FindOverridesArrayAsync(
37ISymbol symbol, Solution solution, IImmutableSet<Project>? projects = null, CancellationToken cancellationToken = default)
44using var _ = ArrayBuilder<ISymbol>.GetInstance(out var results);
64foreach (var m in type.GetMembers(symbol.Name))
66var sourceMember = FindSourceDefinition(m, solution, cancellationToken);
67var bestMember = sourceMember ?? m;
76internal static bool IsOverride(Solution solution, ISymbol member, ISymbol symbol, bool allowLooseMatch)
78for (var current = member;
92public static async Task<IEnumerable<ISymbol>> FindImplementedInterfaceMembersAsync(
93ISymbol symbol, Solution solution, IImmutableSet<Project>? projects = null, CancellationToken cancellationToken = default)
101internal static Task<ImmutableArray<ISymbol>> FindImplementedInterfaceMembersArrayAsync(
102ISymbol symbol, Solution solution, CancellationToken cancellationToken)
113internal static async Task<ImmutableArray<ISymbol>> FindImplementedInterfaceMembersArrayAsync(
114ISymbol symbol,
149using var _ = ArrayBuilder<ISymbol>.GetInstance(out var builder);
169var sourceMethod = FindSourceDefinition(interfaceMember, solution, cancellationToken);
173foreach (var implementation in implementations)
203/// "derived", but can be found with <see cref="FindImplementationsAsync(ISymbol, Solution,
220/// "derived", but can be found with <see cref="FindImplementationsAsync(ISymbol, Solution,
331public static async Task<IEnumerable<ISymbol>> FindImplementationsAsync(
332ISymbol symbol, Solution solution, IImmutableSet<Project>? projects = null, CancellationToken cancellationToken = default)
351/// <inheritdoc cref="FindImplementationsAsync(ISymbol, Solution, IImmutableSet{Project}, CancellationToken)"/>
355internal static async Task<ImmutableArray<ISymbol>> FindMemberImplementationsArrayAsync(
356ISymbol symbol, Solution solution, IImmutableSet<Project>? projects = null, CancellationToken cancellationToken = default)
370using var _ = ArrayBuilder<ISymbol>.GetInstance(out var results);
374foreach (var implementation in implementations)
376var sourceDef = FindSourceDefinition(implementation, solution, cancellationToken);
377var bestDef = sourceDef ?? implementation;
Remote\RemoteArguments.cs (6)
60Solution solution, ISymbol symbol, CancellationToken cancellationToken)
68public static SerializableSymbolAndProjectId Create(ISymbol symbol, Project project, CancellationToken cancellationToken)
72ISymbol symbol, Solution solution, CancellationToken cancellationToken,
86ISymbol symbol, Project project, CancellationToken cancellationToken,
99public async ValueTask<ISymbol?> TryRehydrateAsync(
108var symbol = SymbolKey.ResolveString(
Rename\ConflictEngine\ConflictResolver.cs (18)
53ISymbol symbol,
130private static ImmutableArray<ISymbol> SymbolsForEnclosingInvocationExpressionWorker(SyntaxNode invocationExpression, SemanticModel semanticModel, CancellationToken cancellationToken)
145private static bool LocalVariableConflictPerLanguage(SyntaxToken tokenOrNode, Document document, ImmutableArray<ISymbol> newReferencedSymbols)
168private static bool IsRenameValid(MutableConflictResolution conflictResolution, ISymbol renamedSymbol)
176ISymbol renamedSymbol,
177ISymbol originalSymbol,
229ISymbol renamedSymbol,
230ISymbol renameSymbol,
231IEnumerable<ISymbol> referencedSymbols,
246IEnumerable<ISymbol> otherThingsNamedTheSameExcludeMethodAndParameterizedProperty;
325private static void AddConflictingSymbolLocations(IEnumerable<ISymbol> conflictingSymbols, MutableConflictResolution conflictResolution, IDictionary<Location, Location> reverseMappedLocations)
327foreach (var newSymbol in conflictingSymbols)
346IEnumerable<ISymbol> symbols,
352foreach (var symbol in symbols)
359var overriddenSymbol = symbol.GetOverriddenMember();
384private static string GetString(ISymbol symbol)
401private static Location? GetSymbolLocation(Solution solution, ISymbol symbol, CancellationToken cancellationToken)
405var originalsourcesymbol = SymbolFinder.FindSourceDefinition(symbol, solution, cancellationToken);
Rename\IRenameRewriterLanguageService.cs (18)
36ISymbol symbol,
54ISymbol renamedSymbol,
55ISymbol renameSymbol,
56IEnumerable<ISymbol> referencedSymbols,
71ISymbol renameSymbol,
72ISymbol renamedSymbol,
86ISymbol renamedSymbol,
101IEnumerable<ISymbol> newReferencedSymbols);
124public abstract Task<ImmutableArray<Location>> ComputeDeclarationConflictsAsync(string replacementText, ISymbol renamedSymbol, ISymbol renameSymbol, IEnumerable<ISymbol> referencedSymbols, Solution baseSolution, Solution newSolution, IDictionary<Location, Location> reverseMappedLocations, CancellationToken cancellationToken);
125public abstract Task<ImmutableArray<Location>> ComputeImplicitReferenceConflictsAsync(ISymbol renameSymbol, ISymbol renamedSymbol, IEnumerable<ReferenceLocation> implicitReferenceLocations, CancellationToken cancellationToken);
126public abstract ImmutableArray<Location> ComputePossibleImplicitUsageConflicts(ISymbol renamedSymbol, SemanticModel semanticModel, Location originalDeclarationLocation, int newDeclarationLocationStartingPosition, CancellationToken cancellationToken);
129public abstract bool LocalVariableConflict(SyntaxToken token, IEnumerable<ISymbol> newReferencedSymbols);
130public abstract void TryAddPossibleNameConflicts(ISymbol symbol, string newName, ICollection<string> possibleNameConflicts);
133IEnumerable<ISymbol> properties, string newPropertyName, ArrayBuilder<Location> conflicts)
137foreach (var symbol in properties)
Rename\Renamer.cs (5)
40public static Task<Solution> RenameSymbolAsync(Solution solution, ISymbol symbol, string newName, OptionSet? optionSet, CancellationToken cancellationToken = default)
44Solution solution, ISymbol symbol, SymbolRenameOptions options, string newName, CancellationToken cancellationToken = default)
141internal static Task<LightweightRenameLocations> FindRenameLocationsAsync(Solution solution, ISymbol symbol, SymbolRenameOptions options, CancellationToken cancellationToken)
146ISymbol symbol,
191ISymbol symbol,
Rename\RenameUtilities.cs (22)
26internal static SyntaxToken UpdateAliasAnnotation(SyntaxToken token, ISymbol aliasSymbol, string replacementText)
44internal static ImmutableArray<ISymbol> GetSymbolsTouchingPosition(
73private static bool IsSymbolDefinedInsideMethod(ISymbol symbol)
82internal static IEnumerable<Document> GetDocumentsAffectedByRename(ISymbol symbol, Solution solution, IEnumerable<RenameLocation> renameLocations)
120private static bool ShouldRenameOnlyAffectDeclaringProject(ISymbol symbol)
151var symbol = semanticFacts.GetDeclaredSymbol(semanticModel, token, cancellationToken);
192public static IEnumerable<ISymbol> GetOverloadedSymbols(ISymbol symbol)
199foreach (var member in containingType.GetMembers())
210public static async Task<ISymbol?> TryGetPropertyFromAccessorOrAnOverrideAsync(
211ISymbol symbol, Solution solution, CancellationToken cancellationToken)
218var originalSourceSymbol = SymbolFinder.FindSourceDefinition(
231foreach (var methodImplementor in methodImplementors)
233var propertyAccessorOrAnOverride = await TryGetPropertyFromAccessorOrAnOverrideAsync(methodImplementor, solution, cancellationToken).ConfigureAwait(false);
299public static async Task<ISymbol?> TryGetRenamableSymbolAsync(
302var symbol = await SymbolFinder.FindSymbolAtPositionAsync(document, position, cancellationToken: cancellationToken).ConfigureAwait(false);
306var definitionSymbol = await FindDefinitionSymbolAsync(symbol, document.Project.Solution, cancellationToken).ConfigureAwait(false);
315public static async Task<ISymbol> FindDefinitionSymbolAsync(
316ISymbol symbol, Solution solution, CancellationToken cancellationToken)
322var foundSymbol = SymbolFinder.FindSourceDefinition(
325var bestSymbol = foundSymbol ?? symbol;
381var property = await TryGetPropertyFromAccessorOrAnOverrideAsync(bestSymbol, solution, cancellationToken).ConfigureAwait(false);
Rename\SymbolicRenameLocations.ReferenceProcessing.cs (13)
31ISymbol referencedSymbol, ISymbol originalSymbol, Solution solution, bool considerSymbolReferences, CancellationToken cancellationToken)
123static bool IsConstructorForType(ISymbol possibleConstructor, ISymbol possibleType)
132ISymbol propertySymbol, ISymbol parameterSymbol, CancellationToken cancellationToken)
136ISymbol symbol, Solution solution, CancellationToken cancellationToken)
138var result = await RenameUtilities.TryGetPropertyFromAccessorOrAnOverrideAsync(
161ISymbol referencedSymbol, ISymbol originalSymbol, Solution solution, CancellationToken cancellationToken)
244internal static async Task<IEnumerable<RenameLocation>> GetRenamableReferenceLocationsAsync(ISymbol referencedSymbol, ISymbol originalSymbol, ReferenceLocation location, Solution solution, CancellationToken cancellationToken)
320ISymbol originalSymbol,
Shared\Extensions\ISymbolExtensions.cs (22)
36this ISymbol symbol,
52this ISymbol symbol,
87ISymbol symbol,
107ISymbol symbol, INamedTypeSymbol? hideModuleNameAttribute, ImmutableArray<AttributeData> attributes = default)
221public static DocumentationComment GetDocumentationComment(this ISymbol symbol, Compilation compilation, CultureInfo? preferredCulture = null, bool expandIncludes = false, bool expandInheritdoc = false, CancellationToken cancellationToken = default)
224private static DocumentationComment GetDocumentationComment(ISymbol symbol, HashSet<ISymbol>? visitedSymbols, Compilation compilation, CultureInfo? preferredCulture, bool expandIncludes, bool expandInheritdoc, CancellationToken cancellationToken)
260static bool IsEligibleForAutomaticInheritdoc(ISymbol symbol)
297private static XNode[] RewriteInheritdocElements(ISymbol symbol, HashSet<ISymbol>? visitedSymbols, Compilation compilation, XNode node, CancellationToken cancellationToken)
334private static XNode[] RewriteMany(ISymbol symbol, HashSet<ISymbol>? visitedSymbols, Compilation compilation, XNode[] nodes, CancellationToken cancellationToken)
345private static XNode[]? RewriteInheritdocElement(ISymbol memberSymbol, HashSet<ISymbol>? visitedSymbols, Compilation compilation, XElement element, CancellationToken cancellationToken)
350var candidate = GetCandidateSymbol(memberSymbol);
361ISymbol? symbol;
462static ISymbol? GetCandidateSymbol(ISymbol memberSymbol)
646this ImmutableArray<T> symbols, bool hideAdvancedMembers, Compilation compilation) where T : ISymbol
668private static ImmutableArray<T> RemoveOverriddenSymbolsWithinSet<T>(this ImmutableArray<T> symbols) where T : ISymbol
674var overriddenMember = symbol.GetOverriddenMember();
683this ImmutableArray<T> symbols, bool hideAdvancedMembers, Compilation compilation) where T : ISymbol
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\INamedTypeSymbolExtensions.cs (63)
67public static ISymbol? FindImplementationForAbstractMember(this INamedTypeSymbol? type, ISymbol symbol)
78private static bool ImplementationExists(INamedTypeSymbol classOrStructType, ISymbol member)
83ISymbol member,
84Func<INamedTypeSymbol, ISymbol, bool> isValidImplementation,
152ISymbol member,
153Func<INamedTypeSymbol, ISymbol, bool> isValid,
156var implementation = classOrStructType.FindImplementationForInterfaceMember(member);
176public static ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)> GetAllUnimplementedMembers(
194static ImmutableArray<ISymbol> GetImplicitlyImplementableMembers(INamedTypeSymbol type, ISymbol within)
209static bool IsPropertyWithNonPublicImplementableAccessor(ISymbol member)
226static bool IsImplicitlyImplementable(ISymbol member, ISymbol within)
243private static bool IsImplementable(ISymbol m)
246public static ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)> GetAllUnimplementedMembersInThis(
256var implementation = classOrStructType.FindImplementationForInterfaceMember(m);
264public static ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)> GetAllUnimplementedMembersInThis(
267Func<INamedTypeSymbol, ISymbol, ImmutableArray<ISymbol>> interfaceMemberGetter,
275var implementation = classOrStructType.FindImplementationForInterfaceMember(m);
283public static ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)> GetAllUnimplementedExplicitMembers(
297private static ImmutableArray<ISymbol> GetExplicitlyImplementableMembers(INamedTypeSymbol type, ISymbol within)
309private static bool IsPropertyWithInaccessibleImplementableAccessor(ISymbol member, ISymbol within)
321private static bool IsInaccessibleImplementableAccessor(IMethodSymbol? accessor, ISymbol within)
324private static ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)> GetAllUnimplementedMembers(
327Func<INamedTypeSymbol, ISymbol, Func<INamedTypeSymbol, ISymbol, bool>, CancellationToken, bool> isImplemented,
328Func<INamedTypeSymbol, ISymbol, bool> isValidImplementation,
329Func<INamedTypeSymbol, ISymbol, ImmutableArray<ISymbol>> interfaceMemberGetter,
399private static ImmutableArray<ISymbol> GetUnimplementedMembers(
402Func<INamedTypeSymbol, ISymbol, Func<INamedTypeSymbol, ISymbol, bool>, CancellationToken, bool> isImplemented,
403Func<INamedTypeSymbol, ISymbol, bool> isValidImplementation,
404Func<INamedTypeSymbol, ISymbol, ImmutableArray<ISymbol>> interfaceMemberGetter,
407using var _ = ArrayBuilder<ISymbol>.GetInstance(out var results);
409foreach (var member in interfaceMemberGetter(interfaceType, classOrStructType))
438void AddIfNotImplemented(ISymbol member)
445public static IEnumerable<ISymbol> GetAttributeNamedParameters(
448ISymbol within)
461foreach (var member in type.GetMembers())
463var namedParameter = IsAttributeNamedParameter(member, within ?? compilation.Assembly);
472private static ISymbol? IsAttributeNamedParameter(
473ISymbol symbol,
474ISymbol within)
514private static ImmutableArray<ISymbol> GetMembers(INamedTypeSymbol type, ISymbol within)
527public static ImmutableArray<ISymbol> GetOverridableMembers(
533using var _ = PooledDictionary<ISymbol, int>.GetInstance(out var result);
566Dictionary<ISymbol, int> result, INamedTypeSymbol containingType, CancellationToken cancellationToken)
568foreach (var member in containingType.GetMembers())
579var overriddenMember = member.GetOverriddenMember();
587Dictionary<ISymbol, int> result, INamedTypeSymbol containingType, CancellationToken cancellationToken)
591foreach (var member in containingType.GetMembers())
609Dictionary<ISymbol, int> result, INamedTypeSymbol containingType,
612foreach (var member in type.GetMembers())
623private static bool IsOverridable(ISymbol member, INamedTypeSymbol containingType)
643private static bool IsEqualsObjectOverride(ISymbol? member)
654private static bool IsEqualsObject(ISymbol member)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions.cs (95)
20public static string ToNameDisplayString(this ISymbol symbol)
23public static string ToSignatureDisplayString(this ISymbol symbol)
26public static bool HasPublicResultantVisibility(this ISymbol symbol)
29public static SymbolVisibility GetResultantVisibility(this ISymbol symbol)
76public static ISymbol? GetOverriddenMember(this ISymbol? symbol, bool allowLooseMatch = false)
81ISymbol? exactMatch = symbol switch
97if (TryFindLooseMatch(symbol, baseType, out var looseMatch))
104bool TryFindLooseMatch(ISymbol symbol, INamedTypeSymbol baseType, [NotNullWhen(true)] out ISymbol? looseMatch)
109foreach (var member in baseType.GetMembers(symbol.Name))
137public static ImmutableArray<ISymbol> ExplicitInterfaceImplementations(this ISymbol symbol)
140IEventSymbol @event => ImmutableArray<ISymbol>.CastUp(@event.ExplicitInterfaceImplementations),
141IMethodSymbol method => ImmutableArray<ISymbol>.CastUp(method.ExplicitInterfaceImplementations),
142IPropertySymbol property => ImmutableArray<ISymbol>.CastUp(property.ExplicitInterfaceImplementations),
146public static ImmutableArray<ISymbol> ExplicitOrImplicitInterfaceImplementations(this ISymbol symbol)
151using var _ = ArrayBuilder<ISymbol>.GetInstance(out var result);
155foreach (var interfaceMember in iface.GetMembers())
157var impl = symbol.ContainingType.FindImplementationForInterfaceMember(interfaceMember);
171public static ImmutableArray<ISymbol> ImplicitInterfaceImplementations(this ISymbol symbol)
174public static bool IsOverridable([NotNullWhen(true)] this ISymbol? symbol)
181public static bool IsImplementableMember([NotNullWhen(true)] this ISymbol? symbol)
214public static INamedTypeSymbol? GetContainingTypeOrThis(this ISymbol symbol)
224public static bool IsErrorType([NotNullWhen(true)] this ISymbol? symbol)
227public static bool IsModuleType([NotNullWhen(true)] this ISymbol? symbol)
230public static bool IsInterfaceType([NotNullWhen(true)] this ISymbol? symbol)
233public static bool IsArrayType([NotNullWhen(true)] this ISymbol? symbol)
236public static bool IsTupleType([NotNullWhen(true)] this ISymbol? symbol)
239public static bool IsAnonymousFunction([NotNullWhen(true)] this ISymbol? symbol)
242public static bool IsKind([NotNullWhen(true)] this ISymbol? symbol, SymbolKind kind)
245public static bool MatchesKind([NotNullWhen(true)] this ISymbol? symbol, SymbolKind kind)
248public static bool MatchesKind([NotNullWhen(true)] this ISymbol? symbol, SymbolKind kind1, SymbolKind kind2)
254public static bool MatchesKind([NotNullWhen(true)] this ISymbol? symbol, SymbolKind kind1, SymbolKind kind2, SymbolKind kind3)
260public static bool MatchesKind([NotNullWhen(true)] this ISymbol? symbol, params SymbolKind[] kinds)
266public static bool IsReducedExtension([NotNullWhen(true)] this ISymbol? symbol)
269public static bool IsEnumMember([NotNullWhen(true)] this ISymbol? symbol)
272public static bool IsExtensionMethod(this ISymbol symbol)
275public static bool IsLocalFunction([NotNullWhen(true)] this ISymbol? symbol)
278public static bool IsAnonymousOrLocalFunction([NotNullWhen(true)] this ISymbol? symbol)
281public static bool IsModuleMember([NotNullWhen(true)] this ISymbol? symbol)
284public static bool IsConstructor([NotNullWhen(true)] this ISymbol? symbol)
287public static bool IsStaticConstructor([NotNullWhen(true)] this ISymbol? symbol)
290public static bool IsDestructor([NotNullWhen(true)] this ISymbol? symbol)
293public static bool IsUserDefinedOperator([NotNullWhen(true)] this ISymbol? symbol)
296public static bool IsConversion([NotNullWhen(true)] this ISymbol? symbol)
299public static bool IsOrdinaryMethod([NotNullWhen(true)] this ISymbol? symbol)
302public static bool IsOrdinaryMethodOrLocalFunction([NotNullWhen(true)] this ISymbol? symbol)
305public static bool IsDelegateType([NotNullWhen(true)] this ISymbol? symbol)
308public static bool IsAnonymousType([NotNullWhen(true)] this ISymbol? symbol)
311public static bool IsNormalAnonymousType([NotNullWhen(true)] this ISymbol? symbol)
314public static bool IsAnonymousDelegateType([NotNullWhen(true)] this ISymbol? symbol)
317public static bool IsAnonymousTypeProperty([NotNullWhen(true)] this ISymbol? symbol)
320public static bool IsTupleField([NotNullWhen(true)] this ISymbol? symbol)
323public static bool IsIndexer([NotNullWhen(true)] this ISymbol? symbol)
326public static bool IsWriteableFieldOrProperty([NotNullWhen(true)] this ISymbol? symbol)
334public static bool IsRequired([NotNullWhen(true)] this ISymbol? symbol)
337public static ITypeSymbol? GetMemberType(this ISymbol? symbol)
349public static int GetArity(this ISymbol symbol)
358public static ISymbol? GetOriginalUnreducedDefinition(this ISymbol? symbol)
401public static bool IsFunctionValue([NotNullWhen(true)] this ISymbol? symbol)
404public static bool IsThisParameter([NotNullWhen(true)] this ISymbol? symbol)
408public static ISymbol? ConvertThisParameterToType(this ISymbol? symbol)
418public static bool IsParams([NotNullWhen(true)] this ISymbol? symbol)
421public static ImmutableArray<IParameterSymbol> GetParameters(this ISymbol? symbol)
429public static ImmutableArray<ITypeParameterSymbol> GetTypeParameters(this ISymbol? symbol)
437public static ImmutableArray<ITypeParameterSymbol> GetAllTypeParameters(this ISymbol? symbol)
450public static ImmutableArray<ITypeSymbol> GetTypeArguments(this ISymbol? symbol)
458public static ImmutableArray<ITypeSymbol> GetAllTypeArguments(this ISymbol symbol)
473public static bool IsAttribute([NotNullWhen(true)] this ISymbol? symbol)
482public static bool RequiresUnsafeModifier([NotNullWhen(true)] this ISymbol? member)
489this ISymbol? symbol,
532public static bool IsStaticType([NotNullWhen(true)] this ISymbol? symbol)
535public static bool IsNamespace([NotNullWhen(true)] this ISymbol? symbol)
539[NotNullWhen(true)] this ISymbol? symbol, ISymbol withinType, IAssemblySymbol withinAssembly, CancellationToken cancellationToken)
559public static IEnumerable<IPropertySymbol> GetValidAnonymousTypeProperties(this ISymbol symbol)
565public static Accessibility ComputeResultantAccessibility(this ISymbol? symbol, ITypeSymbol finalDestination)
591public static bool IsInaccessibleLocal(this ISymbol symbol, int position)
609public static bool IsAccessor([NotNullWhen(true)] this ISymbol? symbol)
612public static bool IsPropertyAccessor([NotNullWhen(true)] this ISymbol? symbol)
615public static bool IsEventAccessor([NotNullWhen(true)] this ISymbol? symbol)
618public static bool IsFromSource(this ISymbol symbol)
621public static bool IsNonImplicitAndFromSource(this ISymbol symbol)
624public static ITypeSymbol? GetSymbolType(this ISymbol? symbol)
640public static bool IsAwaitableNonDynamic([NotNullWhen(true)] this ISymbol? symbol, SemanticModel semanticModel, int position)
779public static bool IsKind<TSymbol>(this ISymbol symbol, SymbolKind kind, [NotNullWhen(true)] out TSymbol? result) where TSymbol : class, ISymbol
796public static bool IsSymbolWithSpecialDiscardName(this ISymbol symbol)
805public static bool IsObsolete(this ISymbol symbol)
812public static bool HasAttribute([NotNullWhen(true)] this ISymbol? symbol, [NotNullWhen(true)] INamedTypeSymbol? attributeClass)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions_Accessibility.cs (11)
17this ISymbol symbol,
18ISymbol within,
39this ISymbol symbol,
51this ISymbol symbol,
64ISymbol symbol,
83ISymbol symbol,
84ISymbol within, // must be assembly or named type symbol
174private static bool IsNamedTypeAccessible(INamedTypeSymbol type, ISymbol within)
212ISymbol within)
247ISymbol within,
407ISymbol within,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.cs (13)
403public static bool CanSupportCollectionInitializer(this ITypeSymbol typeSymbol, ISymbol within)
434public static IEnumerable<T> GetAccessibleMembersInBaseTypes<T>(this ITypeSymbol containingType, ISymbol within) where T : class, ISymbol
443public static ImmutableArray<T> GetAccessibleMembersInThisAndBaseTypes<T>(this ITypeSymbol? containingType, ISymbol within) where T : class, ISymbol
453public static ImmutableArray<T> GetAccessibleMembersInThisAndBaseTypes<T>(this ITypeSymbol? containingType, string memberName, ISymbol within) where T : class, ISymbol
498public static IEnumerable<T> SelectAccessibleMembers<T>(this IEnumerable<ITypeSymbol>? types, ISymbol within) where T : class, ISymbol
508private static IEnumerable<T> SelectAccessibleMembers<T>(this IEnumerable<ITypeSymbol>? types, string memberName, ISymbol within) where T : class, ISymbol
693foreach (var member in type.GetMembers())
754public static bool IsReadOnlySpan([NotNullWhen(true)] this ISymbol? symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SemanticModelExtensions.cs (11)
47public static ISymbol GetRequiredDeclaredSymbol(this SemanticModel semanticModel, SyntaxNode declaration, CancellationToken cancellationToken)
59public static ISymbol GetRequiredEnclosingSymbol(this SemanticModel semanticModel, int position, CancellationToken cancellationToken)
66where TSymbol : class, ISymbol
68for (var symbol = semanticModel.GetEnclosingSymbol(position, cancellationToken);
81public static ISymbol GetEnclosingNamedTypeOrAssembly(this SemanticModel semanticModel, int position, CancellationToken cancellationToken)
84(ISymbol)semanticModel.Compilation.Assembly;
93public static IEnumerable<ISymbol> GetExistingSymbols(
115public static HashSet<ISymbol> GetAllDeclaredSymbols(
118var symbols = new HashSet<ISymbol>();
129HashSet<ISymbol> symbols, CancellationToken cancellationToken, Func<SyntaxNode, bool>? descendInto = null)
131var symbol = semanticModel.GetDeclaredSymbol(node, cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.AnalysisData.cs (14)
35private readonly PooledHashSet<ISymbol> _referenceTakenSymbolsBuilder;
40_referenceTakenSymbolsBuilder = PooledHashSet<ISymbol>.GetInstance();
61protected abstract PooledDictionary<(ISymbol symbol, IOperation operation), bool> SymbolsWriteBuilder { get; }
66protected abstract PooledHashSet<ISymbol> SymbolsReadBuilder { get; }
132public abstract void OnLValueCaptureFound(ISymbol symbol, IOperation operation, CaptureId captureId);
137public abstract void SetTargetsFromSymbolForDelegate(IOperation write, ISymbol symbol);
143protected static PooledDictionary<(ISymbol Symbol, IOperation Write), bool> CreateSymbolsWriteMap(
146var symbolsWriteMap = PooledDictionary<(ISymbol Symbol, IOperation Write), bool>.GetInstance();
150protected static PooledDictionary<(ISymbol Symbol, IOperation Write), bool> UpdateSymbolsWriteMap(
151PooledDictionary<(ISymbol Symbol, IOperation Write), bool> symbolsWriteMap,
158(ISymbol, IOperation) key = (parameter, null);
178public void OnReadReferenceFound(ISymbol symbol)
201public void OnWriteReferenceFound(ISymbol symbol, IOperation operation, bool maybeWritten, bool isRef)
237foreach (var symbol in SymbolsWriteBuilder.Keys.Select(d => d.symbol).ToArray())
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.BasicBlockAnalysisData.cs (7)
30private readonly Dictionary<ISymbol, PooledHashSet<IOperation>> _reachingWrites;
64public void Clear(ISymbol symbol)
76public void ForEachCurrentWrite<TArg>(ISymbol symbol, Action<IOperation, TArg> action, TArg arg)
88public bool ForEachCurrentWrite<TArg>(ISymbol symbol, Func<IOperation, TArg, bool> action, TArg arg)
106public void OnWriteReferenceFound(ISymbol symbol, IOperation operation, bool maybeWritten)
132foreach (var key in _reachingWrites.Keys)
225private static void AddEntries(Dictionary<ISymbol, PooledHashSet<IOperation>> result, BasicBlockAnalysisData source)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.DataFlowAnalyzer.FlowGraphAnalysisData.cs (17)
41private readonly PooledDictionary<CaptureId, PooledHashSet<(ISymbol, IOperation)>> _lValueFlowCapturesMap;
69private readonly PooledDictionary<(int firstBlockOrdinal, int lastBlockOrdinal), PooledHashSet<(ISymbol, IOperation)>> _symbolWritesInsideBlockRangeMap;
73ISymbol owningSymbol,
77PooledDictionary<(ISymbol symbol, IOperation operation), bool> symbolsWriteMap,
78PooledHashSet<ISymbol> symbolsRead,
99_lValueFlowCapturesMap = PooledDictionary<CaptureId, PooledHashSet<(ISymbol, IOperation)>>.GetInstance();
103_symbolWritesInsideBlockRangeMap = PooledDictionary<(int firstBlockOrdinal, int lastBlockOrdinal), PooledHashSet<(ISymbol, IOperation)>>.GetInstance();
106public ISymbol OwningSymbol { get; }
108protected override PooledHashSet<ISymbol> SymbolsReadBuilder { get; }
110protected override PooledDictionary<(ISymbol symbol, IOperation operation), bool> SymbolsWriteBuilder { get; }
118ISymbol owningSymbol,
131symbolsRead: PooledHashSet<ISymbol>.GetInstance(),
215private PooledHashSet<(ISymbol, IOperation)> GetOrCreateSymbolWritesInBlockRange(int firstBlockOrdinal, int lastBlockOrdinal, CancellationToken cancellationToken)
224writesInBlockRange = PooledHashSet<(ISymbol, IOperation)>.GetInstance();
462public override void OnLValueCaptureFound(ISymbol symbol, IOperation operation, CaptureId captureId)
466captures = PooledHashSet<(ISymbol, IOperation)>.GetInstance();
514public override void SetTargetsFromSymbolForDelegate(IOperation write, ISymbol symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.OperationTreeAnalysisData.cs (8)
24PooledDictionary<(ISymbol symbol, IOperation operation), bool> symbolsWriteMap,
25PooledHashSet<ISymbol> symbolsRead,
35protected override PooledHashSet<ISymbol> SymbolsReadBuilder { get; }
37protected override PooledDictionary<(ISymbol symbol, IOperation operation), bool> SymbolsWriteBuilder { get; }
42ISymbol owningSymbol,
47symbolsRead: PooledHashSet<ISymbol>.GetInstance(),
66public override void OnLValueCaptureFound(ISymbol symbol, IOperation operation, CaptureId captureId)
78public override void SetTargetsFromSymbolForDelegate(IOperation write, ISymbol symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.Walker.cs (13)
27private ISymbol _currentContainingSymbol;
30private PooledDictionary<IAssignmentOperation, PooledHashSet<(ISymbol, IOperation)>> _pendingWritesMap;
36ISymbol containingSymbol,
52private void Visit(ISymbol containingSymbol, IEnumerable<IOperation> operations, AnalysisData analysisData, CancellationToken cancellationToken)
59_pendingWritesMap = PooledDictionary<IAssignmentOperation, PooledHashSet<(ISymbol, IOperation)>>.GetInstance();
91private void OnReadReferenceFound(ISymbol symbol)
94private void OnWriteReferenceFound(ISymbol symbol, IOperation operation, ValueUsageInfo valueUsageInfo)
102private void OnLValueCaptureFound(ISymbol symbol, IOperation operation, CaptureId captureId)
108private void OnReferenceFound(ISymbol symbol, IOperation operation)
160private bool MakePendingWrite(IOperation operation, ISymbol symbolOpt)
167var set = PooledHashSet<(ISymbol, IOperation)>.GetInstance();
176set = PooledHashSet<(ISymbol, IOperation)>.GetInstance();
408private void ProcessPossibleDelegateCreationAssignment(ISymbol symbol, IOperation write)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SemanticFacts\ISemanticFacts.cs (7)
67ISymbol? GetDeclaredSymbol(SemanticModel semanticModel, SyntaxToken token, CancellationToken cancellationToken);
92IEnumerable<ISymbol> GetDeclaredSymbols(SemanticModel semanticModel, SyntaxNode memberDeclaration, CancellationToken cancellationToken);
97ISymbol? FindFieldOrPropertyForArgument(SemanticModel semanticModel, SyntaxNode argument, CancellationToken cancellationToken);
98ISymbol? FindFieldOrPropertyForAttributeArgument(SemanticModel semanticModel, SyntaxNode argument, CancellationToken cancellationToken);
100ImmutableArray<ISymbol> GetBestOrAllSymbols(SemanticModel semanticModel, SyntaxNode? node, SyntaxToken token, CancellationToken cancellationToken);
107ImmutableArray<IMethodSymbol> GetLocalFunctionSymbols(Compilation compilation, ISymbol symbol, CancellationToken cancellationToken);
130Task<ISymbol?> GetInterceptorSymbolAsync(Document document, int position, CancellationToken cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.cs (31)
30/// the "same" <see cref="ISymbol.ContainingType"/> and
31/// equal <see cref="ISymbol.MetadataName"/>.</item>
33/// the "same" <see cref="ISymbol.ContainingType"/>,
34/// equal <see cref="ISymbol.MetadataName"/>,
40/// the "same" <see cref="ISymbol.ContainingAssembly"/>.
41/// <see cref="ISymbol.MetadataName"/> is not used because module identity is not important in practice.</item>
43/// the "same" <see cref="ISymbol.ContainingSymbol"/>,
44/// equal <see cref="ISymbol.MetadataName"/>,
48/// the "same" <see cref="ISymbol.ContainingSymbol"/> and
49/// equal <see cref="ISymbol.MetadataName"/>.
54/// the "same" <see cref="ISymbol.ContainingSymbol"/> and
55/// equal <see cref="ISymbol.MetadataName"/>.</item>
59/// the "same" the "same" <see cref="ISymbol.ContainingType"/>,
60/// the "same" <see cref="ISymbol.MetadataName"/>, and have
64/// the "same" <see cref="ISymbol.ContainingSymbol"/> and
65/// the "same" <see cref="ISymbol.MetadataName"/>.</item>
67/// the "same" <see cref="ISymbol.ContainingSymbol"/> and
68/// the "same" <see cref="ISymbol.MetadataName"/>.</item>
70/// the "same" <see cref="ISymbol.Name"/>.</item>
77/// cref="SyntaxTree"/> is enumerated to list all the symbols with the same <see cref="ISymbol.Name"/> and <see
78/// cref="ISymbol.Kind"/> as the original symbol. The symbol with the same index in the destination tree as the
128public static SymbolKey Create(ISymbol? symbol, CancellationToken cancellationToken = default)
147public static bool CanCreate(ISymbol symbol, CancellationToken cancellationToken)
200public static string CreateString(ISymbol? symbol, CancellationToken cancellationToken = default)
204internal static string CreateStringWorker(int version, ISymbol? symbol, CancellationToken cancellationToken = default)
231/// to the corresponding <see cref="ISymbol"/> in a future <see cref="Compilation"/>.
243where TSymbol : class, ISymbol
259ImmutableArray<ISymbol>.CastUp(symbols.Builder.ToImmutableAndClear()),
296string? metadataName) where TSymbol : ISymbol
305foreach (var member in members)
315public static bool IsBodyLevelSymbol(ISymbol symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (13)
332private readonly Stack<ISymbol?> _contextualSymbolStack = new();
385where TOwningSymbol : ISymbol
425public ContextualSymbolPopper PushContextualSymbol(ISymbol? contextualSymbol)
431private void PopContextualSymbol(ISymbol? contextualSymbol)
438public ISymbol? CurrentContextualSymbol
447public readonly ref struct ContextualSymbolPopper(SymbolKeyReader reader, ISymbol? contextualSymbol)
468public SymbolKeyResolution ReadSymbolKey(ISymbol? contextualSymbol, out string? failureReason)
539Func<TContextualSymbol, int, ISymbol?>? getContextualSymbol,
558var nextContextualSymbol = contextualSymbol is null ? null : getContextualSymbol?.Invoke(contextualSymbol, i);
591Func<TContextualSymbol, int, ISymbol?>? getContextualSymbol,
593where TContextualSymbol : ISymbol
594where TSymbol : ISymbol
729var symbol = semanticModel.GetDeclaredSymbol(node, CancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService.cs (12)
66public TDeclarationNode AddMembers<TDeclarationNode>(TDeclarationNode destination, IEnumerable<ISymbol> members, CodeGenerationContextInfo info, CancellationToken cancellationToken)
116public TDeclarationNode UpdateDeclarationMembers<TDeclarationNode>(TDeclarationNode declaration, IList<ISymbol> newMembers, CodeGenerationContextInfo info, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode
141public abstract TDeclarationNode UpdateDeclarationMembers<TDeclarationNode>(TDeclarationNode declaration, IList<ISymbol> newMembers, TCodeGenerationContextInfo info, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode;
272IEnumerable<ISymbol> members,
295IEnumerable<ISymbol> members,
302foreach (var member in members)
326IEnumerable<ISymbol> members,
334foreach (var member in members)
343private SyntaxNode? GetNewMember(TCodeGenerationContextInfo info, CodeGenerationDestination codeGenerationDestination, ISymbol member, CancellationToken cancellationToken)
359ISymbol member,
374private static bool GeneratingEnum(IEnumerable<ISymbol> members)
456public Task<Document> AddMembersAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IEnumerable<ISymbol> members, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\ICodeGenerationService.cs (4)
84TDeclarationNode AddMembers<TDeclarationNode>(TDeclarationNode destination, IEnumerable<ISymbol> members, CodeGenerationContextInfo info, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode;
124TDeclarationNode UpdateDeclarationMembers<TDeclarationNode>(TDeclarationNode declaration, IList<ISymbol> newMembers, CodeGenerationContextInfo info, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode;
174Task<Document> AddMembersAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IEnumerable<ISymbol> members, CancellationToken cancellationToken);
179bool CanAddTo(ISymbol destination, Solution solution, CancellationToken cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\SyntaxAnnotationExtensions.cs (1)
16where TSymbol : ISymbol
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions.cs (14)
87private static ITypeSymbol GetType(Compilation compilation, ISymbol symbol)
102this SyntaxGenerator generator, IMethodSymbol method, ISymbol throughMember)
117this SyntaxGenerator generator, ISymbol member, ISymbol throughMember)
181static SyntaxNode GenerateContainerName(SyntaxGenerator factory, ISymbol throughMember)
195ISymbol? throughMember,
234ISymbol? throughMember,
278private static bool TryGetValue(IDictionary<string, ISymbol>? dictionary, string key, [NotNullWhen(true)] out string? value)
281if (dictionary != null && dictionary.TryGetValue(key, out var symbol))
290public static ImmutableArray<ISymbol> CreateFieldsForParameters(
293using var _ = ArrayBuilder<ISymbol>.GetInstance(out var result);
312public static ImmutableArray<ISymbol> CreatePropertiesForParameters(
315using var _ = ArrayBuilder<ISymbol>.GetInstance(out var result);
347IDictionary<string, ISymbol>? parameterToExistingFieldMap,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\SemanticsFactsService\AbstractSemanticFactsService.cs (11)
31private static readonly Func<ISymbol, bool> s_LocalNameFilter = s =>
74string baseName, Func<ISymbol, bool> filter,
91protected virtual IEnumerable<ISymbol> GetCollidableSymbols(SemanticModel semanticModel, SyntaxNode location, SyntaxNode container, CancellationToken cancellationToken)
114var impl = type.FindImplementationForInterfaceMember(disposeMethodToLookFor);
197public ISymbol GetDeclaredSymbol(SemanticModel semanticModel, SyntaxToken token, CancellationToken cancellationToken)
227public IEnumerable<ISymbol> GetDeclaredSymbols(SemanticModel semanticModel, SyntaxNode memberDeclaration, CancellationToken cancellationToken)
236public ISymbol FindFieldOrPropertyForArgument(SemanticModel semanticModel, SyntaxNode argumentNode, CancellationToken cancellationToken)
239public ISymbol FindFieldOrPropertyForAttributeArgument(SemanticModel semanticModel, SyntaxNode argumentNode, CancellationToken cancellationToken)
242public ImmutableArray<ISymbol> GetBestOrAllSymbols(SemanticModel semanticModel, SyntaxNode node, SyntaxToken token, CancellationToken cancellationToken)
248public ImmutableArray<IMethodSymbol> GetLocalFunctionSymbols(Compilation compilation, ISymbol symbol, CancellationToken cancellationToken)
262public Task<ISymbol> GetInterceptorSymbolAsync(Document document, int position, CancellationToken cancellationToken)