src\RoslynAnalyzers\Utilities\Compiler\Extensions\ISymbolExtensions.cs (59)
20public static bool IsType([NotNullWhen(returnValue: true)] this ISymbol? symbol)
25public static bool IsAccessorMethod([NotNullWhen(returnValue: true)] this ISymbol? symbol)
31public static IEnumerable<IMethodSymbol> GetAccessors(this ISymbol symbol)
70public static bool IsDefaultConstructor([NotNullWhen(returnValue: true)] this ISymbol? symbol)
75public static bool IsPublic(this ISymbol symbol)
80public static bool IsProtected(this ISymbol symbol)
85public static bool IsPrivate(this ISymbol symbol)
90public static bool IsErrorType([NotNullWhen(returnValue: true)] this ISymbol? symbol)
97public static bool IsConstructor([NotNullWhen(returnValue: true)] this ISymbol? symbol)
102public static bool IsDestructor([NotNullWhen(returnValue: true)] this ISymbol? symbol)
107public static bool IsIndexer([NotNullWhen(returnValue: true)] this ISymbol? symbol)
112public static bool IsPropertyWithBackingField([NotNullWhen(returnValue: true)] this ISymbol? symbol, [NotNullWhen(true)] out IFieldSymbol? backingField)
116foreach (ISymbol member in propertySymbol.ContainingType.GetMembers())
139[NotNullWhen(returnValue: true)] this ISymbol? symbol,
156public static bool IsUserDefinedOperator([NotNullWhen(returnValue: true)] this ISymbol? symbol)
161public static bool IsConversionOperator([NotNullWhen(returnValue: true)] this ISymbol? symbol)
166public static ImmutableArray<IParameterSymbol> GetParameters(this ISymbol? symbol)
179public static bool IsExternallyVisible(this ISymbol symbol) =>
182public static SymbolVisibility GetResultantVisibility(this ISymbol symbol)
229public static bool MatchMemberDerivedByName([NotNullWhen(returnValue: true)] this ISymbol? member, INamedTypeSymbol type, string name)
239public static bool MatchMethodByName([NotNullWhen(returnValue: true)] this ISymbol? member, INamedTypeSymbol type, string name)
244public static bool MatchPropertyDerivedByName([NotNullWhen(returnValue: true)] this ISymbol? member, INamedTypeSymbol type, string name)
249public static bool MatchMemberByName([NotNullWhen(returnValue: true)] this ISymbol? member, INamedTypeSymbol type, string name)
254public static bool MatchPropertyByName([NotNullWhen(returnValue: true)] this ISymbol? member, INamedTypeSymbol type, string name)
259public static bool MatchFieldByName([NotNullWhen(returnValue: true)] this ISymbol? member, INamedTypeSymbol type, string name)
283public static string FormatMemberName(this ISymbol member)
419public static bool IsFromMscorlib(this ISymbol symbol, Compilation compilation)
460public static bool IsImplementationOfAnyInterfaceMember(this ISymbol symbol)
465public static bool IsImplementationOfAnyImplicitInterfaceMember(this ISymbol symbol)
467return IsImplementationOfAnyImplicitInterfaceMember<ISymbol>(symbol);
473public static bool IsImplementationOfAnyImplicitInterfaceMember<TSymbol>(this ISymbol symbol)
474where TSymbol : ISymbol
496public static bool IsImplementationOfAnyImplicitInterfaceMember<TSymbol>(this ISymbol symbol, out TSymbol interfaceMember)
497where TSymbol : ISymbol
518public static bool IsImplementationOfInterfaceMember(this ISymbol symbol, [NotNullWhen(returnValue: true)] ISymbol? interfaceMember)
527public static bool IsOverrideOrImplementationOfInterfaceMember(this ISymbol symbol, [NotNullWhen(returnValue: true)] ISymbol? interfaceMember)
546/// <remarks>Requires that <see cref="ISymbol.IsOverride"/> is true for the given <paramref name="symbol"/>.</remarks>
547public static ISymbol GetOverriddenMember(this ISymbol symbol)
566public static bool IsImplementationOfAnyExplicitInterfaceMember([NotNullWhen(returnValue: true)] this ISymbol? symbol)
586public static ITypeSymbol? GetMemberOrLocalOrParameterType(this ISymbol symbol)
598public static ITypeSymbol? GetMemberType(this ISymbol? symbol)
614public static bool IsReadOnlyFieldOrProperty([NotNullWhen(returnValue: true)] this ISymbol? symbol)
626public static AttributeData? GetAttribute(this ISymbol symbol, [NotNullWhen(true)] INamedTypeSymbol? attributeType)
631public static IEnumerable<AttributeData> GetAttributes(this ISymbol symbol, IEnumerable<INamedTypeSymbol?> attributesToMatch)
649public static IEnumerable<AttributeData> GetAttributes(this ISymbol symbol, params INamedTypeSymbol?[] attributeTypesToMatch)
655public static IEnumerable<AttributeData> GetAttributes(this ISymbol symbol, INamedTypeSymbol? attributeTypeToMatch1)
666public static IEnumerable<AttributeData> GetAttributes(this ISymbol symbol, INamedTypeSymbol? attributeTypeToMatch1, INamedTypeSymbol? attributeTypeToMatch2)
679public static bool HasAnyAttribute(this ISymbol symbol, IEnumerable<INamedTypeSymbol> attributesToMatch)
684public static bool HasAnyAttribute(this ISymbol symbol, params INamedTypeSymbol?[] attributeTypesToMatch)
707public static bool HasAnyAttribute(this ISymbol symbol, [NotNullWhen(returnValue: true)] INamedTypeSymbol? attribute)
806public static bool[] HasAttributes(this ISymbol symbol, params INamedTypeSymbol?[] attributes)
826public static bool IsInSource(this ISymbol symbol)
831public static bool IsLambdaOrLocalFunction([NotNullWhen(returnValue: true)] this ISymbol? symbol)
839public static bool IsSymbolWithSpecialDiscardName([NotNullWhen(returnValue: true)] this ISymbol? symbol)
843public static bool IsConst([NotNullWhen(returnValue: true)] this ISymbol? symbol)
855public static bool IsReadOnly([NotNullWhen(returnValue: true)] this ISymbol? symbol)
src\RoslynAnalyzers\Utilities\Compiler\Options\AnalyzerOptionsExtensions.cs (18)
29private static bool TryGetSyntaxTreeForOption(ISymbol symbol, [NotNullWhen(returnValue: true)] out SyntaxTree? tree)
48ISymbol symbol,
66ISymbol symbol,
84ISymbol symbol,
117ISymbol symbol,
189ISymbol symbol,
254ISymbol symbol,
261ISymbol symbol,
262ISymbol containingContextSymbol,
298ISymbol symbol,
307ISymbol symbol,
317ISymbol symbol,
331ISymbol symbol,
380ISymbol symbol,
578ISymbol symbol,
593ISymbol symbol,
594ISymbol containingContextSymbol,
612ISymbol symbol,
src\RoslynAnalyzers\Utilities\Compiler\Options\SymbolNamesWithValueOption.cs (15)
31private readonly ImmutableDictionary<ISymbol, TValue> _symbols;
58private readonly ConcurrentDictionary<ISymbol, KeyValuePair<string?, TValue?>> _wildcardMatchResult = new();
60private readonly ConcurrentDictionary<ISymbol, string> _symbolToDeclarationId = new();
62private SymbolNamesWithValueOption(ImmutableDictionary<string, TValue> names, ImmutableDictionary<ISymbol, TValue> symbols,
75_symbols = ImmutableDictionary<ISymbol, TValue>.Empty;
90var symbolsBuilder = PooledDictionary<ISymbol, TValue>.GetInstance();
189static void ProcessSymbolName(NameParts parts, Compilation compilation, string? optionalPrefix, PooledDictionary<ISymbol, TValue> symbolsBuilder)
201foreach (var symbol in DocumentationCommentId.GetSymbolsForDeclarationId(nameWithPrefix, compilation))
230public bool Contains(ISymbol symbol)
236public bool TryGetValue(ISymbol symbol, [MaybeNullWhen(false)] out TValue value)
266private bool TryGetFirstWildcardMatch(ISymbol symbol, [NotNullWhen(true)] out string? firstMatchName, [MaybeNullWhen(false)] out TValue firstMatchValue)
344static string GetDeclarationId(ISymbol symbol)
374internal ref readonly ImmutableDictionary<ISymbol, TValue> Symbols => ref _symbolNamesWithValueOption._symbols;
378internal ref readonly ConcurrentDictionary<ISymbol, KeyValuePair<string?, TValue?>> WildcardMatchResult => ref _symbolNamesWithValueOption._wildcardMatchResult;
380internal ref readonly ConcurrentDictionary<ISymbol, string> SymbolToDeclarationId => ref _symbolNamesWithValueOption._symbolToDeclarationId;
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\CopyAnalysis\CopyAnalysis.cs (1)
30ISymbol owningSymbol,
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\GlobalFlowStateAnalysis\GlobalFlowStateDataFlowOperationVisitor.cs (1)
50ISymbol owningSymbol;
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\ParameterValidationAnalysis\ParameterValidationAnalysis.ParameterValidationDataFlowOperationVisitor.cs (1)
69ISymbol GetBottomOfStackOwningSymbol()
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\TaintedDataAnalysis\TaintedDataAnalysis.TaintedDataOperationVisitor.cs (1)
530ISymbol sinkSymbol,
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\AbstractLocation.cs (5)
24/// 3. Location created for certain symbols which do not have a declaration in executable code, i.e. no <see cref="IOperation"/> for declaration (such as parameter symbols, member symbols, etc. - <see cref="CreateSymbolLocation(ISymbol, ImmutableStack{IOperation})"/>/>).
35private AbstractLocation(IOperation? creation, ImmutableStack<IOperation>? creationCallStack, AnalysisEntity? analysisEntity, ISymbol? symbol, InterproceduralCaptureId? captureId, ITypeSymbol? locationType, bool isSpecialSingleton)
48private static AbstractLocation Create(IOperation? creation, ImmutableStack<IOperation>? creationCallStack, AnalysisEntity? analysisEntity, ISymbol? symbol, InterproceduralCaptureId? captureId, ITypeSymbol? locationType)
64public static AbstractLocation CreateSymbolLocation(ISymbol symbol, ImmutableStack<IOperation>? creationCallStack)
87public ISymbol? Symbol { get; }
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\AnalysisEntityFactory.cs (11)
33private readonly Dictionary<ISymbol, PointsToAbstractValue> _instanceLocationsForSymbols;
40private readonly Func<ISymbol, ImmutableStack<IOperation>?> _getInterproceduralCallStackForOwningSymbol;
52ImmutableDictionary<ISymbol, PointsToAbstractValue>? interproceduralCapturedVariablesMap,
54Func<ISymbol, ImmutableStack<IOperation>?> getInterproceduralCallStackForOwningSymbol)
71_instanceLocationsForSymbols = new Dictionary<ISymbol, PointsToAbstractValue>();
132ISymbol? symbol = null;
270private static void GetSymbolAndIndicesForMemberReference(IMemberReferenceOperation memberReference, ref ISymbol? symbol, ref ImmutableArray<AbstractIndex> indices)
310public bool TryCreateForSymbolDeclaration(ISymbol symbol, [NotNullWhen(returnValue: true)] out AnalysisEntity? analysisEntity)
438private bool TryCreate(ISymbol? symbol, ImmutableArray<AbstractIndex> indices,
514private PointsToAbstractValue? EnsureLocation(PointsToAbstractValue? instanceLocation, ISymbol? symbol, AnalysisEntity? parent)
553private AnalysisEntity Create(ISymbol? symbol, ImmutableArray<AbstractIndex> indices, ITypeSymbol type, PointsToAbstractValue? instanceLocation, AnalysisEntity? parent, AnalysisEntity? entityForInstanceLocation)
src\Analyzers\Core\Analyzers\RemoveUnusedMembers\AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (26)
89protected virtual void HandleNamedTypeSymbolStart(SymbolStartAnalysisContext context, Action<ISymbol, ValueUsageInfo> onSymbolUsageFound)
99internal sealed class OriginalDefinitionSymbolEqualityComparer : IEqualityComparer<ISymbol>
107bool IEqualityComparer<ISymbol>.Equals(ISymbol? x, ISymbol? y)
110int IEqualityComparer<ISymbol>.GetHashCode(ISymbol obj)
118private static readonly ObjectPool<HashSet<ISymbol>> s_originalDefinitionSymbolHashSetPool = new(() => new(OriginalDefinitionSymbolEqualityComparer.Instance));
123private readonly Dictionary<ISymbol, ValueUsageInfo> _symbolValueUsageStateMap_doNotAccessDirectly = new(OriginalDefinitionSymbolEqualityComparer.Instance);
165private static Location GetDiagnosticLocation(ISymbol symbol)
230Action<ISymbol, ValueUsageInfo> onSymbolUsageFound = OnSymbolUsage;
283foreach (var member in namedType.GetMembers())
302var symbol = symbolContext.Symbol;
315private void AddSymbolUsage(ISymbol? symbol, ValueUsageInfo info)
326private void UpdateSymbolUsage(ISymbol? symbol, ValueUsageInfo info)
340private bool TryGetAndRemoveSymbolUsage(ISymbol memberSymbol, out ValueUsageInfo valueUsageInfo)
380private void OnSymbolUsage(ISymbol? memberSymbol, ValueUsageInfo usageInfo)
391var memberSymbol = memberReference.Member;
490foreach (var symbol in symbolInfo.GetAllSymbols())
526foreach (var member in namedType.GetMembers())
625ISymbol member,
667HashSet<ISymbol> builder,
687var symbol = lazyModel.GetSymbolInfo(node, cancellationToken).Symbol;
749foreach (var member in namedTypeSymbol.GetMembers())
764private void AddDebuggerDisplayAttributeArgumentsCore(ISymbol symbol, ArrayBuilder<string> builder)
790private bool IsCandidateSymbol([NotNullWhen(true)] ISymbol? memberSymbol)
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)
17ISymbol containingSymbol,
src\Analyzers\Core\Analyzers\UseThrowExpression\AbstractUseThrowExpressionDiagnosticAnalyzer.cs (6)
106if (!TryDecomposeIfCondition(ifOperation, out var localOrParameter))
138private static bool ValueIsAccessed(SemanticModel semanticModel, IConditionalOperation ifOperation, IBlockOperation containingBlock, ISymbol localOrParameter, IExpressionStatementOperation expressionStatement, IAssignmentOperation assignmentExpression)
167IBlockOperation containingBlock, IConditionalOperation ifOperation, ISymbol localOrParameter,
189if (!TryGetLocalOrParameterSymbol(assignmentExpression.Value, out var assignmentValue))
209[NotNullWhen(true)] out ISymbol? localOrParameter)
241[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 (94)
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)
213public static INamedTypeSymbol? GetContainingTypeOrThis(this ISymbol symbol)
223public static bool IsErrorType([NotNullWhen(true)] this ISymbol? symbol)
226public static bool IsModuleType([NotNullWhen(true)] this ISymbol? symbol)
229public static bool IsInterfaceType([NotNullWhen(true)] this ISymbol? symbol)
232public static bool IsArrayType([NotNullWhen(true)] this ISymbol? symbol)
235public static bool IsTupleType([NotNullWhen(true)] this ISymbol? symbol)
238public static bool IsAnonymousFunction([NotNullWhen(true)] this ISymbol? symbol)
241public static bool IsKind([NotNullWhen(true)] this ISymbol? symbol, SymbolKind kind)
244public static bool MatchesKind([NotNullWhen(true)] this ISymbol? symbol, SymbolKind kind)
247public static bool MatchesKind([NotNullWhen(true)] this ISymbol? symbol, SymbolKind kind1, SymbolKind kind2)
253public static bool MatchesKind([NotNullWhen(true)] this ISymbol? symbol, SymbolKind kind1, SymbolKind kind2, SymbolKind kind3)
259public static bool MatchesKind([NotNullWhen(true)] this ISymbol? symbol, params SymbolKind[] kinds)
265public static bool IsReducedExtension([NotNullWhen(true)] this ISymbol? symbol)
268public static bool IsEnumMember([NotNullWhen(true)] this ISymbol? symbol)
271public static bool IsExtensionMethod(this ISymbol symbol)
274public static bool IsLocalFunction([NotNullWhen(true)] this ISymbol? symbol)
277public static bool IsAnonymousOrLocalFunction([NotNullWhen(true)] this ISymbol? symbol)
280public static bool IsModuleMember([NotNullWhen(true)] this ISymbol? symbol)
283public static bool IsConstructor([NotNullWhen(true)] this ISymbol? symbol)
286public static bool IsStaticConstructor([NotNullWhen(true)] this ISymbol? symbol)
289public static bool IsDestructor([NotNullWhen(true)] this ISymbol? symbol)
292public static bool IsUserDefinedOperator([NotNullWhen(true)] this ISymbol? symbol)
295public static bool IsConversion([NotNullWhen(true)] this ISymbol? symbol)
298public static bool IsOrdinaryMethod([NotNullWhen(true)] this ISymbol? symbol)
301public static bool IsOrdinaryMethodOrLocalFunction([NotNullWhen(true)] this ISymbol? symbol)
304public static bool IsDelegateType([NotNullWhen(true)] this ISymbol? symbol)
307public static bool IsAnonymousType([NotNullWhen(true)] this ISymbol? symbol)
310public static bool IsNormalAnonymousType([NotNullWhen(true)] this ISymbol? symbol)
313public static bool IsAnonymousDelegateType([NotNullWhen(true)] this ISymbol? symbol)
316public static bool IsAnonymousTypeProperty([NotNullWhen(true)] this ISymbol? symbol)
319public static bool IsTupleField([NotNullWhen(true)] this ISymbol? symbol)
322public static bool IsIndexer([NotNullWhen(true)] this ISymbol? symbol)
325public static bool IsWriteableFieldOrProperty([NotNullWhen(true)] this ISymbol? symbol)
333public static bool IsRequired([NotNullWhen(true)] this ISymbol? symbol)
336public static ITypeSymbol? GetMemberType(this ISymbol? symbol)
348public static int GetArity(this ISymbol symbol)
357public static ISymbol? GetOriginalUnreducedDefinition(this ISymbol? symbol)
400public static bool IsFunctionValue([NotNullWhen(true)] this ISymbol? symbol)
403public static bool IsThisParameter([NotNullWhen(true)] this ISymbol? symbol)
407public static ISymbol? ConvertThisParameterToType(this ISymbol? symbol)
417public static bool IsParams([NotNullWhen(true)] this ISymbol? symbol)
420public static ImmutableArray<IParameterSymbol> GetParameters(this ISymbol? symbol)
428public static ImmutableArray<ITypeParameterSymbol> GetTypeParameters(this ISymbol? symbol)
436public static ImmutableArray<ITypeParameterSymbol> GetAllTypeParameters(this ISymbol? symbol)
449public static ImmutableArray<ITypeSymbol> GetTypeArguments(this ISymbol? symbol)
457public static ImmutableArray<ITypeSymbol> GetAllTypeArguments(this ISymbol symbol)
472public static bool IsAttribute([NotNullWhen(true)] this ISymbol? symbol)
481public static bool RequiresUnsafeModifier([NotNullWhen(true)] this ISymbol? member)
488this ISymbol? symbol,
531public static bool IsStaticType([NotNullWhen(true)] this ISymbol? symbol)
535[NotNullWhen(true)] this ISymbol? symbol, ISymbol withinType, IAssemblySymbol withinAssembly, CancellationToken cancellationToken)
555public static IEnumerable<IPropertySymbol> GetValidAnonymousTypeProperties(this ISymbol symbol)
561public static Accessibility ComputeResultantAccessibility(this ISymbol? symbol, ITypeSymbol finalDestination)
587public static bool IsInaccessibleLocal(this ISymbol symbol, int position)
605public static bool IsAccessor([NotNullWhen(true)] this ISymbol? symbol)
608public static bool IsPropertyAccessor([NotNullWhen(true)] this ISymbol? symbol)
611public static bool IsEventAccessor([NotNullWhen(true)] this ISymbol? symbol)
614public static bool IsFromSource(this ISymbol symbol)
617public static bool IsNonImplicitAndFromSource(this ISymbol symbol)
620public static ITypeSymbol? GetSymbolType(this ISymbol? symbol)
636public static bool IsAwaitableNonDynamic([NotNullWhen(true)] this ISymbol? symbol, SemanticModel semanticModel, int position)
775public static bool IsKind<TSymbol>(this ISymbol symbol, SymbolKind kind, [NotNullWhen(true)] out TSymbol? result) where TSymbol : class, ISymbol
792public static bool IsSymbolWithSpecialDiscardName(this ISymbol symbol)
801public static bool IsObsolete(this ISymbol symbol)
808public static bool HasAttribute([NotNullWhen(true)] this ISymbol? symbol, [NotNullWhen(true)] INamedTypeSymbol? attributeClass)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions_Accessibility.cs (11)
16this ISymbol symbol,
17ISymbol within,
38this ISymbol symbol,
50this ISymbol symbol,
63ISymbol symbol,
82ISymbol symbol,
83ISymbol within, // must be assembly or named type symbol
173private static bool IsNamedTypeAccessible(INamedTypeSymbol type, ISymbol within)
211ISymbol within)
246ISymbol within,
406ISymbol within,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.cs (13)
404public static bool CanSupportCollectionInitializer(this ITypeSymbol typeSymbol, ISymbol within)
435public static IEnumerable<T> GetAccessibleMembersInBaseTypes<T>(this ITypeSymbol containingType, ISymbol within) where T : class, ISymbol
444public static ImmutableArray<T> GetAccessibleMembersInThisAndBaseTypes<T>(this ITypeSymbol? containingType, ISymbol within) where T : class, ISymbol
454public static ImmutableArray<T> GetAccessibleMembersInThisAndBaseTypes<T>(this ITypeSymbol? containingType, string memberName, ISymbol within) where T : class, ISymbol
499public static IEnumerable<T> SelectAccessibleMembers<T>(this IEnumerable<ITypeSymbol>? types, ISymbol within) where T : class, ISymbol
509private static IEnumerable<T> SelectAccessibleMembers<T>(this IEnumerable<ITypeSymbol>? types, string memberName, ISymbol within) where T : class, ISymbol
694foreach (var member in type.GetMembers())
755public static bool IsReadOnlySpan([NotNullWhen(true)] this ISymbol? symbol)
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)
28private readonly Dictionary<ISymbol, PooledHashSet<IOperation>> _reachingWrites;
62public void Clear(ISymbol symbol)
74public void ForEachCurrentWrite<TArg>(ISymbol symbol, Action<IOperation, TArg> action, TArg arg)
86public bool ForEachCurrentWrite<TArg>(ISymbol symbol, Func<IOperation, TArg, bool> action, TArg arg)
104public void OnWriteReferenceFound(ISymbol symbol, IOperation operation, bool maybeWritten)
130foreach (var key in _reachingWrites.Keys)
223private 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)
21PooledDictionary<(ISymbol symbol, IOperation operation), bool> symbolsWriteMap,
22PooledHashSet<ISymbol> symbolsRead,
32protected override PooledHashSet<ISymbol> SymbolsReadBuilder { get; }
34protected override PooledDictionary<(ISymbol symbol, IOperation operation), bool> SymbolsWriteBuilder { get; }
39ISymbol owningSymbol,
44symbolsRead: PooledHashSet<ISymbol>.GetInstance(),
63public override void OnLValueCaptureFound(ISymbol symbol, IOperation operation, CaptureId captureId)
75public override void SetTargetsFromSymbolForDelegate(IOperation write, ISymbol symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.Walker.cs (13)
26private ISymbol _currentContainingSymbol;
29private PooledDictionary<IAssignmentOperation, PooledHashSet<(ISymbol, IOperation)>> _pendingWritesMap;
35ISymbol containingSymbol,
51private void Visit(ISymbol containingSymbol, IEnumerable<IOperation> operations, AnalysisData analysisData, CancellationToken cancellationToken)
58_pendingWritesMap = PooledDictionary<IAssignmentOperation, PooledHashSet<(ISymbol, IOperation)>>.GetInstance();
90private void OnReadReferenceFound(ISymbol symbol)
93private void OnWriteReferenceFound(ISymbol symbol, IOperation operation, ValueUsageInfo valueUsageInfo)
101private void OnLValueCaptureFound(ISymbol symbol, IOperation operation, CaptureId captureId)
107private void OnReferenceFound(ISymbol symbol, IOperation operation)
159private bool MakePendingWrite(IOperation operation, ISymbol symbolOpt)
166var set = PooledHashSet<(ISymbol, IOperation)>.GetInstance();
175set = PooledHashSet<(ISymbol, IOperation)>.GetInstance();
407private void ProcessPossibleDelegateCreationAssignment(ISymbol symbol, IOperation write)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SemanticFacts\ISemanticFacts.cs (6)
65ISymbol? GetDeclaredSymbol(SemanticModel semanticModel, SyntaxToken token, CancellationToken cancellationToken);
90IEnumerable<ISymbol> GetDeclaredSymbols(SemanticModel semanticModel, SyntaxNode memberDeclaration, CancellationToken cancellationToken);
95ISymbol? FindFieldOrPropertyForArgument(SemanticModel semanticModel, SyntaxNode argument, CancellationToken cancellationToken);
96ISymbol? FindFieldOrPropertyForAttributeArgument(SemanticModel semanticModel, SyntaxNode argument, CancellationToken cancellationToken);
98ImmutableArray<ISymbol> GetBestOrAllSymbols(SemanticModel semanticModel, SyntaxNode? node, SyntaxToken token, CancellationToken cancellationToken);
105ImmutableArray<IMethodSymbol> GetLocalFunctionSymbols(Compilation compilation, ISymbol symbol, CancellationToken cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.cs (31)
29/// the "same" <see cref="ISymbol.ContainingType"/> and
30/// equal <see cref="ISymbol.MetadataName"/>.</item>
32/// the "same" <see cref="ISymbol.ContainingType"/>,
33/// equal <see cref="ISymbol.MetadataName"/>,
39/// the "same" <see cref="ISymbol.ContainingAssembly"/>.
40/// <see cref="ISymbol.MetadataName"/> is not used because module identity is not important in practice.</item>
42/// the "same" <see cref="ISymbol.ContainingSymbol"/>,
43/// equal <see cref="ISymbol.MetadataName"/>,
47/// the "same" <see cref="ISymbol.ContainingSymbol"/> and
48/// equal <see cref="ISymbol.MetadataName"/>.
53/// the "same" <see cref="ISymbol.ContainingSymbol"/> and
54/// equal <see cref="ISymbol.MetadataName"/>.</item>
58/// the "same" the "same" <see cref="ISymbol.ContainingType"/>,
59/// the "same" <see cref="ISymbol.MetadataName"/>, and have
63/// the "same" <see cref="ISymbol.ContainingSymbol"/> and
64/// the "same" <see cref="ISymbol.MetadataName"/>.</item>
66/// the "same" <see cref="ISymbol.ContainingSymbol"/> and
67/// the "same" <see cref="ISymbol.MetadataName"/>.</item>
69/// the "same" <see cref="ISymbol.Name"/>.</item>
76/// cref="SyntaxTree"/> is enumerated to list all the symbols with the same <see cref="ISymbol.Name"/> and <see
77/// cref="ISymbol.Kind"/> as the original symbol. The symbol with the same index in the destination tree as the
127public static SymbolKey Create(ISymbol? symbol, CancellationToken cancellationToken = default)
146public 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)
65public TDeclarationNode AddMembers<TDeclarationNode>(TDeclarationNode destination, IEnumerable<ISymbol> members, CodeGenerationContextInfo info, CancellationToken cancellationToken)
115public TDeclarationNode UpdateDeclarationMembers<TDeclarationNode>(TDeclarationNode declaration, IList<ISymbol> newMembers, CodeGenerationContextInfo info, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode
140public abstract TDeclarationNode UpdateDeclarationMembers<TDeclarationNode>(TDeclarationNode declaration, IList<ISymbol> newMembers, TCodeGenerationContextInfo info, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode;
271IEnumerable<ISymbol> members,
294IEnumerable<ISymbol> members,
301foreach (var member in members)
325IEnumerable<ISymbol> members,
333foreach (var member in members)
342private SyntaxNode? GetNewMember(TCodeGenerationContextInfo info, CodeGenerationDestination codeGenerationDestination, ISymbol member, CancellationToken cancellationToken)
358ISymbol member,
373private static bool GeneratingEnum(IEnumerable<ISymbol> members)
455public Task<Document> AddMembersAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IEnumerable<ISymbol> members, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\ICodeGenerationService.cs (4)
83TDeclarationNode AddMembers<TDeclarationNode>(TDeclarationNode destination, IEnumerable<ISymbol> members, CodeGenerationContextInfo info, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode;
123TDeclarationNode UpdateDeclarationMembers<TDeclarationNode>(TDeclarationNode declaration, IList<ISymbol> newMembers, CodeGenerationContextInfo info, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode;
173Task<Document> AddMembersAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IEnumerable<ISymbol> members, CancellationToken cancellationToken);
178bool CanAddTo(ISymbol destination, Solution solution, CancellationToken cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\SyntaxAnnotationExtensions.cs (1)
15where TSymbol : ISymbol
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions.cs (14)
86private static ITypeSymbol GetType(Compilation compilation, ISymbol symbol)
101this SyntaxGenerator generator, IMethodSymbol method, ISymbol throughMember)
116this SyntaxGenerator generator, ISymbol member, ISymbol throughMember)
180static SyntaxNode GenerateContainerName(SyntaxGenerator factory, ISymbol throughMember)
194ISymbol? throughMember,
233ISymbol? throughMember,
277private static bool TryGetValue(IDictionary<string, ISymbol>? dictionary, string key, [NotNullWhen(true)] out string? value)
280if (dictionary != null && dictionary.TryGetValue(key, out var symbol))
289public static ImmutableArray<ISymbol> CreateFieldsForParameters(
292using var _ = ArrayBuilder<ISymbol>.GetInstance(out var result);
311public static ImmutableArray<ISymbol> CreatePropertiesForParameters(
314using var _ = ArrayBuilder<ISymbol>.GetInstance(out var result);
346IDictionary<string, ISymbol>? parameterToExistingFieldMap,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\SemanticsFactsService\AbstractSemanticFactsService.cs (10)
32private static readonly Func<ISymbol, bool> s_LocalNameFilter = s =>
75string baseName, Func<ISymbol, bool> filter,
92protected virtual IEnumerable<ISymbol> GetCollidableSymbols(SemanticModel semanticModel, SyntaxNode location, SyntaxNode container, CancellationToken cancellationToken)
115var impl = type.FindImplementationForInterfaceMember(disposeMethodToLookFor);
198public ISymbol GetDeclaredSymbol(SemanticModel semanticModel, SyntaxToken token, CancellationToken cancellationToken)
228public IEnumerable<ISymbol> GetDeclaredSymbols(SemanticModel semanticModel, SyntaxNode memberDeclaration, CancellationToken cancellationToken)
237public ISymbol FindFieldOrPropertyForArgument(SemanticModel semanticModel, SyntaxNode argumentNode, CancellationToken cancellationToken)
240public ISymbol FindFieldOrPropertyForAttributeArgument(SemanticModel semanticModel, SyntaxNode argumentNode, CancellationToken cancellationToken)
243public ImmutableArray<ISymbol> GetBestOrAllSymbols(SemanticModel semanticModel, SyntaxNode node, SyntaxToken token, CancellationToken cancellationToken)
249public 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)
117public override async Task<(ISymbol? symbol, int selectedIndex)> GetInvocationSymbolAsync(
167var typeSymbol = semanticModel.GetSymbolInfo(objectCreation.Type, cancellationToken).Symbol;
294ISymbol declarationSymbol,
535ISymbol declarationSymbol,
572ISymbol declarationSymbol,
714ISymbol declarationSymbol,
735ISymbol declarationSymbol,
751ISymbol declarationSymbol,
791ISymbol declarationSymbol,
810private ImmutableArray<SyntaxNode> VerifyAndPermuteParamNodes(IEnumerable<XmlElementSyntax> paramNodes, ISymbol declarationSymbol, SignatureChange updatedSignature)
870public override async Task<ImmutableArray<ISymbol>> DetermineCascadedSymbolsFromDelegateInvokeAsync(
888var convertedType = (ISymbol?)semanticModel.GetTypeInfo(node, cancellationToken).ConvertedType;
944protected 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 (19)
173internal override MemberBody? TryGetDeclarationBody(SyntaxNode node, ISymbol? symbol)
176internal override bool IsDeclarationWithSharedBody(SyntaxNode declaration, ISymbol member)
182protected override IEnumerable<SyntaxNode> GetVariableUseSites(IEnumerable<SyntaxNode> roots, ISymbol localOrParameter, SemanticModel model, CancellationToken cancellationToken)
951internal override bool IsConstructorWithMemberInitializers(ISymbol symbol, CancellationToken cancellationToken)
1003protected override SyntaxNode? GetSymbolDeclarationSyntax(ISymbol symbol, Func<ImmutableArray<SyntaxReference>, SyntaxReference?> selector, CancellationToken cancellationToken)
1028protected override ISymbol? GetDeclaredSymbol(SemanticModel model, SyntaxNode declaration, CancellationToken cancellationToken)
1041protected override OneOrMany<(ISymbol? oldSymbol, ISymbol? newSymbol)> GetEditedSymbols(
1061OneOrMany<(ISymbol? oldSymbol, ISymbol? newSymbol)> AddFieldSymbolUpdates(SeparatedSyntaxList<VariableDeclaratorSyntax> oldVariables, SeparatedSyntaxList<VariableDeclaratorSyntax> newVariables)
1080? OneOrMany<(ISymbol?, ISymbol?)>.Empty
1085ref TemporaryArray<(ISymbol?, ISymbol?, EditKind)> result,
1088ISymbol? oldSymbol,
1090ISymbol? newSymbol,
1398private ISymbol? GetSymbolForEdit(
1435private ISymbol? GetParameterContainingMemberOrType(SyntaxNode? node, SyntaxNode? otherNode, SemanticModel? model, IReadOnlyDictionary<SyntaxNode, SyntaxNode> fromOtherMap, CancellationToken cancellationToken)
2528internal override void ReportInsertedMemberSymbolRudeEdits(RudeEditDiagnosticsBuilder 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 (11)
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>>();
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,
150Dictionary<ISymbol, ArrayBuilder<ProjectId>>? invalidProjectMap,
249Dictionary<ISymbol, ArrayBuilder<ProjectId>>? invalidProjectMap,
291protected static string GetFilterTextDefault(ISymbol symbol, string displayText, TSyntaxContext context)
452private static Dictionary<ISymbol, ArrayBuilder<ProjectId>> FindSymbolsMissingInLinkedContexts(
456var 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)
303ImmutableArray<ISymbol> symbols,
335ImmutableArray<ISymbol> symbols,
359ImmutableArray<ISymbol> symbols,
390CompletionItem 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)
104internal abstract MemberBody? TryGetDeclarationBody(SyntaxNode node, ISymbol? symbol);
109internal abstract bool IsDeclarationWithSharedBody(SyntaxNode declaration, ISymbol member);
180/// Returns all symbols with declaring syntax (<see cref="GetSymbolDeclarationSyntax(ISymbol, CancellationToken)"/> must return a syntax node)
185ref TemporaryArray<(ISymbol?, ISymbol?, EditKind)> result,
188ISymbol? oldSymbol,
190ISymbol? newSymbol,
201protected abstract OneOrMany<(ISymbol? oldSymbol, ISymbol? newSymbol)> GetEditedSymbols(
209private OneOrMany<(ISymbol? oldSymbol, ISymbol? newSymbol, EditKind editKind)> GetSymbolEdits(
220var result = new TemporaryArray<(ISymbol?, ISymbol?, EditKind)>();
2490 => OneOrMany<(ISymbol?, ISymbol?, EditKind)>.Empty,
258protected abstract IEnumerable<SyntaxNode> GetVariableUseSites(IEnumerable<SyntaxNode> roots, ISymbol localOrParameter, SemanticModel model, CancellationToken cancellationToken);
292internal string GetDisplayKindAndName(ISymbol symbol, string? displayKind = null, bool fullyQualify = false)
313internal string GetDisplayKind(ISymbol symbol)
430internal abstract void ReportInsertedMemberSymbolRudeEdits(RudeEditDiagnosticsBuilder diagnostics, ISymbol newSymbol, SyntaxNode newNode, bool insertingIntoExistingContainingType);
490/// <see cref="ISymbol.DeclaringSyntaxReferences"/> of a primary constructor returns the type declaration syntax.
499internal abstract bool IsConstructorWithMemberInitializers(ISymbol symbol, CancellationToken cancellationToken);
951ISymbol oldMember,
952ISymbol newMember,
2387protected static bool SymbolsEquivalent(ISymbol oldSymbol, ISymbol newSymbol)
2448protected static bool MemberOrDelegateSignaturesEquivalent(ISymbol? oldMember, ISymbol? newMember, bool exact = false)
ExtractMethod\MethodExtractor.Analyzer.cs (33)
49protected virtual bool IsReadOutside(ISymbol symbol, HashSet<ISymbol> readOutsideMap)
146GetSignatureInformation(Dictionary<ISymbol, VariableInfo> symbolMap, ExtractMethodFlowControlInformation flowControlInformation)
220MultiDictionary<ISymbol, SyntaxToken> symbolMap,
222IList<ISymbol> failedVariables,
282private MultiDictionary<ISymbol, SyntaxToken> GetSymbolMap()
284var symbolMap = new MultiDictionary<ISymbol, SyntaxToken>();
403MultiDictionary<ISymbol, SyntaxToken> symbolMap,
405out Dictionary<ISymbol, VariableInfo> variableInfoMap,
406out List<ISymbol> failedVariables)
426var candidates = new HashSet<ISymbol>(readInsideMap);
436foreach (var symbol in candidates)
522PooledDisposer<PooledHashSet<ISymbol>> GetPooledSymbolSet(ImmutableArray<ISymbol> symbols, out PooledHashSet<ISymbol> symbolSet)
524var disposer = PooledHashSet<ISymbol>.GetInstance(out symbolSet);
529ITypeSymbol? GetSymbolTypeWithUpdatedNullability(ISymbol symbol)
556ISymbol symbol,
573private ITypeSymbol? GetUnderlyingSymbolType(ISymbol symbol)
584private static void AddVariableToMap(IDictionary<ISymbol, VariableInfo> variableInfoMap, ISymbol localOrParameter, VariableInfo variableInfo)
589MultiDictionary<ISymbol, SyntaxToken> symbolMap,
590ISymbol symbol,
644MultiDictionary<ISymbol, SyntaxToken> symbolMap, ISymbol symbol, bool writtenInside)
697private static bool IsThisParameter(ISymbol localOrParameter)
707private static bool IsInteractiveSynthesizedParameter(ISymbol localOrParameter)
747IDictionary<ISymbol, VariableInfo> variableInfoMap,
750foreach (var symbol in variableInfoMap.Keys)
777private void AppendMethodTypeParameterUsedDirectly(MultiDictionary<ISymbol, SyntaxToken> symbolMap, IDictionary<int, ITypeParameterSymbol> sortedMap)
784IDictionary<ISymbol, VariableInfo> variableInfoMap,
785MultiDictionary<ISymbol, SyntaxToken> symbolMap,
869private OperationStatus CheckReadOnlyFields(MultiDictionary<ISymbol, SyntaxToken> symbolMap)
FindUsages\AbstractFindUsagesService_FindImplementations.cs (15)
41IFindUsagesContext context, ISymbol symbol, Project project, OptionsProvider<ClassificationOptions> classificationOptions, CancellationToken cancellationToken)
68ISymbol symbol, Project project, IFindUsagesContext context, OptionsProvider<ClassificationOptions> classificationOptions, CancellationToken cancellationToken)
84foreach (var implementation in implementations)
93private static async Task<ImmutableArray<ISymbol>> FindSourceImplementationsAsync(
94Solution solution, ISymbol symbol, CancellationToken cancellationToken)
96var builder = new HashSet<ISymbol>(SymbolEquivalenceComparer.Instance);
128static bool AddedAllLocations(ISymbol implementation, HashSet<(string filePath, TextSpan span)> seenLocations)
140private static async Task<ImmutableArray<ISymbol>> FindImplementationsWorkerAsync(
141Solution solution, ISymbol symbol, CancellationToken cancellationToken)
145using var _ = PooledHashSet<ISymbol>.GetInstance(out var result);
168private static async Task<ImmutableArray<ISymbol>> FindSourceAndMetadataImplementationsAsync(
169Solution solution, ISymbol symbol, CancellationToken cancellationToken)
179using var _ = PooledHashSet<ISymbol>.GetInstance(out var implementationsAndOverrides);
181foreach (var implementation in implementations)
199return 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)
15Task<string> ToDescriptionStringAsync(SemanticModel semanticModel, int position, ISymbol symbol, SymbolDescriptionOptions options, SymbolDescriptionGroups groups = SymbolDescriptionGroups.All, CancellationToken cancellationToken = default);
16Task<string> ToDescriptionStringAsync(SemanticModel semanticModel, int position, ImmutableArray<ISymbol> symbols, SymbolDescriptionOptions options, SymbolDescriptionGroups groups = SymbolDescriptionGroups.All, CancellationToken cancellationToken = default);
17Task<ImmutableArray<SymbolDisplayPart>> ToDescriptionPartsAsync(SemanticModel semanticModel, int position, ImmutableArray<ISymbol> symbols, SymbolDescriptionOptions options, SymbolDescriptionGroups groups = SymbolDescriptionGroups.All, CancellationToken cancellationToken = default);
18Task<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)
QuickInfo\CommonSemanticQuickInfoProvider.cs (11)
134private static bool HasNoErrors(ImmutableArray<ISymbol> symbols)
189protected virtual NullableFlowState GetNullabilityAnalysis(SemanticModel semanticModel, ISymbol symbol, SyntaxNode node, CancellationToken cancellationToken) => NullableFlowState.None;
200var symbolSet = new HashSet<ISymbol>(SymbolEquivalenceComparer.Instance);
201using var _ = ArrayBuilder<ISymbol>.GetInstance(out var filteredSymbols);
229void AddSymbols(ImmutableArray<ISymbol> symbols, bool checkAccessibility)
231foreach (var symbol in symbols)
245private ImmutableArray<ISymbol> GetSymbolsFromToken(SyntaxToken token, SolutionServices services, SemanticModel semanticModel, CancellationToken cancellationToken)
249var symbol = semanticModel.GetSymbolInfo(lambdaSyntax, cancellationToken).Symbol;
255var symbol = semanticModel.GetSymbolInfo(elementAccessExpression, cancellationToken).Symbol;
272private static bool IsOk([NotNullWhen(returnValue: true)] ISymbol? symbol)
286private static bool IsAccessible(ISymbol symbol, INamedTypeSymbol? within)
SignatureHelp\AbstractSignatureHelpProvider.SymbolKeySignatureHelpItem.cs (1)
14ISymbol symbol,
src\Analyzers\Core\Analyzers\RemoveUnusedMembers\AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (25)
89protected virtual void HandleNamedTypeSymbolStart(SymbolStartAnalysisContext context, Action<ISymbol, ValueUsageInfo> onSymbolUsageFound)
99internal sealed class OriginalDefinitionSymbolEqualityComparer : IEqualityComparer<ISymbol>
107bool IEqualityComparer<ISymbol>.Equals(ISymbol? x, ISymbol? y)
110int IEqualityComparer<ISymbol>.GetHashCode(ISymbol obj)
118private static readonly ObjectPool<HashSet<ISymbol>> s_originalDefinitionSymbolHashSetPool = new(() => new(OriginalDefinitionSymbolEqualityComparer.Instance));
123private readonly Dictionary<ISymbol, ValueUsageInfo> _symbolValueUsageStateMap_doNotAccessDirectly = new(OriginalDefinitionSymbolEqualityComparer.Instance);
165private static Location GetDiagnosticLocation(ISymbol symbol)
230Action<ISymbol, ValueUsageInfo> onSymbolUsageFound = OnSymbolUsage;
283foreach (var member in namedType.GetMembers())
302var symbol = symbolContext.Symbol;
315private void AddSymbolUsage(ISymbol? symbol, ValueUsageInfo info)
326private void UpdateSymbolUsage(ISymbol? symbol, ValueUsageInfo info)
340private bool TryGetAndRemoveSymbolUsage(ISymbol memberSymbol, out ValueUsageInfo valueUsageInfo)
380private void OnSymbolUsage(ISymbol? memberSymbol, ValueUsageInfo usageInfo)
391var memberSymbol = memberReference.Member;
526foreach (var member in namedType.GetMembers())
625ISymbol member,
667HashSet<ISymbol> builder,
687var symbol = lazyModel.GetSymbolInfo(node, cancellationToken).Symbol;
749foreach (var member in namedTypeSymbol.GetMembers())
764private void AddDebuggerDisplayAttributeArgumentsCore(ISymbol symbol, ArrayBuilder<string> builder)
790private bool IsCandidateSymbol([NotNullWhen(true)] ISymbol? memberSymbol)
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)
17ISymbol containingSymbol,
src\Analyzers\Core\Analyzers\UseThrowExpression\AbstractUseThrowExpressionDiagnosticAnalyzer.cs (6)
106if (!TryDecomposeIfCondition(ifOperation, out var localOrParameter))
138private static bool ValueIsAccessed(SemanticModel semanticModel, IConditionalOperation ifOperation, IBlockOperation containingBlock, ISymbol localOrParameter, IExpressionStatementOperation expressionStatement, IAssignmentOperation assignmentExpression)
167IBlockOperation containingBlock, IConditionalOperation ifOperation, ISymbol localOrParameter,
189if (!TryGetLocalOrParameterSymbol(assignmentExpression.Value, out var assignmentValue))
209[NotNullWhen(true)] out ISymbol? localOrParameter)
241[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)
35private static readonly ObjectPool<Dictionary<ISymbol, SymbolGroup>> s_symbolToGroupPool = new(() => new(MetadataUnifyingEquivalenceComparer.Instance));
59public Task FindReferencesAsync(ISymbol symbol, CancellationToken cancellationToken)
63ImmutableArray<ISymbol> symbols, CancellationToken cancellationToken)
82ImmutableArray<ISymbol> symbols, Action<Reference> onReferenceFound, CancellationToken cancellationToken)
125private async IAsyncEnumerable<(Project project, ImmutableArray<(ISymbol symbol, SymbolGroup group)> allSymbols)> GetProjectsAndSymbolsToSearchSeriallyAsync(
128Dictionary<ISymbol, SymbolGroup> symbolToGroup,
163private async Task<ImmutableArray<(ISymbol symbol, SymbolGroup group)>> ReportGroupsSeriallyAsync(
164ImmutableArray<ISymbol> symbols, Dictionary<ISymbol, SymbolGroup> symbolToGroup, CancellationToken cancellationToken)
166var result = new FixedSizeArrayBuilder<(ISymbol symbol, SymbolGroup group)>(symbols.Length);
169foreach (var symbol in symbols)
176ISymbol symbol, Dictionary<ISymbol, SymbolGroup> symbolToGroup, CancellationToken cancellationToken)
192foreach (var groupSymbol in group.Symbols)
206ImmutableArray<ISymbol> symbols, CancellationToken cancellationToken)
216Project project, ImmutableArray<(ISymbol symbol, SymbolGroup group)> allSymbols, Action<Reference> onReferenceFound, CancellationToken cancellationToken)
218using var _1 = PooledDictionary<ISymbol, PooledHashSet<string>>.GetInstance(out var symbolToGlobalAliases);
219using var _2 = PooledDictionary<Document, Dictionary<ISymbol, SymbolGroup>>.GetInstance(out var documentToSymbolsWithin);
274Dictionary<ISymbol, SymbolGroup> symbolsToSearchFor,
275Dictionary<ISymbol, PooledHashSet<string>> symbolToGlobalAliases,
319ISymbol symbolToSearchFor, SymbolGroup symbolGroup, FindReferencesDocumentState state, Action<Reference> onReferenceFound)
343ImmutableArray<(ISymbol symbol, SymbolGroup group)> allSymbols,
344PooledDictionary<ISymbol, PooledHashSet<string>> symbolToGlobalAliases,
362private static void FreeGlobalAliases(PooledDictionary<ISymbol, PooledHashSet<string>> symbolToGlobalAliases)
368private static bool InvolvesInheritance(ISymbol symbol)
FindSymbols\FindReferences\FindReferencesSearchEngine.SymbolSet.cs (25)
43public abstract ImmutableArray<ISymbol> GetAllSymbols();
96foreach (var symbol in symbols)
102private static ISymbol? TryMapToAppropriateSymbol(
103Solution solution, ISymbol symbol, CancellationToken cancellationToken)
108var searchSymbol = symbol;
135var sourceSymbol = SymbolFinder.FindSourceDefinition(searchSymbol, solution, cancellationToken);
150using var _ = ArrayBuilder<ISymbol>.GetInstance(out var workQueue);
153foreach (var symbol in symbols)
157while (workQueue.TryPop(out var currentSymbol))
170using var _ = ArrayBuilder<ISymbol>.GetInstance(out var workQueue);
175while (workQueue.TryPop(out var currentSymbol))
185FindReferencesSearchEngine engine, ImmutableArray<ISymbol> symbols, MetadataUnifyingSymbolHashSet seenSymbols, ArrayBuilder<ISymbol> workQueue, CancellationToken cancellationToken)
187foreach (var symbol in symbols)
192FindReferencesSearchEngine engine, ISymbol symbol, MetadataUnifyingSymbolHashSet seenSymbols, ArrayBuilder<ISymbol> workQueue, CancellationToken cancellationToken)
195var mapped = await TryMapAndAddLinkedSymbolsAsync(symbol).ConfigureAwait(false);
210async Task<ISymbol?> TryMapAndAddLinkedSymbolsAsync(ISymbol symbol)
212var mapped = TryMapToAppropriateSymbol(solution, symbol, cancellationToken);
237FindReferencesSearchEngine engine, ISymbol symbol,
238MetadataUnifyingSymbolHashSet seenSymbols, ArrayBuilder<ISymbol> workQueue,
271ISymbol symbol,
273ArrayBuilder<ISymbol> workQueue,
294if (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)
52ISymbol symbol,
129private static ImmutableArray<ISymbol> SymbolsForEnclosingInvocationExpressionWorker(SyntaxNode invocationExpression, SemanticModel semanticModel, CancellationToken cancellationToken)
144private static bool LocalVariableConflictPerLanguage(SyntaxToken tokenOrNode, Document document, ImmutableArray<ISymbol> newReferencedSymbols)
167private static bool IsRenameValid(MutableConflictResolution conflictResolution, ISymbol renamedSymbol)
175ISymbol renamedSymbol,
176ISymbol originalSymbol,
228ISymbol renamedSymbol,
229ISymbol renameSymbol,
230IEnumerable<ISymbol> referencedSymbols,
245IEnumerable<ISymbol> otherThingsNamedTheSameExcludeMethodAndParameterizedProperty;
324private static void AddConflictingSymbolLocations(IEnumerable<ISymbol> conflictingSymbols, MutableConflictResolution conflictResolution, IDictionary<Location, Location> reverseMappedLocations)
326foreach (var newSymbol in conflictingSymbols)
345IEnumerable<ISymbol> symbols,
351foreach (var symbol in symbols)
358var overriddenSymbol = symbol.GetOverriddenMember();
383private static string GetString(ISymbol symbol)
400private static Location? GetSymbolLocation(Solution solution, ISymbol symbol, CancellationToken cancellationToken)
404var 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)
38public static Task<Solution> RenameSymbolAsync(Solution solution, ISymbol symbol, string newName, OptionSet? optionSet, CancellationToken cancellationToken = default)
42Solution solution, ISymbol symbol, SymbolRenameOptions options, string newName, CancellationToken cancellationToken = default)
139internal static Task<LightweightRenameLocations> FindRenameLocationsAsync(Solution solution, ISymbol symbol, SymbolRenameOptions options, CancellationToken cancellationToken)
144ISymbol symbol,
189ISymbol 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;
350var 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 (21)
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
655var overriddenMember = symbol.GetOverriddenMember();
682this 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 (94)
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)
213public static INamedTypeSymbol? GetContainingTypeOrThis(this ISymbol symbol)
223public static bool IsErrorType([NotNullWhen(true)] this ISymbol? symbol)
226public static bool IsModuleType([NotNullWhen(true)] this ISymbol? symbol)
229public static bool IsInterfaceType([NotNullWhen(true)] this ISymbol? symbol)
232public static bool IsArrayType([NotNullWhen(true)] this ISymbol? symbol)
235public static bool IsTupleType([NotNullWhen(true)] this ISymbol? symbol)
238public static bool IsAnonymousFunction([NotNullWhen(true)] this ISymbol? symbol)
241public static bool IsKind([NotNullWhen(true)] this ISymbol? symbol, SymbolKind kind)
244public static bool MatchesKind([NotNullWhen(true)] this ISymbol? symbol, SymbolKind kind)
247public static bool MatchesKind([NotNullWhen(true)] this ISymbol? symbol, SymbolKind kind1, SymbolKind kind2)
253public static bool MatchesKind([NotNullWhen(true)] this ISymbol? symbol, SymbolKind kind1, SymbolKind kind2, SymbolKind kind3)
259public static bool MatchesKind([NotNullWhen(true)] this ISymbol? symbol, params SymbolKind[] kinds)
265public static bool IsReducedExtension([NotNullWhen(true)] this ISymbol? symbol)
268public static bool IsEnumMember([NotNullWhen(true)] this ISymbol? symbol)
271public static bool IsExtensionMethod(this ISymbol symbol)
274public static bool IsLocalFunction([NotNullWhen(true)] this ISymbol? symbol)
277public static bool IsAnonymousOrLocalFunction([NotNullWhen(true)] this ISymbol? symbol)
280public static bool IsModuleMember([NotNullWhen(true)] this ISymbol? symbol)
283public static bool IsConstructor([NotNullWhen(true)] this ISymbol? symbol)
286public static bool IsStaticConstructor([NotNullWhen(true)] this ISymbol? symbol)
289public static bool IsDestructor([NotNullWhen(true)] this ISymbol? symbol)
292public static bool IsUserDefinedOperator([NotNullWhen(true)] this ISymbol? symbol)
295public static bool IsConversion([NotNullWhen(true)] this ISymbol? symbol)
298public static bool IsOrdinaryMethod([NotNullWhen(true)] this ISymbol? symbol)
301public static bool IsOrdinaryMethodOrLocalFunction([NotNullWhen(true)] this ISymbol? symbol)
304public static bool IsDelegateType([NotNullWhen(true)] this ISymbol? symbol)
307public static bool IsAnonymousType([NotNullWhen(true)] this ISymbol? symbol)
310public static bool IsNormalAnonymousType([NotNullWhen(true)] this ISymbol? symbol)
313public static bool IsAnonymousDelegateType([NotNullWhen(true)] this ISymbol? symbol)
316public static bool IsAnonymousTypeProperty([NotNullWhen(true)] this ISymbol? symbol)
319public static bool IsTupleField([NotNullWhen(true)] this ISymbol? symbol)
322public static bool IsIndexer([NotNullWhen(true)] this ISymbol? symbol)
325public static bool IsWriteableFieldOrProperty([NotNullWhen(true)] this ISymbol? symbol)
333public static bool IsRequired([NotNullWhen(true)] this ISymbol? symbol)
336public static ITypeSymbol? GetMemberType(this ISymbol? symbol)
348public static int GetArity(this ISymbol symbol)
357public static ISymbol? GetOriginalUnreducedDefinition(this ISymbol? symbol)
400public static bool IsFunctionValue([NotNullWhen(true)] this ISymbol? symbol)
403public static bool IsThisParameter([NotNullWhen(true)] this ISymbol? symbol)
407public static ISymbol? ConvertThisParameterToType(this ISymbol? symbol)
417public static bool IsParams([NotNullWhen(true)] this ISymbol? symbol)
420public static ImmutableArray<IParameterSymbol> GetParameters(this ISymbol? symbol)
428public static ImmutableArray<ITypeParameterSymbol> GetTypeParameters(this ISymbol? symbol)
436public static ImmutableArray<ITypeParameterSymbol> GetAllTypeParameters(this ISymbol? symbol)
449public static ImmutableArray<ITypeSymbol> GetTypeArguments(this ISymbol? symbol)
457public static ImmutableArray<ITypeSymbol> GetAllTypeArguments(this ISymbol symbol)
472public static bool IsAttribute([NotNullWhen(true)] this ISymbol? symbol)
481public static bool RequiresUnsafeModifier([NotNullWhen(true)] this ISymbol? member)
488this ISymbol? symbol,
531public static bool IsStaticType([NotNullWhen(true)] this ISymbol? symbol)
535[NotNullWhen(true)] this ISymbol? symbol, ISymbol withinType, IAssemblySymbol withinAssembly, CancellationToken cancellationToken)
555public static IEnumerable<IPropertySymbol> GetValidAnonymousTypeProperties(this ISymbol symbol)
561public static Accessibility ComputeResultantAccessibility(this ISymbol? symbol, ITypeSymbol finalDestination)
587public static bool IsInaccessibleLocal(this ISymbol symbol, int position)
605public static bool IsAccessor([NotNullWhen(true)] this ISymbol? symbol)
608public static bool IsPropertyAccessor([NotNullWhen(true)] this ISymbol? symbol)
611public static bool IsEventAccessor([NotNullWhen(true)] this ISymbol? symbol)
614public static bool IsFromSource(this ISymbol symbol)
617public static bool IsNonImplicitAndFromSource(this ISymbol symbol)
620public static ITypeSymbol? GetSymbolType(this ISymbol? symbol)
636public static bool IsAwaitableNonDynamic([NotNullWhen(true)] this ISymbol? symbol, SemanticModel semanticModel, int position)
775public static bool IsKind<TSymbol>(this ISymbol symbol, SymbolKind kind, [NotNullWhen(true)] out TSymbol? result) where TSymbol : class, ISymbol
792public static bool IsSymbolWithSpecialDiscardName(this ISymbol symbol)
801public static bool IsObsolete(this ISymbol symbol)
808public static bool HasAttribute([NotNullWhen(true)] this ISymbol? symbol, [NotNullWhen(true)] INamedTypeSymbol? attributeClass)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions_Accessibility.cs (11)
16this ISymbol symbol,
17ISymbol within,
38this ISymbol symbol,
50this ISymbol symbol,
63ISymbol symbol,
82ISymbol symbol,
83ISymbol within, // must be assembly or named type symbol
173private static bool IsNamedTypeAccessible(INamedTypeSymbol type, ISymbol within)
211ISymbol within)
246ISymbol within,
406ISymbol within,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.cs (13)
404public static bool CanSupportCollectionInitializer(this ITypeSymbol typeSymbol, ISymbol within)
435public static IEnumerable<T> GetAccessibleMembersInBaseTypes<T>(this ITypeSymbol containingType, ISymbol within) where T : class, ISymbol
444public static ImmutableArray<T> GetAccessibleMembersInThisAndBaseTypes<T>(this ITypeSymbol? containingType, ISymbol within) where T : class, ISymbol
454public static ImmutableArray<T> GetAccessibleMembersInThisAndBaseTypes<T>(this ITypeSymbol? containingType, string memberName, ISymbol within) where T : class, ISymbol
499public static IEnumerable<T> SelectAccessibleMembers<T>(this IEnumerable<ITypeSymbol>? types, ISymbol within) where T : class, ISymbol
509private static IEnumerable<T> SelectAccessibleMembers<T>(this IEnumerable<ITypeSymbol>? types, string memberName, ISymbol within) where T : class, ISymbol
694foreach (var member in type.GetMembers())
755public static bool IsReadOnlySpan([NotNullWhen(true)] this ISymbol? symbol)
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)
28private readonly Dictionary<ISymbol, PooledHashSet<IOperation>> _reachingWrites;
62public void Clear(ISymbol symbol)
74public void ForEachCurrentWrite<TArg>(ISymbol symbol, Action<IOperation, TArg> action, TArg arg)
86public bool ForEachCurrentWrite<TArg>(ISymbol symbol, Func<IOperation, TArg, bool> action, TArg arg)
104public void OnWriteReferenceFound(ISymbol symbol, IOperation operation, bool maybeWritten)
130foreach (var key in _reachingWrites.Keys)
223private 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)
21PooledDictionary<(ISymbol symbol, IOperation operation), bool> symbolsWriteMap,
22PooledHashSet<ISymbol> symbolsRead,
32protected override PooledHashSet<ISymbol> SymbolsReadBuilder { get; }
34protected override PooledDictionary<(ISymbol symbol, IOperation operation), bool> SymbolsWriteBuilder { get; }
39ISymbol owningSymbol,
44symbolsRead: PooledHashSet<ISymbol>.GetInstance(),
63public override void OnLValueCaptureFound(ISymbol symbol, IOperation operation, CaptureId captureId)
75public override void SetTargetsFromSymbolForDelegate(IOperation write, ISymbol symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.Walker.cs (13)
26private ISymbol _currentContainingSymbol;
29private PooledDictionary<IAssignmentOperation, PooledHashSet<(ISymbol, IOperation)>> _pendingWritesMap;
35ISymbol containingSymbol,
51private void Visit(ISymbol containingSymbol, IEnumerable<IOperation> operations, AnalysisData analysisData, CancellationToken cancellationToken)
58_pendingWritesMap = PooledDictionary<IAssignmentOperation, PooledHashSet<(ISymbol, IOperation)>>.GetInstance();
90private void OnReadReferenceFound(ISymbol symbol)
93private void OnWriteReferenceFound(ISymbol symbol, IOperation operation, ValueUsageInfo valueUsageInfo)
101private void OnLValueCaptureFound(ISymbol symbol, IOperation operation, CaptureId captureId)
107private void OnReferenceFound(ISymbol symbol, IOperation operation)
159private bool MakePendingWrite(IOperation operation, ISymbol symbolOpt)
166var set = PooledHashSet<(ISymbol, IOperation)>.GetInstance();
175set = PooledHashSet<(ISymbol, IOperation)>.GetInstance();
407private void ProcessPossibleDelegateCreationAssignment(ISymbol symbol, IOperation write)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SemanticFacts\ISemanticFacts.cs (7)
65ISymbol? GetDeclaredSymbol(SemanticModel semanticModel, SyntaxToken token, CancellationToken cancellationToken);
90IEnumerable<ISymbol> GetDeclaredSymbols(SemanticModel semanticModel, SyntaxNode memberDeclaration, CancellationToken cancellationToken);
95ISymbol? FindFieldOrPropertyForArgument(SemanticModel semanticModel, SyntaxNode argument, CancellationToken cancellationToken);
96ISymbol? FindFieldOrPropertyForAttributeArgument(SemanticModel semanticModel, SyntaxNode argument, CancellationToken cancellationToken);
98ImmutableArray<ISymbol> GetBestOrAllSymbols(SemanticModel semanticModel, SyntaxNode? node, SyntaxToken token, CancellationToken cancellationToken);
105ImmutableArray<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)
29/// the "same" <see cref="ISymbol.ContainingType"/> and
30/// equal <see cref="ISymbol.MetadataName"/>.</item>
32/// the "same" <see cref="ISymbol.ContainingType"/>,
33/// equal <see cref="ISymbol.MetadataName"/>,
39/// the "same" <see cref="ISymbol.ContainingAssembly"/>.
40/// <see cref="ISymbol.MetadataName"/> is not used because module identity is not important in practice.</item>
42/// the "same" <see cref="ISymbol.ContainingSymbol"/>,
43/// equal <see cref="ISymbol.MetadataName"/>,
47/// the "same" <see cref="ISymbol.ContainingSymbol"/> and
48/// equal <see cref="ISymbol.MetadataName"/>.
53/// the "same" <see cref="ISymbol.ContainingSymbol"/> and
54/// equal <see cref="ISymbol.MetadataName"/>.</item>
58/// the "same" the "same" <see cref="ISymbol.ContainingType"/>,
59/// the "same" <see cref="ISymbol.MetadataName"/>, and have
63/// the "same" <see cref="ISymbol.ContainingSymbol"/> and
64/// the "same" <see cref="ISymbol.MetadataName"/>.</item>
66/// the "same" <see cref="ISymbol.ContainingSymbol"/> and
67/// the "same" <see cref="ISymbol.MetadataName"/>.</item>
69/// the "same" <see cref="ISymbol.Name"/>.</item>
76/// cref="SyntaxTree"/> is enumerated to list all the symbols with the same <see cref="ISymbol.Name"/> and <see
77/// cref="ISymbol.Kind"/> as the original symbol. The symbol with the same index in the destination tree as the
127public static SymbolKey Create(ISymbol? symbol, CancellationToken cancellationToken = default)
146public 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)
65public TDeclarationNode AddMembers<TDeclarationNode>(TDeclarationNode destination, IEnumerable<ISymbol> members, CodeGenerationContextInfo info, CancellationToken cancellationToken)
115public TDeclarationNode UpdateDeclarationMembers<TDeclarationNode>(TDeclarationNode declaration, IList<ISymbol> newMembers, CodeGenerationContextInfo info, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode
140public abstract TDeclarationNode UpdateDeclarationMembers<TDeclarationNode>(TDeclarationNode declaration, IList<ISymbol> newMembers, TCodeGenerationContextInfo info, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode;
271IEnumerable<ISymbol> members,
294IEnumerable<ISymbol> members,
301foreach (var member in members)
325IEnumerable<ISymbol> members,
333foreach (var member in members)
342private SyntaxNode? GetNewMember(TCodeGenerationContextInfo info, CodeGenerationDestination codeGenerationDestination, ISymbol member, CancellationToken cancellationToken)
358ISymbol member,
373private static bool GeneratingEnum(IEnumerable<ISymbol> members)
455public Task<Document> AddMembersAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IEnumerable<ISymbol> members, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\ICodeGenerationService.cs (4)
83TDeclarationNode AddMembers<TDeclarationNode>(TDeclarationNode destination, IEnumerable<ISymbol> members, CodeGenerationContextInfo info, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode;
123TDeclarationNode UpdateDeclarationMembers<TDeclarationNode>(TDeclarationNode declaration, IList<ISymbol> newMembers, CodeGenerationContextInfo info, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode;
173Task<Document> AddMembersAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IEnumerable<ISymbol> members, CancellationToken cancellationToken);
178bool CanAddTo(ISymbol destination, Solution solution, CancellationToken cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\SyntaxAnnotationExtensions.cs (1)
15where TSymbol : ISymbol
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions.cs (14)
86private static ITypeSymbol GetType(Compilation compilation, ISymbol symbol)
101this SyntaxGenerator generator, IMethodSymbol method, ISymbol throughMember)
116this SyntaxGenerator generator, ISymbol member, ISymbol throughMember)
180static SyntaxNode GenerateContainerName(SyntaxGenerator factory, ISymbol throughMember)
194ISymbol? throughMember,
233ISymbol? throughMember,
277private static bool TryGetValue(IDictionary<string, ISymbol>? dictionary, string key, [NotNullWhen(true)] out string? value)
280if (dictionary != null && dictionary.TryGetValue(key, out var symbol))
289public static ImmutableArray<ISymbol> CreateFieldsForParameters(
292using var _ = ArrayBuilder<ISymbol>.GetInstance(out var result);
311public static ImmutableArray<ISymbol> CreatePropertiesForParameters(
314using var _ = ArrayBuilder<ISymbol>.GetInstance(out var result);
346IDictionary<string, ISymbol>? parameterToExistingFieldMap,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\SemanticsFactsService\AbstractSemanticFactsService.cs (11)
32private static readonly Func<ISymbol, bool> s_LocalNameFilter = s =>
75string baseName, Func<ISymbol, bool> filter,
92protected virtual IEnumerable<ISymbol> GetCollidableSymbols(SemanticModel semanticModel, SyntaxNode location, SyntaxNode container, CancellationToken cancellationToken)
115var impl = type.FindImplementationForInterfaceMember(disposeMethodToLookFor);
198public ISymbol GetDeclaredSymbol(SemanticModel semanticModel, SyntaxToken token, CancellationToken cancellationToken)
228public IEnumerable<ISymbol> GetDeclaredSymbols(SemanticModel semanticModel, SyntaxNode memberDeclaration, CancellationToken cancellationToken)
237public ISymbol FindFieldOrPropertyForArgument(SemanticModel semanticModel, SyntaxNode argumentNode, CancellationToken cancellationToken)
240public ISymbol FindFieldOrPropertyForAttributeArgument(SemanticModel semanticModel, SyntaxNode argumentNode, CancellationToken cancellationToken)
243public ImmutableArray<ISymbol> GetBestOrAllSymbols(SemanticModel semanticModel, SyntaxNode node, SyntaxToken token, CancellationToken cancellationToken)
249public ImmutableArray<IMethodSymbol> GetLocalFunctionSymbols(Compilation compilation, ISymbol symbol, CancellationToken cancellationToken)
266public Task<ISymbol> GetInterceptorSymbolAsync(Document document, int position, CancellationToken cancellationToken)