ChangeSignature\CSharpChangeSignatureService.cs (15)
105public override async Task<(ISymbol? symbol, int selectedIndex)> GetInvocationSymbolAsync(
145var symbol = semanticModel.GetDeclaredSymbol(matchingNode, cancellationToken);
155var typeSymbol = semanticModel.GetSymbolInfo(objectCreation.Type, cancellationToken).Symbol;
281ISymbol declarationSymbol,
503ISymbol declarationSymbol,
540ISymbol declarationSymbol,
681ISymbol declarationSymbol,
704ISymbol declarationSymbol,
720ISymbol declarationSymbol,
758Document document, CSharpSyntaxNode node, ISymbol declarationSymbol, SignatureChange updatedSignature, LineFormattingOptionsProvider fallbackOptions, CancellationToken cancellationToken)
780private ImmutableArray<SyntaxNode> VerifyAndPermuteParamNodes(IEnumerable<XmlElementSyntax> paramNodes, ISymbol declarationSymbol, SignatureChange updatedSignature)
840public override async Task<ImmutableArray<ISymbol>> DetermineCascadedSymbolsFromDelegateInvokeAsync(
858var convertedType = (ISymbol?)semanticModel.GetTypeInfo(node, cancellationToken).ConvertedType;
914protected override ImmutableArray<IParameterSymbol> GetParameters(ISymbol declarationSymbol)
Completion\CompletionProviders\CrefCompletionProvider.cs (14)
93protected override async Task<(SyntaxToken, SemanticModel?, ImmutableArray<ISymbol>)> GetSymbolsAsync(
168private static ImmutableArray<ISymbol> GetSymbols(
180return ImmutableArray<ISymbol>.Empty;
183private static ImmutableArray<ISymbol> GetUnqualifiedSymbols(
186using var _ = ArrayBuilder<ISymbol>.GetInstance(out var result);
199foreach (var member in baseType.GetMembers())
214private static ImmutableArray<ISymbol> GetQualifiedSymbols(
218var leftSymbol = semanticModel.GetSymbolInfo(parent.Container, cancellationToken).Symbol;
222using var _ = ArrayBuilder<ISymbol>.GetInstance(out var result);
241SemanticModel semanticModel, ImmutableArray<ISymbol> symbols, SyntaxToken token, int position, ImmutableDictionary<string, string> options)
249foreach (var symbol in group)
266SemanticModel semanticModel, ISymbol symbol, SyntaxToken token, int position, StringBuilder builder,
284ISymbol symbol,
333private static CompletionItem CreateItemFromBuilder(ISymbol symbol, int position, StringBuilder builder, ImmutableDictionary<string, string> options)
ConvertToRecordHelpers.cs (26)
312var positionalParam = param.ContainingSymbol.ContainingType.GetMembers().FirstOrDefault(member
376var dictionaryBuilder = ImmutableDictionary<ISymbol, ExpressionSyntax>.Empty.ToBuilder();
401ImmutableDictionary<ISymbol, ExpressionSyntax> assignmentValues)
417private static ImmutableDictionary<ISymbol, T> GetAssignmentValuesForConstructor<T>(
422var dictionaryBuilder = ImmutableDictionary<ISymbol, T>.Empty.ToBuilder();
428return ImmutableDictionary<ISymbol, T>.Empty;
443ISymbol? symbol = assignee switch
459return ImmutableDictionary<ISymbol, T>.Empty;
505ISymbol? otherC = null;
531value, successRequirement: true, type, fields, out var _2))
568[NotNullWhen(true)] out ISymbol? assignedVariable)
608private static ISymbol? GetReferencedSymbolObject(IOperation reference)
656ISymbol otherObject)
725ISymbol currentObject,
726ISymbol otherObject,
784ISymbol currentObject,
786[NotNullWhen(true)] out ISymbol? boundVariable,
832bool TryGetBoundVariableForIsPattern(IPatternOperation isPattern, [NotNullWhen(true)] out ISymbol? boundVariable)
853DeclaredSymbol: ISymbol otherVar,
879ISymbol otherC,
917ISymbol currentObject,
918ISymbol otherObject,
921var leftObject = GetReferencedSymbolObject(memberReference1.Instance!);
922var rightObject = GetReferencedSymbolObject(memberReference2.Instance!);
959[NotNullWhen(true)] out ISymbol? otherC,
1123private static IFieldSymbol? UnwrapPropertyToField(ISymbol propertyOrField)
EditAndContinue\CSharpEditAndContinueAnalyzer.cs (33)
178protected override ImmutableArray<ISymbol> GetCapturedVariables(SemanticModel model, SyntaxNode memberBody)
192internal override bool HasParameterClosureScope(ISymbol member)
198protected override IEnumerable<SyntaxNode> GetVariableUseSites(IEnumerable<SyntaxNode> roots, ISymbol localOrParameter, SemanticModel model, CancellationToken cancellationToken)
664internal override void ReportDeclarationInsertDeleteRudeEdits(ArrayBuilder<RudeEditDiagnostic> diagnostics, SyntaxNode oldNode, SyntaxNode newNode, ISymbol oldSymbol, ISymbol newSymbol, EditAndContinueCapabilitiesGrantor capabilities, CancellationToken cancellationToken)
1244protected override OneOrMany<(ISymbol? oldSymbol, ISymbol? newSymbol, EditKind editKind)> GetSymbolEdits(
1253var oldSymbol = (oldNode != null) ? GetSymbolForEdit(oldNode, oldModel!, cancellationToken) : null;
1254var newSymbol = (newNode != null) ? GetSymbolForEdit(newNode, newModel, cancellationToken) : null;
1267return new OneOrMany<(ISymbol?, ISymbol?, EditKind)>((oldSymbol.ContainingSymbol, newSymbol.ContainingSymbol, EditKind.Update));
1273return new OneOrMany<(ISymbol?, ISymbol?, EditKind)>((oldSymbol, newSymbol, EditKind.Update));
1284return OneOrMany<(ISymbol?, ISymbol?, EditKind)>.Empty;
1321using var _ = ArrayBuilder<(ISymbol?, ISymbol?, EditKind)>.GetInstance(out var builder);
1353OneOrMany<(ISymbol?, ISymbol?, EditKind)> GetFieldSymbolUpdates(SeparatedSyntaxList<VariableDeclaratorSyntax> oldVariables, SeparatedSyntaxList<VariableDeclaratorSyntax> newVariables)
1381return OneOrMany<(ISymbol?, ISymbol?, EditKind)>.Empty;
1420? OneOrMany<(ISymbol?, ISymbol?, EditKind)>.Empty
1425OneOrMany<(ISymbol?, ISymbol?, EditKind)>.Empty : new OneOrMany<(ISymbol?, ISymbol?, EditKind)>((oldSymbol, newSymbol, editKind));
1428private static ISymbol? GetSymbolForEdit(
1451var symbol = model.GetDeclaredSymbol(node, cancellationToken);
2479internal override void ReportInsertedMemberSymbolRudeEdits(ArrayBuilder<RudeEditDiagnostic> diagnostics, ISymbol newSymbol, SyntaxNode newNode, bool insertingIntoExistingContainingType)
3090protected override bool IsRudeEditDueToPrimaryConstructor(ISymbol symbol, CancellationToken cancellationToken)
3101var container = symbol.ContainingSymbol;
3126static bool IsTypeWithPrimaryConstructor(ISymbol container, CancellationToken cancellationToken)
ImplementInterface\AbstractChangeImplementationCodeRefactoringProvider.cs (11)
28using MemberImplementationMap = OrderedMultiDictionary<ISymbol, ISymbol>;
44protected abstract bool CheckMemberCanBeConverted(ISymbol member);
45protected abstract SyntaxNode ChangeImplementation(SyntaxGenerator generator, SyntaxNode currentDecl, ISymbol implMember, ISymbol interfaceMember);
46protected abstract Task UpdateReferencesAsync(Project project, SolutionEditor solutionEditor, ISymbol implMember, INamedTypeSymbol containingType, CancellationToken cancellationToken);
59var member = semanticModel.GetDeclaredSymbol(container, cancellationToken);
192foreach (var interfaceMember in interfaceType.GetMembers())
194var impl = containingType.FindImplementationForInterfaceMember(interfaceMember);
228var documentToImplDeclarations = new OrderedMultiDictionary<Document, (SyntaxNode, ISymbol impl, SetWithInsertionOrder<ISymbol> interfaceMembers)>();
NavigationBar\CSharpNavigationBarItemService.cs (6)
68foreach (var member in type.GetMembers())
139var type = GetType(semanticModel, node, cancellationToken);
166private static ISymbol? GetType(SemanticModel semanticModel, SyntaxNode node, CancellationToken cancellationToken)
174private static bool IsAccessor(ISymbol member)
187Solution solution, ISymbol member, SyntaxTree tree, CancellationToken cancellationToken)
202Solution solution, ISymbol symbol, SyntaxTree tree, CancellationToken cancellationToken)
AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (17)
71protected virtual void HandleNamedTypeSymbolStart(SymbolStartAnalysisContext context, Action<ISymbol, ValueUsageInfo> onSymbolUsageFound)
81private readonly Dictionary<ISymbol, ValueUsageInfo> _symbolValueUsageStateMap = new();
178Action<ISymbol, ValueUsageInfo> onSymbolUsageFound = OnSymbolUsage;
206var symbol = symbolContext.Symbol.OriginalDefinition;
242private void OnSymbolUsage(ISymbol memberSymbol, ValueUsageInfo usageInfo)
261private bool TryRemove(ISymbol memberSymbol, out ValueUsageInfo valueUsageInfo)
278var memberSymbol = memberReference.Member.OriginalDefinition;
364foreach (var symbol in symbolInfo.GetAllSymbols())
403PooledHashSet<ISymbol> symbolsReferencedInDocComments = null;
410foreach (var member in namedType.GetMembers())
494ISymbol member)
536private PooledHashSet<ISymbol> GetCandidateSymbolsReferencedInDocComments(INamedTypeSymbol namedTypeSymbol, Compilation compilation, CancellationToken cancellationToken)
538var builder = PooledHashSet<ISymbol>.GetInstance();
547var symbol = lazyModel.GetSymbolInfo(node, cancellationToken).Symbol?.OriginalDefinition;
569foreach (var member in namedTypeSymbol.GetMembers())
585private void AddDebuggerDisplayAttributeArgumentsCore(ISymbol symbol, ArrayBuilder<string> builder)
610private bool IsCandidateSymbol(ISymbol memberSymbol)
AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.BlockAnalyzer.cs (7)
31/// We use this value in <see cref="ShouldAnalyze(IOperation, ISymbol, ref bool)"/> to determine whether to bail from analysis or not.
44/// We use this value in <see cref="ShouldAnalyze(IOperation, ISymbol, ref bool)"/> to determine whether to bail from analysis or not.
50/// We use this value in <see cref="ShouldAnalyze(IOperation, ISymbol, ref bool)"/> to determine whether to bail from analysis or not.
219/// delegate escape, and corresponding bail out from flow analysis in <see cref="ShouldAnalyze(IOperation, ISymbol, ref bool)"/>.
267/// delegate escape, and corresponding bail out from flow analysis in <see cref="ShouldAnalyze(IOperation, ISymbol, ref bool)"/>.
332private bool ShouldAnalyze(IOperation operationBlock, ISymbol owningSymbol, ref bool hasOperationNoneDescendant)
551ISymbol symbol,
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)
169IBlockOperation containingBlock, IConditionalOperation ifOperation, ISymbol localOrParameter,
191if (!TryGetLocalOrParameterSymbol(assignmentExpression.Value, out var assignmentValue))
211[NotNullWhen(true)] out ISymbol? localOrParameter)
243[NotNullWhen(true)] out ISymbol? localOrParameter)
ChangeSignature\AbstractChangeSignatureService.cs (17)
40public abstract Task<(ISymbol? symbol, int selectedIndex)> GetInvocationSymbolAsync(Document document, int position, bool restrictToDeclarations, CancellationToken cancellationToken);
48public abstract Task<ImmutableArray<ISymbol>> DetermineCascadedSymbolsFromDelegateInvokeAsync(
53ISymbol declarationSymbol,
86protected abstract ImmutableArray<IParameterSymbol> GetParameters(ISymbol declarationSymbol);
225ISymbol symbol,
253var declaredSymbol = context.Symbol;
256var definitionToUse = new Dictionary<SyntaxNode, ISymbol>();
289var symbolWithSyntacticParameters = symbol.Definition;
290var symbolWithSemanticParameters = symbol.Definition;
438private static void AddUpdatableNodeToDictionaries(Dictionary<DocumentId, List<SyntaxNode>> nodesToUpdate, DocumentId documentId, SyntaxNode nodeToUpdate, Dictionary<SyntaxNode, ISymbol> definitionToUse, ISymbol symbolWithSemanticParameters)
441if (definitionToUse.TryGetValue(nodeToUpdate, out var sym) && sym != symbolWithSemanticParameters)
464ISymbol declarationSymbol,
574private SignatureChange UpdateSignatureChangeToIncludeExtraParametersFromTheDeclarationSymbol(ISymbol declarationSymbol, SignatureChange updatedSignature)
754ISymbol declarationSymbol,
944foreach (var symbol in fullyOrderedSymbols)
1035protected static bool IsParamsArrayExpandedHelper(ISymbol symbol, int argumentCount, bool lastArgumentIsNamed, SemanticModel semanticModel, SyntaxNode lastArgumentExpression, CancellationToken cancellationToken)
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.GlobalSuppressMessageFixAllCodeAction.cs (13)
29private readonly IEnumerable<KeyValuePair<ISymbol, ImmutableArray<Diagnostic>>> _diagnosticsBySymbol;
35IEnumerable<KeyValuePair<ISymbol, ImmutableArray<Diagnostic>>> diagnosticsBySymbol,
160private static async Task<IEnumerable<KeyValuePair<ISymbol, ImmutableArray<Diagnostic>>>> CreateDiagnosticsBySymbolAsync(AbstractSuppressionCodeFixProvider fixer, IEnumerable<KeyValuePair<Document, ImmutableArray<Diagnostic>>> diagnosticsByDocument, CancellationToken cancellationToken)
162var diagnosticsMapBuilder = ImmutableDictionary.CreateBuilder<ISymbol, List<Diagnostic>>();
171var targetSymbol = suppressionTargetInfo.TargetSymbol;
181private static async Task<IEnumerable<KeyValuePair<ISymbol, ImmutableArray<Diagnostic>>>> CreateDiagnosticsBySymbolAsync(Project project, ImmutableArray<Diagnostic> diagnostics, CancellationToken cancellationToken)
183var diagnosticsMapBuilder = ImmutableDictionary.CreateBuilder<ISymbol, List<Diagnostic>>();
198private static void AddDiagnosticForSymbolIfNeeded(ISymbol targetSymbol, Diagnostic diagnostic, ImmutableDictionary<ISymbol, List<Diagnostic>>.Builder diagnosticsMapBuilder)
214private static IEnumerable<KeyValuePair<ISymbol, ImmutableArray<Diagnostic>>> CreateDiagnosticsBySymbol(ImmutableDictionary<ISymbol, List<Diagnostic>>.Builder diagnosticsMapBuilder)
218return SpecializedCollections.EmptyEnumerable<KeyValuePair<ISymbol, ImmutableArray<Diagnostic>>>();
221var builder = new List<KeyValuePair<ISymbol, ImmutableArray<Diagnostic>>>();
Completion\CommonCompletionUtilities.cs (8)
91ISymbol symbol,
98SolutionServices workspaceServices, SemanticModel semanticModel, int position, SymbolDescriptionOptions options, IReadOnlyList<ISymbol> symbols)
104SolutionServices workspaceServices, SemanticModel semanticModel, int position, IReadOnlyList<ISymbol> symbols, SymbolDescriptionOptions options, SupportedPlatformData supportedPlatforms)
110SolutionServices workspaceServices, SemanticModel semanticModel, int position, ISymbol symbol, int overloadCount, SymbolDescriptionOptions options, SupportedPlatformData? supportedPlatforms, CancellationToken cancellationToken)
175SolutionServices workspaceServices, SemanticModel semanticModel, int position, IReadOnlyList<ISymbol> symbols, SymbolDescriptionOptions options, SupportedPlatformData? supportedPlatforms, CancellationToken cancellationToken)
179var symbol = symbols.FirstOrDefault(s => !s.IsObsolete()) ?? symbols[0];
198List<TaggedText> textContentBuilder, ISymbol symbol, SemanticModel semanticModel, int position, IDocumentationCommentFormattingService formatter, CancellationToken cancellationToken)
232public static bool TryRemoveAttributeSuffix(ISymbol symbol, SyntaxContext context, [NotNullWhen(true)] out string? name)
Completion\Providers\AbstractSymbolCompletionProvider.cs (7)
31protected abstract (string displayText, string suffix, string insertionText) GetDisplayAndSuffixAndInsertionText(ISymbol symbol, TSyntaxContext context);
52ISymbol symbol,
104Dictionary<ISymbol, List<ProjectId>>? invalidProjectMap,
170private static SupportedPlatformData? ComputeSupportedPlatformData(CompletionContext completionContext, ImmutableArray<SymbolAndSelectionInfo> symbols, Dictionary<ISymbol, List<ProjectId>>? invalidProjectMap, List<ProjectId>? totalProjects)
211protected static string GetFilterTextDefault(ISymbol symbol, string displayText, TSyntaxContext context)
361private static Dictionary<ISymbol, List<ProjectId>> FindSymbolsMissingInLinkedContexts(
365var missingSymbols = new Dictionary<ISymbol, List<ProjectId>>(LinkedFilesSymbolEquivalenceComparer.Instance);
Completion\Providers\SymbolCompletionItem.cs (21)
23private static readonly Func<IReadOnlyList<ISymbol>, CompletionItem, CompletionItem> s_addSymbolEncoding = AddSymbolEncoding;
24private static readonly Func<IReadOnlyList<ISymbol>, CompletionItem, CompletionItem> s_addSymbolInfo = AddSymbolInfo;
30IReadOnlyList<ISymbol> symbols,
33Func<IReadOnlyList<ISymbol>, CompletionItem, CompletionItem> symbolEncoder,
54var firstSymbol = symbols[0];
73public static CompletionItem AddSymbolEncoding(IReadOnlyList<ISymbol> symbols, CompletionItem item)
76public static CompletionItem AddSymbolInfo(IReadOnlyList<ISymbol> symbols, CompletionItem item)
78var symbol = symbols[0];
100public static string EncodeSymbols(IReadOnlyList<ISymbol> symbols)
116public static string EncodeSymbol(ISymbol symbol)
124public static async Task<ImmutableArray<ISymbol>> GetSymbolsAsync(CompletionItem item, Document document, CancellationToken cancellationToken)
129using var _ = ArrayBuilder<ISymbol>.GetInstance(out var symbols);
152return ImmutableArray<ISymbol>.Empty;
155private static void DecodeSymbols(List<string> ids, Compilation compilation, ArrayBuilder<ISymbol> symbols)
160var symbol = DecodeSymbol(id, compilation);
173private static ISymbol? DecodeSymbol(string id, Compilation compilation)
184CompletionItem item, Document document, ImmutableArray<ISymbol> symbols, SymbolDescriptionOptions options, CancellationToken cancellationToken)
268IReadOnlyList<ISymbol> symbols,
300IReadOnlyList<ISymbol> symbols,
324IReadOnlyList<ISymbol> symbols,
355CompletionItem item, IReadOnlyList<ISymbol> symbols, Document document, SemanticModel semanticModel, SymbolDescriptionOptions options, CancellationToken cancellationToken)
DocumentationComments\AbstractDocumentationCommentFormattingService.cs (5)
84internal ISymbol TypeResolutionSymbol { get; set; }
290public ImmutableArray<TaggedText> Format(string rawXmlText, ISymbol symbol, SemanticModel semanticModel, int position, SymbolDisplayFormat format, CancellationToken cancellationToken)
456var symbol = DocumentationCommentId.GetFirstSymbolForDeclarationId(crefAttribute.Value, semanticModel.Compilation);
510var symbol = DocumentationCommentId.GetFirstSymbolForDeclarationId(crefValue, semanticModel.Compilation);
529string crefValue, ISymbol typeResolutionSymbol, int position, SemanticModel semanticModel, SymbolDisplayFormat format)
EditAndContinue\AbstractEditAndContinueAnalyzer.cs (101)
274protected abstract OneOrMany<(ISymbol? oldSymbol, ISymbol? newSymbol, EditKind editKind)> GetSymbolEdits(
287protected abstract ImmutableArray<ISymbol> GetCapturedVariables(SemanticModel model, SyntaxNode memberBody);
292protected abstract IEnumerable<SyntaxNode> GetVariableUseSites(IEnumerable<SyntaxNode> roots, ISymbol localOrParameter, SemanticModel model, CancellationToken cancellationToken);
328internal string GetDisplayName(ISymbol symbol)
418internal abstract void ReportInsertedMemberSymbolRudeEdits(ArrayBuilder<RudeEditDiagnostic> diagnostics, ISymbol newSymbol, SyntaxNode newNode, bool insertingIntoExistingContainingType);
441internal abstract bool HasParameterClosureScope(ISymbol member);
736internal virtual void ReportDeclarationInsertDeleteRudeEdits(ArrayBuilder<RudeEditDiagnostic> diagnostics, SyntaxNode oldNode, SyntaxNode newNode, ISymbol oldSymbol, ISymbol newSymbol, EditAndContinueCapabilitiesGrantor capabilities, CancellationToken cancellationToken)
949ISymbol oldSymbol,
950ISymbol newSymbol,
2281protected static bool SymbolsEquivalent(ISymbol oldSymbol, ISymbol newSymbol)
2342ISymbol? oldMember,
2343ISymbol? newMember,
2397protected virtual bool IsRudeEditDueToPrimaryConstructor(ISymbol symbol, CancellationToken cancellationToken)
2435using var _1 = PooledHashSet<ISymbol>.GetInstance(out var processedSymbols);
2460var symbol = newSymbol ?? oldSymbol;
2473var oldSymbolInNewCompilation = SymbolKey.Create(oldSymbol, cancellationToken).Resolve(newCompilation, ignoreAssemblyKey: true, cancellationToken).Symbol;
2474var newSymbolInOldCompilation = SymbolKey.Create(newSymbol, cancellationToken).Resolve(oldCompilation, ignoreAssemblyKey: true, cancellationToken).Symbol;
2738var newContainingSymbol = containingSymbolKey.Resolve(newCompilation, ignoreAssemblyKey: true, cancellationToken).Symbol;
3339(SyntaxNode? oldDeclaration, SyntaxNode? newDeclaration) GetSymbolDeclarationNodes(ISymbol? oldSymbol, ISymbol? newSymbol, SyntaxNode? oldNode, SyntaxNode? newNode)
3356private bool TryAddParameterInsertOrDeleteEdits(ArrayBuilder<SemanticEditInfo> semanticEdits, ISymbol containingSymbol, SemanticModel? otherModel, EditAndContinueCapabilitiesGrantor capabilities, Func<SyntaxNode, SyntaxNode?>? syntaxMap, EditScript<SyntaxNode> editScript, HashSet<ISymbol> processedSymbols, CancellationToken cancellationToken, out bool notSupportedByRuntime)
3401var otherContainingSymbol = otherModel.GetDeclaredSymbol(otherContainingNode, cancellationToken);
3409var oldSymbol = (otherContainingNode == oldNode) ? otherContainingSymbol : containingSymbol;
3410var newSymbol = (otherContainingNode == oldNode) ? containingSymbol : otherContainingSymbol;
3435private static bool AllowsDeletion(ISymbol symbol)
3475private static void AddMemberOrAssociatedMemberSemanticEdits(ArrayBuilder<SemanticEditInfo> semanticEdits, SemanticEditKind editKind, ISymbol symbol, SymbolKey? containingSymbolKey, Func<SyntaxNode, SyntaxNode?>? syntaxMap, SymbolKey? partialType, HashSet<ISymbol>? processedSymbols, CancellationToken cancellationToken)
3541void AddEdit(ISymbol? symbol)
3551private ImmutableArray<(ISymbol? oldSymbol, ISymbol? newSymbol, EditKind editKind)> GetNamespaceSymbolEdits(
3556using var _1 = ArrayBuilder<(ISymbol? oldSymbol, ISymbol? newSymbol, EditKind editKind)>.GetInstance(out var builder);
3580var newType = SymbolKey.Create(oldType, cancellationToken).Resolve(newModel.Compilation, ignoreAssemblyKey: true, cancellationToken).Symbol;
3613var oldType = SymbolKey.Create(newType, cancellationToken).Resolve(oldModel.Compilation, ignoreAssemblyKey: true, cancellationToken).Symbol;
3686ISymbol oldSymbol,
3687ISymbol newSymbol,
4179ISymbol oldSymbol,
4180ISymbol newSymbol,
4188HashSet<ISymbol>? processedSymbols,
4235ISymbol oldSymbol,
4236ISymbol newSymbol,
4280private static void AddParameterUpdateSemanticEdit(ArrayBuilder<SemanticEditInfo> semanticEdits, IParameterSymbol oldParameterSymbol, IParameterSymbol newParameterSymbol, Func<SyntaxNode, SyntaxNode?>? syntaxMap, bool reportDeleteAndInsertEdits, HashSet<ISymbol>? processedSymbols, CancellationToken cancellationToken)
4282var newContainingSymbol = newParameterSymbol.ContainingSymbol;
4286var oldContainingSymbol = oldParameterSymbol.ContainingSymbol;
4308var beginInvokeMethod = delegateType.GetMembers("BeginInvoke").FirstOrDefault();
4317ISymbol oldSymbol,
4318ISymbol newSymbol,
4348ISymbol oldSymbol,
4349ISymbol newSymbol,
4504private bool CanAddNewMember(ISymbol newSymbol, EditAndContinueCapabilitiesGrantor capabilities, CancellationToken cancellationToken)
4523foreach (var member in GetRecordUpdatedSynthesizedMembers(compilation, recordType))
4530private static IEnumerable<ISymbol> GetRecordUpdatedSynthesizedMembers(Compilation compilation, INamedTypeSymbol record)
4577ISymbol oldSymbol,
4602private void ReportUpdateRudeEdit(ArrayBuilder<RudeEditDiagnostic> diagnostics, RudeEditKind rudeEdit, ISymbol newSymbol, SyntaxNode? newNode, CancellationToken cancellationToken)
4624private void ReportUpdateRudeEdit(ArrayBuilder<RudeEditDiagnostic> diagnostics, RudeEditKind rudeEdit, ISymbol oldSymbol, ISymbol newSymbol, SyntaxNode? newNode, Compilation newCompilation, CancellationToken cancellationToken)
4636private static SyntaxNode GetRudeEditDiagnosticNode(ISymbol symbol, CancellationToken cancellationToken)
4638var container = symbol;
4652private static SyntaxNode GetDeleteRudeEditDiagnosticNode(ISymbol oldSymbol, Compilation newCompilation, CancellationToken cancellationToken)
4654var oldContainer = oldSymbol.ContainingSymbol;
4658var newContainer = containerKey.Resolve(newCompilation, ignoreAssemblyKey: true, cancellationToken).Symbol;
4674ISymbol newSymbol,
4709private void ReportTypeLayoutUpdateRudeEdits(ArrayBuilder<RudeEditDiagnostic> diagnostics, ISymbol symbol, SyntaxNode syntax)
4861Roslyn.Utilities.IReadOnlySet<ISymbol> processedSymbols,
4904ISymbol? oldCtor;
5070foreach (var member in type.GetMembers())
5087private static ISymbol? TryGetParameterlessConstructor(INamedTypeSymbol type, bool isStatic)
5100private static bool IsPartialEdit(ISymbol? oldSymbol, ISymbol? newSymbol, SyntaxTree oldSyntaxTree, SyntaxTree newSyntaxTree)
5120ISymbol newMember,
5233using var _11 = PooledDictionary<ISymbol, int>.GetInstance(out var oldCapturesIndex);
5234using var _12 = PooledDictionary<ISymbol, int>.GetInstance(out var newCapturesIndex);
5262var newCapture = newCaptures[newCaptureIndex];
5415ImmutableArray<ISymbol> captures,
5416ImmutableArray<ISymbol> newCaptures,
5418PooledDictionary<ISymbol, int> capturesIndex,
5477private BitVector GetAccessedCaptures(SyntaxNode lambdaBody, SemanticModel model, ImmutableArray<ISymbol> captures, PooledDictionary<ISymbol, int> capturesIndex)
5491private static void MarkVariables(ref BitVector mask, ImmutableArray<ISymbol> variables, Dictionary<ISymbol, int> index)
5493foreach (var variable in variables)
5516private static TextSpan GetThisParameterDiagnosticSpan(ISymbol member)
5519private static TextSpan GetVariableDiagnosticSpan(ISymbol local)
5565ImmutableArray<ISymbol> oldCaptures,
5567ImmutableArray<ISymbol> newCaptures,
5568ISymbol newMember,
5614var oldCapture = oldCaptures[i];
5628var newCapture = newCaptures[newCaptureIndex];
5684var oldCapture = oldCaptures[oldCaptureIndex];
5767var oldCapture = oldCaptures[oldCaptureIndex];
5901private static ITypeSymbol GetType(ISymbol localOrParameter)
5909private SyntaxNode GetCapturedVariableScope(ISymbol localOrParameter, SyntaxNode memberBody, CancellationToken cancellationToken)
5915var member = localOrParameter.ContainingSymbol;
5957ISymbol oldMember,
6052private static bool IsGlobalMain(ISymbol symbol)
6055private static bool InGenericContext(ISymbol symbol, out bool isGenericMethod)
6057var current = symbol;
ExtractMethod\MethodExtractor.Analyzer.cs (40)
52protected abstract VariableInfo CreateFromSymbol(Compilation compilation, ISymbol symbol, ITypeSymbol type, VariableStyle variableStyle, bool variableDeclared);
235IDictionary<ISymbol, VariableInfo> variableInfoMap,
276SemanticModel model, Dictionary<ISymbol, List<SyntaxToken>> symbolMap,
277IList<VariableInfo> parameters, IList<ISymbol> failedVariables,
349private Dictionary<ISymbol, List<SyntaxToken>> GetSymbolMap(SemanticModel model)
357private static bool ContainsVariableUnsafeAddressTaken(DataFlowAnalysis dataFlowAnalysisData, IEnumerable<ISymbol> symbols)
360var map = new HashSet<ISymbol>(dataFlowAnalysisData.UnsafeAddressTaken);
412Dictionary<ISymbol, List<SyntaxToken>> symbolMap,
413out IDictionary<ISymbol, VariableInfo> variableInfoMap,
414out List<ISymbol> failedVariables)
419variableInfoMap = new Dictionary<ISymbol, VariableInfo>();
420failedVariables = new List<ISymbol>();
423var capturedMap = new HashSet<ISymbol>(dataFlowAnalysisData.Captured);
424var dataFlowInMap = new HashSet<ISymbol>(dataFlowAnalysisData.DataFlowsIn);
425var dataFlowOutMap = new HashSet<ISymbol>(dataFlowAnalysisData.DataFlowsOut);
426var alwaysAssignedMap = new HashSet<ISymbol>(dataFlowAnalysisData.AlwaysAssigned);
427var variableDeclaredMap = new HashSet<ISymbol>(dataFlowAnalysisData.VariablesDeclared);
428var readInsideMap = new HashSet<ISymbol>(dataFlowAnalysisData.ReadInside);
429var writtenInsideMap = new HashSet<ISymbol>(dataFlowAnalysisData.WrittenInside);
430var readOutsideMap = new HashSet<ISymbol>(dataFlowAnalysisData.ReadOutside);
431var writtenOutsideMap = new HashSet<ISymbol>(dataFlowAnalysisData.WrittenOutside);
432var unsafeAddressTakenMap = new HashSet<ISymbol>(dataFlowAnalysisData.UnsafeAddressTaken);
435var candidates = new HashSet<ISymbol>(readInsideMap);
439foreach (var symbol in candidates)
512private static void AddVariableToMap(IDictionary<ISymbol, VariableInfo> variableInfoMap, ISymbol localOrParameter, VariableInfo variableInfo)
517Dictionary<ISymbol, List<SyntaxToken>> symbolMap,
518ISymbol symbol,
580Dictionary<ISymbol, List<SyntaxToken>> symbolMap, SemanticModel model, ISymbol symbol, bool writtenInside)
640protected virtual ITypeSymbol GetSymbolType(SemanticModel model, ISymbol symbol)
674private static bool IsThisParameter(ISymbol localOrParameter)
684private static bool IsInteractiveSynthesizedParameter(ISymbol localOrParameter)
730IDictionary<ISymbol, VariableInfo> variableInfoMap,
733foreach (var symbol in variableInfoMap.Keys)
783private static void AppendMethodTypeParameterUsedDirectly(IDictionary<ISymbol, List<SyntaxToken>> symbolMap, IDictionary<int, ITypeParameterSymbol> sortedMap)
800IDictionary<ISymbol, VariableInfo> variableInfoMap,
801IDictionary<ISymbol, List<SyntaxToken>> symbolMap,
907private OperationStatus CheckReadOnlyFields(SemanticModel semanticModel, Dictionary<ISymbol, List<SyntaxToken>> symbolMap)
944ISymbol symbol,
FindUsages\AbstractFindUsagesService_FindImplementations.cs (18)
41IFindUsagesContext context, ISymbol symbol, Project project, CancellationToken cancellationToken)
68ISymbol symbol, Project project, IFindUsagesContext context, 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);
111foreach (var linkedSymbol in linkedSymbols)
115foreach (var implementation in implementations)
124static bool AddedAllLocations(ISymbol implementation, HashSet<(string filePath, TextSpan span)> seenLocations)
136private static async Task<ImmutableArray<ISymbol>> FindImplementationsWorkerAsync(
137Solution solution, ISymbol symbol, CancellationToken cancellationToken)
140var result = new HashSet<ISymbol>(implementations.Select(s => s.OriginalDefinition));
146foreach (var ov in overrides)
148for (var overridden = ov.GetOverriddenMember(); overridden != null; overridden = overridden.GetOverriddenMember())
158private static async Task<ImmutableArray<ISymbol>> FindSourceAndMetadataImplementationsAsync(
159Solution solution, ISymbol symbol, CancellationToken cancellationToken)
169var implementationsAndOverrides = new HashSet<ISymbol>();
171foreach (var implementation in implementations)
FindUsages\IDefinitionsAndReferencesFactory.cs (8)
59this ISymbol definition,
65this ISymbol definition,
72ISymbol definition,
81this ISymbol definition,
99var definition = group.Symbols.First();
109ISymbol definition,
161private static ImmutableArray<DocumentSpan> TryGetSourceLocations(ISymbol definition, Solution solution, ImmutableArray<Location> locations, bool includeHiddenLocations)
209private static ImmutableDictionary<string, string> GetProperties(ISymbol definition, bool isPrimary)
GenerateEqualsAndGetHashCodeFromMembers\GenerateEqualsAndGetHashCodeFromMembersCodeRefactoringProvider.cs (5)
106.SelectAccessibleMembers<ISymbol>(containingType)
202Document document, SyntaxNode typeDeclaration, INamedTypeSymbol containingType, ImmutableArray<ISymbol> selectedMembers,
242Document document, SyntaxNode typeDeclaration, INamedTypeSymbol containingType, ImmutableArray<ISymbol> members,
252Document document, SyntaxNode typeDeclaration, INamedTypeSymbol containingType, ImmutableArray<ISymbol> members,
291Document 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);
ImplementAbstractClass\ImplementAbstractClassData.cs (20)
30private readonly ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)> _unimplementedMembers;
38ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)> unimplementedMembers)
90ISymbol? throughMember, bool? canDelegateAllMembers, CancellationToken cancellationToken)
127private ImmutableArray<ISymbol> GenerateMembers(
128Compilation compilation, ISymbol? throughMember,
139private ISymbol? GenerateMember(
140Compilation compilation, ISymbol member, ISymbol? throughMember,
153private ISymbol? GenerateMember(
154Compilation compilation, ISymbol member, ISymbol? throughMember, bool addUnsafe,
177private ISymbol GenerateMethod(
178Compilation compilation, IMethodSymbol method, ISymbol? throughMember,
199ISymbol? throughMember,
240IEventSymbol @event, ISymbol? throughMember, Accessibility accessibility, DeclarationModifiers modifiers)
250IEventSymbol @event, IMethodSymbol? accessor, ISymbol? throughMember,
271public IEnumerable<(ISymbol symbol, bool canDelegateAllMembers)> GetDelegatableMembers()
277.OfType<ISymbol>();
283.OfType<ISymbol>();
288foreach (var fieldOrProp in fields.Concat(properties))
ImplementInterface\AbstractImplementInterfaceService.CodeAction.cs (34)
31protected readonly ISymbol? ThroughMember;
46ISymbol? throughMember)
91ISymbol throughMember)
140ISymbol? throughMember,
176ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)> unimplementedMembers,
183ImmutableArray<ISymbol>.Empty, cancellationToken);
188ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)> unimplementedMembers,
191ImmutableArray<ISymbol> extraMembers,
221private ImmutableArray<ISymbol> GenerateMembers(
224ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)> unimplementedMembers,
241using var _1 = ArrayBuilder<ISymbol>.GetInstance(out var implementedVisibleMembers);
242using var _2 = ArrayBuilder<ISymbol>.GetInstance(out var implementedMembers);
246foreach (var unimplementedInterfaceMember in unimplementedInterfaceMembers)
252foreach (var member in members)
275private string DetermineMemberName(ISymbol member, ArrayBuilder<ISymbol> implementedVisibleMembers)
279var memberNames = State.ClassOrStructType.GetAccessibleMembersInThisAndBaseTypes<ISymbol>(State.ClassOrStructType).Select(m => m.Name);
291private IEnumerable<ISymbol?> GenerateMembers(
294ISymbol member,
295ArrayBuilder<ISymbol> implementedVisibleMembers,
310return SpecializedCollections.EmptyEnumerable<ISymbol?>();
337private bool ShouldGenerateInvisibleMember(ParseOptions options, ISymbol member, string memberName)
365private bool HasUnexpressibleConstraint(ParseOptions options, ISymbol member)
392private IEnumerable<ISymbol?> GenerateMembers(
394ISymbol member,
416foreach (var generated in GeneratePropertyMembers(compilation, property, accessibility, modifiers, generateAbstractly, useExplicitInterfaceSymbol, memberName, propertyGenerationBehavior))
425private ISymbol GenerateEvent(Compilation compilation, string memberName, bool generateInvisibly, SyntaxGenerator factory, DeclarationModifiers modifiers, bool useExplicitInterfaceSymbol, Accessibility accessibility, IEventSymbol @event)
463ISymbol member,
477private static bool HasNameConflict(ISymbol member, ISymbol baseMember)
500private bool HasMatchingMember(ArrayBuilder<ISymbol> implementedVisibleMembers, ISymbol member)
525private bool MembersMatch(ISymbol member1, ISymbol member2)
ImplementInterface\AbstractImplementInterfaceService.DisposePatternCodeAction.cs (6)
46foreach (var member in idisposableMembers)
98ISymbol? throughMember) : base(service, document, options, state, explicitly, abstractly, onlyRemaining: !explicitly, throughMember)
127ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)> unimplementedMembers,
146extraMembers: ImmutableArray.Create<ISymbol>(disposedValueField),
202private (ImmutableArray<ISymbol>, SyntaxNode) CreateDisposableMethods(
220return (ImmutableArray.Create<ISymbol>(disposeImplMethod, disposeInterfaceMethod), finalizer);
InheritanceMargin\AbstractInheritanceMarginService_Helpers.cs (37)
27using SymbolAndLineNumberArray = ImmutableArray<(ISymbol symbol, int lineNumber)>;
91using var _ = ArrayBuilder<(ISymbol symbol, int lineNumber)>.GetInstance(out var builder);
97var member = semanticModel.GetDeclaredSymbol(memberDeclarationNode, cancellationToken);
309baseSymbols: baseSymbols.CastArray<ISymbol>(),
310derivedTypesSymbols: derivedSymbols.CastArray<ISymbol>(),
321baseSymbols: baseSymbols.CastArray<ISymbol>(),
322derivedTypesSymbols: derivedSymbols.CastArray<ISymbol>(),
331ISymbol memberSymbol,
390ImmutableArray<ISymbol> baseSymbols,
391ImmutableArray<ISymbol> derivedTypesSymbols,
426ISymbol memberSymbol,
428ImmutableArray<ISymbol> implementingMembers,
453ImmutableArray<ISymbol> baseSymbols,
454ImmutableArray<ISymbol> derivedTypesSymbols,
490ISymbol memberSymbol,
492ImmutableArray<ISymbol> implementedMembers,
493ImmutableArray<ISymbol> overridingMembers,
494ImmutableArray<ISymbol> overriddenMembers,
538ISymbol targetSymbol,
542var symbolInSource = await SymbolFinder.FindSourceDefinitionAsync(targetSymbol, solution, cancellationToken).ConfigureAwait(false);
574private static ImmutableArray<ISymbol> GetImplementedSymbolsForTypeMember(
575ISymbol memberSymbol,
576ImmutableArray<ISymbol> overriddenSymbols)
580using var _ = ArrayBuilder<ISymbol>.GetInstance(out var builder);
592foreach (var symbol in overriddenSymbols)
600return ImmutableArray<ISymbol>.Empty;
606private static async Task<ImmutableArray<ISymbol>> GetImplementingSymbolsForTypeMemberAsync(
608ISymbol memberSymbol,
614using var _ = ArrayBuilder<ISymbol>.GetInstance(out var builder);
627foreach (var implementationSymbol in implementationSymbols)
635return ImmutableArray<ISymbol>.Empty;
641private static ImmutableArray<ISymbol> GetOverriddenSymbols(ISymbol memberSymbol)
645return ImmutableArray<ISymbol>.Empty;
649using var _ = ArrayBuilder<ISymbol>.GetInstance(out var builder);
650for (var overriddenMember = memberSymbol.GetOverriddenMember();
700private static DefinitionItem? ToSlimDefinitionItem(ISymbol symbol, Solution solution)
InitializeParameter\AbstractInitializeMemberFromParameterCodeRefactoringProviderMemberCreation.cs (17)
49protected abstract bool TryUpdateTupleAssignment(IBlockOperation? blockStatement, IParameterSymbol parameter, ISymbol fieldOrProperty, SyntaxEditor editor);
127var siblingFieldOrProperty = TryFindSiblingFieldOrProperty(parameter, blockStatement);
176var fields = parameters.SelectAsArray(p => (ISymbol)CreateField(p, accessibilityModifiersRequired, rules));
177var properties = parameters.SelectAsArray(p => (ISymbol)CreateProperty(p, accessibilityModifiersRequired, rules));
248ISymbol fieldOrProperty,
268private static ISymbol? TryFindSiblingFieldOrProperty(
273TryFindFieldOrPropertyAssignmentStatement(siblingParam, blockStatement, out var sibling);
382ImmutableArray<ISymbol> fieldsOrProperties,
404var fieldOrProperty = fieldsOrProperties[i];
448ISymbol fieldOrProperty,
536ISymbol fieldOrProperty,
565where TSymbol : ISymbol
570sibling, blockStatement, out var fieldOrProperty);
675IParameterSymbol parameter, IBlockOperation? blockStatement, out ISymbol? fieldOrProperty)
732private async Task<(ISymbol?, bool isThrowNotImplementedProperty)> TryFindMatchingUninitializedFieldOrPropertySymbolAsync(
750foreach (var memberWithName in containingType.GetMembers(memberName))
787static bool ContainsMemberAssignment(IBlockOperation? blockStatement, ISymbol member)
InlineMethod\AbstractInlineMethodRefactoringProvider.InlineContext.cs (13)
258ImmutableDictionary<ISymbol, string> renameTable)
284ImmutableDictionary<ISymbol, string> renameTable,
296ImmutableDictionary<ISymbol, SyntaxNode> replacementTable,
329private ImmutableDictionary<ISymbol, SyntaxNode> ComputeReplacementTable(
334ImmutableDictionary<ISymbol, string> renameTable)
338(parameter, argument) => (parameter: (ISymbol)parameter,
341.Select(parameterAndExpressionPair => (parameter: (ISymbol)parameterAndExpressionPair.Key,
345.Select(parameterAndName => (parameter: (ISymbol)parameterAndName.parameter,
358private static ImmutableDictionary<ISymbol, string> ComputeRenameTable(
367var renameTable = new Dictionary<ISymbol, string>();
370foreach (var symbol in parametersNeedGenerateFreshVariableFor.Concat(localSymbolsInCallee))
389private readonly HashSet<ISymbol> _allSymbols = new();
396public static ImmutableHashSet<ISymbol> GetAllSymbols(
LanguageServices\SymbolDisplayService\AbstractSymbolDisplayService.AbstractSymbolDescriptionBuilder.cs (21)
89private readonly Func<ISymbol, string> _getNavigationHint;
117protected abstract Task<ImmutableArray<SymbolDisplayPart>> GetInitializerSourcePartsAsync(ISymbol symbol);
118protected abstract ImmutableArray<SymbolDisplayPart> ToMinimalDisplayParts(ISymbol symbol, SemanticModel semanticModel, int position, SymbolDisplayFormat format);
119protected abstract string GetNavigationHint(ISymbol symbol);
157private async Task AddPartsAsync(ImmutableArray<ISymbol> symbols)
159var firstSymbol = symbols[0];
170private void AddDocumentationContent(ISymbol symbol)
187var original = symbol.OriginalDefinition;
210void AddReturnsDocumentationParts(ISymbol symbol, IDocumentationCommentFormattingService formatter)
227void AddValueDocumentationParts(ISymbol symbol, IDocumentationCommentFormattingService formatter)
244private void AddExceptions(ISymbol symbol)
268protected abstract void AddCaptures(ISymbol symbol);
297foreach (var captured in captures)
318ImmutableArray<ISymbol> symbolGroup, SymbolDescriptionGroups groups)
327public async Task<IDictionary<SymbolDescriptionGroups, ImmutableArray<TaggedText>>> BuildDescriptionSectionsAsync(ImmutableArray<ISymbol> symbolGroup)
336private async Task AddDescriptionPartAsync(ISymbol symbol)
723private void AddDescriptionForArbitrarySymbol(ISymbol symbol)
741ImmutableArray<ISymbol> symbolGroup)
758private static int GetOverloadCount(ImmutableArray<ISymbol> symbolGroup)
840protected ImmutableArray<SymbolDisplayPart> ToMinimalDisplayParts(ISymbol symbol, SymbolDisplayFormat format = null)
846private static IEnumerable<SymbolDisplayPart> Part(SymbolDisplayPartKind kind, ISymbol symbol, string text)
LanguageServices\SymbolDisplayService\AbstractSymbolDisplayService.cs (4)
31public Task<string> ToDescriptionStringAsync(SemanticModel semanticModel, int position, ISymbol symbol, SymbolDescriptionOptions options, SymbolDescriptionGroups groups, CancellationToken cancellationToken)
34public async Task<string> ToDescriptionStringAsync(SemanticModel semanticModel, int position, ImmutableArray<ISymbol> symbols, SymbolDescriptionOptions options, SymbolDescriptionGroups groups, CancellationToken cancellationToken)
40public async Task<ImmutableArray<SymbolDisplayPart>> ToDescriptionPartsAsync(SemanticModel semanticModel, int position, ImmutableArray<ISymbol> symbols, SymbolDescriptionOptions options, SymbolDescriptionGroups groups, CancellationToken cancellationToken)
52SemanticModel semanticModel, int position, ImmutableArray<ISymbol> symbols, SymbolDescriptionOptions options, CancellationToken cancellationToken)
LanguageServices\SymbolDisplayService\ISymbolDisplayService.cs (4)
18Task<string> ToDescriptionStringAsync(SemanticModel semanticModel, int position, ISymbol symbol, SymbolDescriptionOptions options, SymbolDescriptionGroups groups = SymbolDescriptionGroups.All, CancellationToken cancellationToken = default);
19Task<string> ToDescriptionStringAsync(SemanticModel semanticModel, int position, ImmutableArray<ISymbol> symbols, SymbolDescriptionOptions options, SymbolDescriptionGroups groups = SymbolDescriptionGroups.All, CancellationToken cancellationToken = default);
20Task<ImmutableArray<SymbolDisplayPart>> ToDescriptionPartsAsync(SemanticModel semanticModel, int position, ImmutableArray<ISymbol> symbols, SymbolDescriptionOptions options, SymbolDescriptionGroups groups = SymbolDescriptionGroups.All, CancellationToken cancellationToken = default);
21Task<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)
Shared\Utilities\AnnotatedSymbolMapping.cs (10)
21public ImmutableDictionary<ISymbol, SyntaxAnnotation> SymbolToDeclarationAnnotationMap { get; }
31public ImmutableDictionary<DocumentId, ImmutableArray<ISymbol>> DocumentIdsToSymbolMap { get; }
39ImmutableDictionary<ISymbol, SyntaxAnnotation> symbolToDeclarationAnnotationMap,
41ImmutableDictionary<DocumentId, ImmutableArray<ISymbol>> documentIdsToSymbolMap,
56IEnumerable<ISymbol> symbols,
61using var _ = PooledDictionary<ISymbol, SyntaxAnnotation>.GetInstance(out var symbolToDeclarationAnnotationMap);
63using var _2 = PooledDictionary<DocumentId, List<ISymbol>>.GetInstance(out var documentIdToSymbolsMap);
73documentIdToSymbolsMap.Add(solution.GetRequiredDocument(typeNode.SyntaxTree).Id, new List<ISymbol>());
75foreach (var symbol in symbols)
85documentIdToSymbolsMap.Add(id, new List<ISymbol>());
SignatureHelp\AbstractSignatureHelpProvider.SymbolKeySignatureHelpItem.cs (1)
18ISymbol symbol,
ValueTracking\ValueTracker.cs (8)
82var symbol = await GetSymbolAsync(previousTrackedItem, solution, cancellationToken).ConfigureAwait(false);
99var previousSymbol = await GetSymbolAsync(previousTrackedItem.Parent, solution, cancellationToken).ConfigureAwait(false);
165private static async Task TrackVariableReferencesAsync(ISymbol symbol, OperationCollector collector, CancellationToken cancellationToken)
180var containingSymbol = parameterSymbol.ContainingSymbol;
256private static async Task<(ISymbol?, SyntaxNode?)> GetSelectedSymbolAsync(TextSpan textSpan, Document document, CancellationToken cancellationToken)
262var selectedSymbol =
285private static async Task TrackVariableDefinitionsAsync(ISymbol symbol, OperationCollector collector, CancellationToken cancellationToken)
322private static async Task<ISymbol?> GetSymbolAsync(ValueTrackedItem? item, Solution solution, CancellationToken cancellationToken)
AbstractCodeGenerationService.cs (12)
66public TDeclarationNode AddMembers<TDeclarationNode>(TDeclarationNode destination, IEnumerable<ISymbol> members, CodeGenerationContextInfo info, CancellationToken cancellationToken)
116public TDeclarationNode UpdateDeclarationMembers<TDeclarationNode>(TDeclarationNode declaration, IList<ISymbol> newMembers, CodeGenerationContextInfo info, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode
141public abstract TDeclarationNode UpdateDeclarationMembers<TDeclarationNode>(TDeclarationNode declaration, IList<ISymbol> newMembers, TCodeGenerationContextInfo info, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode;
272IEnumerable<ISymbol> members,
295IEnumerable<ISymbol> members,
302foreach (var member in members)
326IEnumerable<ISymbol> members,
334foreach (var member in members)
343private SyntaxNode? GetNewMember(TCodeGenerationContextInfo info, CodeGenerationDestination codeGenerationDestination, ISymbol member, CancellationToken cancellationToken)
359ISymbol member,
374private static bool GeneratingEnum(IEnumerable<ISymbol> members)
456public Task<Document> AddMembersAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IEnumerable<ISymbol> members, CancellationToken cancellationToken)
AbstractSemanticFactsService.cs (10)
30private static readonly Func<ISymbol, bool> s_LocalNameFilter = s =>
73string baseName, Func<ISymbol, bool> filter,
90protected virtual IEnumerable<ISymbol> GetCollidableSymbols(SemanticModel semanticModel, SyntaxNode location, SyntaxNode container, CancellationToken cancellationToken)
113var impl = type.FindImplementationForInterfaceMember(methodToLookFor) ?? methodToLookFor;
151public ISymbol GetDeclaredSymbol(SemanticModel semanticModel, SyntaxToken token, CancellationToken cancellationToken)
181public IEnumerable<ISymbol> GetDeclaredSymbols(SemanticModel semanticModel, SyntaxNode memberDeclaration, CancellationToken cancellationToken)
190public ISymbol FindFieldOrPropertyForArgument(SemanticModel semanticModel, SyntaxNode argumentNode, CancellationToken cancellationToken)
193public ISymbol FindFieldOrPropertyForAttributeArgument(SemanticModel semanticModel, SyntaxNode argumentNode, CancellationToken cancellationToken)
196public ImmutableArray<ISymbol> GetBestOrAllSymbols(SemanticModel semanticModel, SyntaxNode node, SyntaxToken token, CancellationToken cancellationToken)
202public ImmutableArray<IMethodSymbol> GetLocalFunctionSymbols(Compilation compilation, ISymbol symbol, CancellationToken cancellationToken)
Editing\SymbolEditor.cs (39)
99public async Task<ISymbol> GetCurrentSymbolAsync(ISymbol symbol, CancellationToken cancellationToken = default)
120var currentSymbol = await GetSymbolAsync(_currentSolution, projectId, symbolId, cancellationToken).ConfigureAwait(false);
146private static async Task<ISymbol> GetSymbolAsync(Solution solution, ProjectId projectId, string symbolId, CancellationToken cancellationToken)
181public async Task<IReadOnlyList<SyntaxNode>> GetCurrentDeclarationsAsync(ISymbol symbol, CancellationToken cancellationToken = default)
183var currentSymbol = await this.GetCurrentSymbolAsync(symbol, cancellationToken).ConfigureAwait(false);
190private IEnumerable<SyntaxNode> GetDeclarations(ISymbol symbol)
201private 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 (36)
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, FindReferencesSearchOptions options, CancellationToken cancellationToken);
37ISymbol symbol, FindReferencesDocumentState state, FindReferencesSearchOptions options, CancellationToken cancellationToken);
40ISymbol symbol, FindReferencesDocumentState state, SyntaxToken token, CancellationToken cancellationToken)
54ISymbol searchSymbol, FindReferencesDocumentState state, SyntaxNode node, CancellationToken cancellationToken)
62ISymbol searchSymbol, FindReferencesDocumentState state, SymbolInfo symbolInfo, CancellationToken cancellationToken)
67foreach (var candidate in symbolInfo.CandidateSymbols)
164ISymbol symbol,
186ISymbol symbol,
250ISymbol symbol,
288ISymbol symbol,
397ISymbol symbol,
432ISymbol symbol,
471ISymbol symbol,
505ISymbol symbol,
532ISymbol symbol,
548var constructor = state.SemanticModel.GetSymbolInfo(node, cancellationToken).Symbol;
562protected static bool Matches(SymbolInfo info, ISymbol notNullOriginalUnreducedSymbol2)
567foreach (var symbol in info.CandidateSymbols)
576protected static bool Matches(ISymbol? symbol1, ISymbol notNullOriginalUnreducedSymbol2)
775internal static ImmutableDictionary<string, string> GetAdditionalFindUsagesProperties(ISymbol definition)
786var containingSymbol = definition.ContainingSymbol;
803var symbol = semanticModel.GetDeclaredSymbol(node);
815private static bool TryGetAdditionalProperty(string propertyName, ISymbol symbol, out KeyValuePair<string, string> additionalProperty)
829where TSymbol : ISymbol
847ISymbol symbol, Project project, CancellationToken cancellationToken)
855ISymbol symbol, HashSet<string>? globalAliases, Project project,
864ISymbol symbol, FindReferencesDocumentState state, FindReferencesSearchOptions options, CancellationToken cancellationToken)
871public sealed override ValueTask<ImmutableArray<ISymbol>> DetermineCascadedSymbolsAsync(
872ISymbol symbol, Solution solution, FindReferencesSearchOptions options, CancellationToken cancellationToken)
881return new(ImmutableArray<ISymbol>.Empty);
884protected virtual ValueTask<ImmutableArray<ISymbol>> DetermineCascadedSymbolsAsync(
887return new(ImmutableArray<ISymbol>.Empty);
FindSymbols\FindReferences\FindReferencesSearchEngine.cs (19)
44private readonly ConcurrentDictionary<ISymbol, SymbolGroup> _symbolToGroup = new(MetadataUnifyingEquivalenceComparer.Instance);
68public Task FindReferencesAsync(ISymbol symbol, CancellationToken cancellationToken)
72ImmutableArray<ISymbol> symbols, CancellationToken cancellationToken)
142private async Task ReportGroupsAsync(ImmutableArray<ISymbol> symbols, CancellationToken cancellationToken)
144foreach (var symbol in symbols)
148private async ValueTask<SymbolGroup> ReportGroupAsync(ISymbol symbol, CancellationToken cancellationToken)
164foreach (var groupSymbol in group.Symbols)
178ImmutableArray<ISymbol> symbols, CancellationToken cancellationToken)
187private async Task ProcessProjectAsync(Project project, ImmutableArray<ISymbol> allSymbols, CancellationToken cancellationToken)
189using var _1 = PooledDictionary<ISymbol, PooledHashSet<string>>.GetInstance(out var symbolToGlobalAliases);
195foreach (var symbol in allSymbols)
252Dictionary<ISymbol, PooledHashSet<string>> symbolToGlobalAliases,
269foreach (var symbol in symbols)
283ISymbol symbol,
306ImmutableArray<ISymbol> allSymbols,
307PooledDictionary<ISymbol, PooledHashSet<string>> symbolToGlobalAliases,
310foreach (var symbol in allSymbols)
336private static void FreeGlobalAliases(PooledDictionary<ISymbol, PooledHashSet<string>> symbolToGlobalAliases)
342private static bool InvolvesInheritance(ISymbol symbol)
FindSymbols\FindReferences\FindReferencesSearchEngine.SymbolSet.cs (26)
44public abstract ImmutableArray<ISymbol> GetAllSymbols();
97foreach (var symbol in symbols)
103private static async Task<ISymbol> MapToAppropriateSymbolAsync(
104Solution solution, ISymbol symbol, CancellationToken cancellationToken)
109var searchSymbol = symbol;
127var sourceSymbol = await SymbolFinder.FindSourceDefinitionAsync(searchSymbol, solution, cancellationToken).ConfigureAwait(false);
142var workQueue = new Stack<ISymbol>();
145foreach (var symbol in symbols)
151var currentSymbol = workQueue.Pop();
165var workQueue = new Stack<ISymbol>();
172var currentSymbol = workQueue.Pop();
181FindReferencesSearchEngine engine, ImmutableArray<ISymbol> symbols, MetadataUnifyingSymbolHashSet seenSymbols, Stack<ISymbol> workQueue, CancellationToken cancellationToken)
183foreach (var symbol in symbols)
188FindReferencesSearchEngine engine, ISymbol symbol, MetadataUnifyingSymbolHashSet seenSymbols, Stack<ISymbol> workQueue, CancellationToken cancellationToken)
196foreach (var cascade in cascaded)
202async Task<ISymbol> MapAndAddLinkedSymbolsAsync(ISymbol symbol)
205foreach (var linked in await SymbolFinder.FindLinkedSymbolsAsync(symbol, solution, cancellationToken).ConfigureAwait(false))
225FindReferencesSearchEngine engine, ISymbol symbol,
226MetadataUnifyingSymbolHashSet seenSymbols, Stack<ISymbol> workQueue,
259ISymbol symbol,
261Stack<ISymbol> workQueue,
277foreach (var match in matches)
282if (symbol.GetOverriddenMember() is ISymbol overriddenMember)
FindSymbols\FindReferences\FindReferencesSearchEngine_FindReferencesInDocuments.cs (18)
21ISymbol originalSymbol, IImmutableSet<Document> documents, CancellationToken cancellationToken)
36var hasInheritanceRelationshipCache = new Dictionary<(ISymbol searchSymbol, ISymbol candidateSymbol), bool>();
58async ValueTask PerformSearchInProjectAsync(ImmutableArray<ISymbol> symbols, Project project)
60using var _ = PooledDictionary<ISymbol, PooledHashSet<string>>.GetInstance(out var symbolToGlobalAliases);
80ImmutableArray<ISymbol> symbols,
82PooledDictionary<ISymbol, PooledHashSet<string>> symbolToGlobalAliases)
92foreach (var symbol in symbols)
102ISymbol symbol, Document document, FindReferencesDocumentState state)
142async ValueTask<(bool matched, ISymbol candidate, CandidateReason candidateReason)> HasInheritanceRelationshipAsync(
143ISymbol symbol, SymbolInfo symbolInfo)
148foreach (var candidate in symbolInfo.CandidateSymbols)
157async ValueTask<bool> HasInheritanceRelationshipSingleAsync(ISymbol searchSymbol, [NotNullWhen(true)] ISymbol? candidate)
173ISymbol searchSymbol, ISymbol candidate)
185foreach (var symbolUp in searchSymbolUpSet.GetAllSymbols())
195foreach (var candidateUp in candidateSymbolUpSet.GetAllSymbols())
FindSymbols\SymbolFinder_Declarations_CustomQueries.cs (10)
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(
53return ImmutableArray<ISymbol>.Empty;
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(
98return ImmutableArray<ISymbol>.Empty;
114return ImmutableArray<ISymbol>.Empty;
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 (35)
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)
39var results = ArrayBuilder<ISymbol>.GetInstance();
52foreach (var m in type.GetMembers(symbol.Name))
54var sourceMember = await FindSourceDefinitionAsync(m, solution, cancellationToken).ConfigureAwait(false);
55var bestMember = sourceMember ?? m;
68internal static async Task<bool> IsOverrideAsync(Solution solution, ISymbol member, ISymbol symbol, CancellationToken cancellationToken)
70for (var current = member; current != null; current = current.GetOverriddenMember())
82public static async Task<IEnumerable<ISymbol>> FindImplementedInterfaceMembersAsync(
83ISymbol symbol, Solution solution, IImmutableSet<Project>? projects = null, CancellationToken cancellationToken = default)
91internal static Task<ImmutableArray<ISymbol>> FindImplementedInterfaceMembersArrayAsync(
92ISymbol symbol, Solution solution, CancellationToken cancellationToken)
103internal static async Task<ImmutableArray<ISymbol>> FindImplementedInterfaceMembersArrayAsync(
104ISymbol symbol,
139using var _ = ArrayBuilder<ISymbol>.GetInstance(out var builder);
157foreach (var interfaceMember in interfaceType.GetMembers(symbol.Name))
159var sourceMethod = await FindSourceDefinitionAsync(interfaceMember, solution, cancellationToken).ConfigureAwait(false);
160var bestMethod = sourceMethod ?? interfaceMember;
164foreach (var implementation in implementations)
181return ImmutableArray<ISymbol>.Empty;
194/// "derived", but can be found with <see cref="FindImplementationsAsync(ISymbol, Solution,
211/// "derived", but can be found with <see cref="FindImplementationsAsync(ISymbol, Solution,
322public static async Task<IEnumerable<ISymbol>> FindImplementationsAsync(
323ISymbol symbol, Solution solution, IImmutableSet<Project>? projects = null, CancellationToken cancellationToken = default)
342/// <inheritdoc cref="FindImplementationsAsync(ISymbol, Solution, IImmutableSet{Project}, CancellationToken)"/>
346internal static async Task<ImmutableArray<ISymbol>> FindMemberImplementationsArrayAsync(
347ISymbol symbol, Solution solution, IImmutableSet<Project>? projects = null, CancellationToken cancellationToken = default)
350return ImmutableArray<ISymbol>.Empty;
361using var _ = ArrayBuilder<ISymbol>.GetInstance(out var results);
365foreach (var implementation in implementations)
367var sourceDef = await FindSourceDefinitionAsync(implementation, solution, cancellationToken).ConfigureAwait(false);
368var bestDef = sourceDef ?? implementation;
ICodeGenerationService.cs (4)
84TDeclarationNode AddMembers<TDeclarationNode>(TDeclarationNode destination, IEnumerable<ISymbol> members, CodeGenerationContextInfo info, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode;
124TDeclarationNode UpdateDeclarationMembers<TDeclarationNode>(TDeclarationNode declaration, IList<ISymbol> newMembers, CodeGenerationContextInfo info, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode;
174Task<Document> AddMembersAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IEnumerable<ISymbol> members, CancellationToken cancellationToken);
179bool CanAddTo(ISymbol destination, Solution solution, CancellationToken cancellationToken);
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);
ISymbolExtensions_Accessibility.cs (11)
17this ISymbol symbol,
18ISymbol within,
39this ISymbol symbol,
51this ISymbol symbol,
64ISymbol symbol,
83ISymbol symbol,
84ISymbol within, // must be assembly or named type symbol
180private static bool IsNamedTypeAccessible(INamedTypeSymbol type, ISymbol within)
218ISymbol within)
253ISymbol within,
413ISymbol within,
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\INamedTypeSymbolExtensions.cs\INamedTypeSymbolExtensions.cs (63)
66public static ISymbol? FindImplementationForAbstractMember(this INamedTypeSymbol? type, ISymbol symbol)
77private static bool ImplementationExists(INamedTypeSymbol classOrStructType, ISymbol member)
82ISymbol member,
83Func<INamedTypeSymbol, ISymbol, bool> isValidImplementation,
151ISymbol member,
152Func<INamedTypeSymbol, ISymbol, bool> isValid,
155var implementation = classOrStructType.FindImplementationForInterfaceMember(member);
175public static ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)> GetAllUnimplementedMembers(
181Func<INamedTypeSymbol, ISymbol, ImmutableArray<ISymbol>> GetMembers;
201static ImmutableArray<ISymbol> GetImplicitlyImplementableMembers(INamedTypeSymbol type, ISymbol within)
214static bool IsPropertyWithNonPublicImplementableAccessor(ISymbol member)
231static bool IsImplicitlyImplementable(ISymbol member, ISymbol within)
248private static bool IsImplementable(ISymbol m)
251public static ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)> GetAllUnimplementedMembersInThis(
261var implementation = classOrStructType.FindImplementationForInterfaceMember(m);
269public static ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)> GetAllUnimplementedMembersInThis(
272Func<INamedTypeSymbol, ISymbol, ImmutableArray<ISymbol>> interfaceMemberGetter,
280var implementation = classOrStructType.FindImplementationForInterfaceMember(m);
288public static ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)> GetAllUnimplementedExplicitMembers(
302private static ImmutableArray<ISymbol> GetExplicitlyImplementableMembers(INamedTypeSymbol type, ISymbol within)
314private static bool IsPropertyWithInaccessibleImplementableAccessor(ISymbol member, ISymbol within)
326private static bool IsInaccessibleImplementableAccessor(IMethodSymbol? accessor, ISymbol within)
329private static ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)> GetAllUnimplementedMembers(
332Func<INamedTypeSymbol, ISymbol, Func<INamedTypeSymbol, ISymbol, bool>, CancellationToken, bool> isImplemented,
333Func<INamedTypeSymbol, ISymbol, bool> isValidImplementation,
334Func<INamedTypeSymbol, ISymbol, ImmutableArray<ISymbol>> interfaceMemberGetter,
344return ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)>.Empty;
349return ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)>.Empty;
355return ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)>.Empty;
406private static ImmutableArray<ISymbol> GetUnimplementedMembers(
409Func<INamedTypeSymbol, ISymbol, Func<INamedTypeSymbol, ISymbol, bool>, CancellationToken, bool> isImplemented,
410Func<INamedTypeSymbol, ISymbol, bool> isValidImplementation,
411Func<INamedTypeSymbol, ISymbol, ImmutableArray<ISymbol>> interfaceMemberGetter,
425public static IEnumerable<ISymbol> GetAttributeNamedParameters(
428ISymbol within)
441foreach (var member in type.GetMembers())
443var namedParameter = IsAttributeNamedParameter(member, within ?? compilation.Assembly);
452private static ISymbol? IsAttributeNamedParameter(
453ISymbol symbol,
454ISymbol within)
494private static ImmutableArray<ISymbol> GetMembers(INamedTypeSymbol type, ISymbol within)
507public static ImmutableArray<ISymbol> GetOverridableMembers(
513var result = new Dictionary<ISymbol, int>();
544Dictionary<ISymbol, int> result, INamedTypeSymbol containingType,
547foreach (var member in type.GetMembers())
558private static bool IsOverridable(ISymbol member, INamedTypeSymbol containingType)
579Dictionary<ISymbol, int> result, INamedTypeSymbol containingType, CancellationToken cancellationToken)
581foreach (var member in containingType.GetMembers())
591var overriddenMember = member.GetOverriddenMember();
598private static bool IsEqualsObjectOverride(ISymbol? member)
609private static bool IsEqualsObject(ISymbol member)
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions.cs\ISymbolExtensions.cs (88)
19public static string ToNameDisplayString(this ISymbol symbol)
22public static string ToSignatureDisplayString(this ISymbol symbol)
25public static bool HasPublicResultantVisibility(this ISymbol symbol)
28public static SymbolVisibility GetResultantVisibility(this ISymbol symbol)
75public static ISymbol? GetOverriddenMember(this ISymbol? symbol)
84public static ImmutableArray<ISymbol> ExplicitInterfaceImplementations(this ISymbol symbol)
87IEventSymbol @event => ImmutableArray<ISymbol>.CastUp(@event.ExplicitInterfaceImplementations),
88IMethodSymbol method => ImmutableArray<ISymbol>.CastUp(method.ExplicitInterfaceImplementations),
89IPropertySymbol property => ImmutableArray<ISymbol>.CastUp(property.ExplicitInterfaceImplementations),
90_ => ImmutableArray.Create<ISymbol>(),
93public static ImmutableArray<ISymbol> ExplicitOrImplicitInterfaceImplementations(this ISymbol symbol)
96return ImmutableArray<ISymbol>.Empty;
107public static ImmutableArray<ISymbol> ImplicitInterfaceImplementations(this ISymbol symbol)
110public static bool IsOverridable([NotNullWhen(true)] this ISymbol? symbol)
119public static bool IsImplementableMember([NotNullWhen(true)] this ISymbol? symbol)
152public static INamedTypeSymbol? GetContainingTypeOrThis(this ISymbol symbol)
162public static bool IsErrorType([NotNullWhen(true)] this ISymbol? symbol)
165public static bool IsModuleType([NotNullWhen(true)] this ISymbol? symbol)
168public static bool IsInterfaceType([NotNullWhen(true)] this ISymbol? symbol)
171public static bool IsArrayType([NotNullWhen(true)] this ISymbol? symbol)
174public static bool IsTupleType([NotNullWhen(true)] this ISymbol? symbol)
177public static bool IsAnonymousFunction([NotNullWhen(true)] this ISymbol? symbol)
180public static bool IsKind([NotNullWhen(true)] this ISymbol? symbol, SymbolKind kind)
183public static bool MatchesKind([NotNullWhen(true)] this ISymbol? symbol, SymbolKind kind)
186public static bool MatchesKind([NotNullWhen(true)] this ISymbol? symbol, SymbolKind kind1, SymbolKind kind2)
192public static bool MatchesKind([NotNullWhen(true)] this ISymbol? symbol, SymbolKind kind1, SymbolKind kind2, SymbolKind kind3)
198public static bool MatchesKind([NotNullWhen(true)] this ISymbol? symbol, params SymbolKind[] kinds)
204public static bool IsReducedExtension([NotNullWhen(true)] this ISymbol? symbol)
207public static bool IsEnumMember([NotNullWhen(true)] this ISymbol? symbol)
210public static bool IsExtensionMethod(this ISymbol symbol)
213public static bool IsLocalFunction([NotNullWhen(true)] this ISymbol? symbol)
216public static bool IsAnonymousOrLocalFunction([NotNullWhen(true)] this ISymbol? symbol)
219public static bool IsModuleMember([NotNullWhen(true)] this ISymbol? symbol)
222public static bool IsConstructor([NotNullWhen(true)] this ISymbol? symbol)
225public static bool IsStaticConstructor([NotNullWhen(true)] this ISymbol? symbol)
228public static bool IsDestructor([NotNullWhen(true)] this ISymbol? symbol)
231public static bool IsUserDefinedOperator([NotNullWhen(true)] this ISymbol? symbol)
234public static bool IsConversion([NotNullWhen(true)] this ISymbol? symbol)
237public static bool IsOrdinaryMethod([NotNullWhen(true)] this ISymbol? symbol)
240public static bool IsOrdinaryMethodOrLocalFunction([NotNullWhen(true)] this ISymbol? symbol)
243public static bool IsDelegateType([NotNullWhen(true)] this ISymbol? symbol)
246public static bool IsAnonymousType([NotNullWhen(true)] this ISymbol? symbol)
249public static bool IsNormalAnonymousType([NotNullWhen(true)] this ISymbol? symbol)
252public static bool IsAnonymousDelegateType([NotNullWhen(true)] this ISymbol? symbol)
255public static bool IsAnonymousTypeProperty([NotNullWhen(true)] this ISymbol? symbol)
258public static bool IsTupleField([NotNullWhen(true)] this ISymbol? symbol)
261public static bool IsIndexer([NotNullWhen(true)] this ISymbol? symbol)
264public static bool IsWriteableFieldOrProperty([NotNullWhen(true)] this ISymbol? symbol)
272public static bool IsRequired([NotNullWhen(true)] this ISymbol? symbol)
275public static ITypeSymbol? GetMemberType(this ISymbol? symbol)
285public static int GetArity(this ISymbol symbol)
294public static ISymbol? GetOriginalUnreducedDefinition(this ISymbol? symbol)
337public static bool IsFunctionValue([NotNullWhen(true)] this ISymbol? symbol)
340public static bool IsThisParameter([NotNullWhen(true)] this ISymbol? symbol)
344public static ISymbol? ConvertThisParameterToType(this ISymbol? symbol)
354public static bool IsParams([NotNullWhen(true)] this ISymbol? symbol)
357public static ImmutableArray<IParameterSymbol> GetParameters(this ISymbol? symbol)
365public static ImmutableArray<ITypeParameterSymbol> GetTypeParameters(this ISymbol? symbol)
373public static ImmutableArray<ITypeParameterSymbol> GetAllTypeParameters(this ISymbol? symbol)
386public static ImmutableArray<ITypeSymbol> GetTypeArguments(this ISymbol? symbol)
394public static ImmutableArray<ITypeSymbol> GetAllTypeArguments(this ISymbol symbol)
409public static bool IsAttribute([NotNullWhen(true)] this ISymbol? symbol)
418public static bool RequiresUnsafeModifier([NotNullWhen(true)] this ISymbol? member)
425this ISymbol? symbol,
468public static bool IsStaticType([NotNullWhen(true)] this ISymbol? symbol)
471public static bool IsNamespace([NotNullWhen(true)] this ISymbol? symbol)
475[NotNullWhen(true)] this ISymbol? symbol, ISymbol withinType, IAssemblySymbol withinAssembly, CancellationToken cancellationToken)
495public static IEnumerable<IPropertySymbol> GetValidAnonymousTypeProperties(this ISymbol symbol)
501public static Accessibility ComputeResultantAccessibility(this ISymbol? symbol, ITypeSymbol finalDestination)
527public static bool IsInaccessibleLocal(this ISymbol symbol, int position)
545public static bool IsAccessor([NotNullWhen(true)] this ISymbol? symbol)
548public static bool IsPropertyAccessor([NotNullWhen(true)] this ISymbol? symbol)
551public static bool IsEventAccessor([NotNullWhen(true)] this ISymbol? symbol)
554public static bool IsFromSource(this ISymbol symbol)
557public static bool IsNonImplicitAndFromSource(this ISymbol symbol)
560public static ITypeSymbol? GetSymbolType(this ISymbol? symbol)
576public static bool IsAwaitableNonDynamic([NotNullWhen(true)] this ISymbol? symbol, SemanticModel semanticModel, int position)
715public static bool IsKind<TSymbol>(this ISymbol symbol, SymbolKind kind, [NotNullWhen(true)] out TSymbol? result) where TSymbol : class, ISymbol
732public static bool IsSymbolWithSpecialDiscardName(this ISymbol symbol)
741public static bool IsObsolete(this ISymbol symbol)
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.cs\ITypeSymbolExtensions.cs (10)
401public static bool CanSupportCollectionInitializer(this ITypeSymbol typeSymbol, ISymbol within)
432public static IEnumerable<T> GetAccessibleMembersInBaseTypes<T>(this ITypeSymbol containingType, ISymbol within) where T : class, ISymbol
443public static ImmutableArray<T> GetAccessibleMembersInThisAndBaseTypes<T>(this ITypeSymbol? containingType, ISymbol within) where T : class, ISymbol
488public static IEnumerable<T> SelectAccessibleMembers<T>(this IEnumerable<ITypeSymbol>? types, ISymbol within) where T : class, ISymbol
498private static IEnumerable<T> SelectAccessibleMembers<T>(this IEnumerable<ITypeSymbol>? types, string memberName, ISymbol within) where T : class, ISymbol
683foreach (var member in type.GetMembers())
Remote\RemoteArguments.cs (7)
66Solution solution, ISymbol symbol, CancellationToken cancellationToken)
74public static SerializableSymbolAndProjectId Create(ISymbol symbol, Project project, CancellationToken cancellationToken)
78ISymbol symbol, Solution solution, CancellationToken cancellationToken,
92ISymbol symbol, Project project, CancellationToken cancellationToken,
105public async ValueTask<ISymbol?> TryRehydrateAsync(
114var symbol = SymbolKey.ResolveString(
212var symbol = await Alias.TryRehydrateAsync(solution, cancellationToken).ConfigureAwait(false);
Rename\ConflictEngine\ConflictResolver.cs (18)
53ISymbol symbol,
132private static ImmutableArray<ISymbol> SymbolsForEnclosingInvocationExpressionWorker(SyntaxNode invocationExpression, SemanticModel semanticModel, CancellationToken cancellationToken)
147private static bool LocalVariableConflictPerLanguage(SyntaxToken tokenOrNode, Document document, ImmutableArray<ISymbol> newReferencedSymbols)
170private static bool IsRenameValid(MutableConflictResolution conflictResolution, ISymbol renamedSymbol)
178ISymbol renamedSymbol,
179ISymbol originalSymbol,
231ISymbol renamedSymbol,
232ISymbol renameSymbol,
233IEnumerable<ISymbol> referencedSymbols,
248IEnumerable<ISymbol> otherThingsNamedTheSameExcludeMethodAndParameterizedProperty;
327private static void AddConflictingSymbolLocations(IEnumerable<ISymbol> conflictingSymbols, MutableConflictResolution conflictResolution, IDictionary<Location, Location> reverseMappedLocations)
329foreach (var newSymbol in conflictingSymbols)
348IEnumerable<ISymbol> symbols,
354foreach (var symbol in symbols)
361var overriddenSymbol = symbol.GetOverriddenMember();
386private static string GetString(ISymbol symbol)
403private static async Task<Location?> GetSymbolLocationAsync(Solution solution, ISymbol symbol, CancellationToken cancellationToken)
407var originalsourcesymbol = await SymbolFinder.FindSourceDefinitionAsync(symbol, solution, cancellationToken).ConfigureAwait(false);
Rename\IRenameRewriterLanguageService.cs (18)
36ISymbol symbol,
54ISymbol renamedSymbol,
55ISymbol renameSymbol,
56IEnumerable<ISymbol> referencedSymbols,
71ISymbol renameSymbol,
72ISymbol renamedSymbol,
86ISymbol renamedSymbol,
101IEnumerable<ISymbol> newReferencedSymbols);
126public abstract Task<ImmutableArray<Location>> ComputeDeclarationConflictsAsync(string replacementText, ISymbol renamedSymbol, ISymbol renameSymbol, IEnumerable<ISymbol> referencedSymbols, Solution baseSolution, Solution newSolution, IDictionary<Location, Location> reverseMappedLocations, CancellationToken cancellationToken);
127public abstract Task<ImmutableArray<Location>> ComputeImplicitReferenceConflictsAsync(ISymbol renameSymbol, ISymbol renamedSymbol, IEnumerable<ReferenceLocation> implicitReferenceLocations, CancellationToken cancellationToken);
128public abstract ImmutableArray<Location> ComputePossibleImplicitUsageConflicts(ISymbol renamedSymbol, SemanticModel semanticModel, Location originalDeclarationLocation, int newDeclarationLocationStartingPosition, CancellationToken cancellationToken);
131public abstract bool LocalVariableConflict(SyntaxToken token, IEnumerable<ISymbol> newReferencedSymbols);
132public abstract void TryAddPossibleNameConflicts(ISymbol symbol, string newName, ICollection<string> possibleNameConflicts);
135IEnumerable<ISymbol> properties, string newPropertyName, ArrayBuilder<Location> conflicts)
139foreach (var symbol in properties)
Rename\Renamer.cs (5)
42public static Task<Solution> RenameSymbolAsync(Solution solution, ISymbol symbol, string newName, OptionSet? optionSet, CancellationToken cancellationToken = default)
46Solution solution, ISymbol symbol, SymbolRenameOptions options, string newName, CancellationToken cancellationToken = default)
151internal static Task<LightweightRenameLocations> FindRenameLocationsAsync(Solution solution, ISymbol symbol, SymbolRenameOptions options, CodeCleanupOptionsProvider fallbackOptions, CancellationToken cancellationToken)
156ISymbol symbol,
204ISymbol symbol,
Rename\RenameUtilities.cs (23)
26internal static SyntaxToken UpdateAliasAnnotation(SyntaxToken token, ISymbol aliasSymbol, string replacementText)
44internal static ImmutableArray<ISymbol> GetSymbolsTouchingPosition(
50? ImmutableArray.Create<ISymbol>(semanticInfo.DeclaredSymbol)
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);
186public static IEnumerable<ISymbol> GetOverloadedSymbols(ISymbol symbol)
193foreach (var member in containingType.GetMembers())
204public static async Task<ISymbol?> TryGetPropertyFromAccessorOrAnOverrideAsync(
205ISymbol symbol, Solution solution, CancellationToken cancellationToken)
214var originalSourceSymbol = await SymbolFinder.FindSourceDefinitionAsync(
229foreach (var methodImplementor in methodImplementors)
231var 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 = await SymbolFinder.FindSourceDefinitionAsync(
325var bestSymbol = foundSymbol ?? symbol;
381var property = await RenameUtilities.TryGetPropertyFromAccessorOrAnOverrideAsync(bestSymbol, solution, cancellationToken).ConfigureAwait(false);
Rename\SymbolicRenameLocations.ReferenceProcessing.cs (11)
31ISymbol referencedSymbol, ISymbol originalSymbol, Solution solution, bool considerSymbolReferences, CancellationToken cancellationToken)
116static bool IsConstructorForType(ISymbol possibleConstructor, ISymbol possibleType)
125ISymbol symbol, Solution solution, CancellationToken cancellationToken)
127var result = await RenameUtilities.TryGetPropertyFromAccessorOrAnOverrideAsync(
150ISymbol referencedSymbol, ISymbol originalSymbol, Solution solution, CancellationToken cancellationToken)
231internal static async Task<IEnumerable<RenameLocation>> GetRenamableReferenceLocationsAsync(ISymbol referencedSymbol, ISymbol originalSymbol, ReferenceLocation location, Solution solution, CancellationToken cancellationToken)
313ISymbol originalSymbol,
SemanticModelExtensions.cs (11)
47public static ISymbol GetRequiredDeclaredSymbol(this SemanticModel semanticModel, SyntaxNode declaration, CancellationToken cancellationToken)
59public static ISymbol GetRequiredEnclosingSymbol(this SemanticModel semanticModel, int position, CancellationToken cancellationToken)
66where TSymbol : class, ISymbol
68for (var symbol = semanticModel.GetEnclosingSymbol(position, cancellationToken);
81public static ISymbol GetEnclosingNamedTypeOrAssembly(this SemanticModel semanticModel, int position, CancellationToken cancellationToken)
84(ISymbol)semanticModel.Compilation.Assembly;
93public static IEnumerable<ISymbol> GetExistingSymbols(
115public static HashSet<ISymbol> GetAllDeclaredSymbols(
118var symbols = new HashSet<ISymbol>();
129HashSet<ISymbol> symbols, CancellationToken cancellationToken, Func<SyntaxNode, bool>? descendInto = null)
131var symbol = semanticModel.GetDeclaredSymbol(node, cancellationToken);
Shared\Extensions\ISymbolExtensions.cs (23)
38this ISymbol symbol,
52this ISymbol symbol,
93ISymbol symbol,
113ISymbol symbol, INamedTypeSymbol? hideModuleNameAttribute, ImmutableArray<AttributeData> attributes = default)
227public static DocumentationComment GetDocumentationComment(this ISymbol symbol, Compilation compilation, CultureInfo? preferredCulture = null, bool expandIncludes = false, bool expandInheritdoc = false, CancellationToken cancellationToken = default)
230private static DocumentationComment GetDocumentationComment(ISymbol symbol, HashSet<ISymbol>? visitedSymbols, Compilation compilation, CultureInfo? preferredCulture, bool expandIncludes, bool expandInheritdoc, CancellationToken cancellationToken)
266static bool IsEligibleForAutomaticInheritdoc(ISymbol symbol)
303private static XNode[] RewriteInheritdocElements(ISymbol symbol, HashSet<ISymbol>? visitedSymbols, Compilation compilation, XNode node, CancellationToken cancellationToken)
340private static XNode[] RewriteMany(ISymbol symbol, HashSet<ISymbol>? visitedSymbols, Compilation compilation, XNode[] nodes, CancellationToken cancellationToken)
351private static XNode[]? RewriteInheritdocElement(ISymbol memberSymbol, HashSet<ISymbol>? visitedSymbols, Compilation compilation, XElement element, CancellationToken cancellationToken)
356var candidate = GetCandidateSymbol(memberSymbol);
367ISymbol? symbol;
383visitedSymbols ??= new HashSet<ISymbol>();
465static ISymbol? GetCandidateSymbol(ISymbol memberSymbol)
649this ImmutableArray<T> symbols, bool hideAdvancedMembers, Compilation compilation) where T : ISymbol
672private static ImmutableArray<T> RemoveOverriddenSymbolsWithinSet<T>(this ImmutableArray<T> symbols) where T : ISymbol
678var overriddenMember = symbol.GetOverriddenMember();
687this ImmutableArray<T> symbols, bool hideAdvancedMembers, Compilation compilation) where T : ISymbol
Shared\Extensions\SyntaxGeneratorExtensions.cs (20)
43public static ImmutableArray<ISymbol> CreateMemberDelegatingConstructor(
50ImmutableDictionary<string, ISymbol>? parameterToExistingMemberMap,
81IDictionary<string, ISymbol>? parameterToExistingFieldMap)
94.Except(parameterToExistingFieldMap?.Values ?? SpecializedCollections.EmptyEnumerable<ISymbol>())
101public static ImmutableArray<ISymbol> CreateFieldsForParameters(
104using var _ = ArrayBuilder<ISymbol>.GetInstance(out var result);
123public static ImmutableArray<ISymbol> CreatePropertiesForParameters(
126using var _ = ArrayBuilder<ISymbol>.GetInstance(out var result);
161private static bool TryGetValue(IDictionary<string, ISymbol>? dictionary, string key, [NotNullWhen(true)] out string? value)
164if (dictionary != null && dictionary.TryGetValue(key, out var symbol))
216IDictionary<string, ISymbol>? parameterToExistingFieldMap,
466public static async Task<ISymbol> OverrideAsync(
468ISymbol symbol,
496private static DeclarationModifiers GetOverrideModifiers(ISymbol symbol)
556this SyntaxGenerator generator, IMethodSymbol method, ISymbol throughMember)
575this SyntaxGenerator generator, ISymbol member, ISymbol throughMember)
640static SyntaxNode GenerateContainerName(SyntaxGenerator factory, ISymbol throughMember)
651IPropertySymbol property, ISymbol? throughMember, bool preferAutoProperties)
675IPropertySymbol property, ISymbol? throughMember, bool preferAutoProperties)
SymbolKey.cs (30)
30/// the "same" <see cref="ISymbol.ContainingType"/> and
31/// equal <see cref="ISymbol.MetadataName"/>.</item>
33/// the "same" <see cref="ISymbol.ContainingType"/>,
34/// equal <see cref="ISymbol.MetadataName"/>,
40/// the "same" <see cref="ISymbol.ContainingAssembly"/>.
41/// <see cref="ISymbol.MetadataName"/> is not used because module identity is not important in practice.</item>
43/// the "same" <see cref="ISymbol.ContainingSymbol"/>,
44/// equal <see cref="ISymbol.MetadataName"/>,
48/// the "same" <see cref="ISymbol.ContainingSymbol"/> and
49/// equal <see cref="ISymbol.MetadataName"/>.
54/// the "same" <see cref="ISymbol.ContainingSymbol"/> and
55/// equal <see cref="ISymbol.MetadataName"/>.</item>
59/// the "same" the "same" <see cref="ISymbol.ContainingType"/>,
60/// the "same" <see cref="ISymbol.MetadataName"/>, and have
64/// the "same" <see cref="ISymbol.ContainingSymbol"/> and
65/// the "same" <see cref="ISymbol.MetadataName"/>.</item>
67/// the "same" <see cref="ISymbol.ContainingSymbol"/> and
68/// the "same" <see cref="ISymbol.MetadataName"/>.</item>
75/// cref="SyntaxTree"/> is enumerated to list all the symbols with the same <see cref="ISymbol.Name"/> and <see
76/// cref="ISymbol.Kind"/> as the original symbol. The symbol with the same index in the destination tree as the
134public static SymbolKey Create(ISymbol? symbol, CancellationToken cancellationToken = default)
153public static bool CanCreate(ISymbol symbol, CancellationToken cancellationToken)
206public static string CreateString(ISymbol? symbol, CancellationToken cancellationToken = default)
210internal static string CreateStringWorker(int version, ISymbol? symbol, CancellationToken cancellationToken = default)
237/// to the corresponding <see cref="ISymbol"/> in a future <see cref="Compilation"/>.
248where TSymbol : class, ISymbol
264ImmutableArray<ISymbol>.CastUp(symbols.Builder.ToImmutable()),
301string? metadataName) where TSymbol : ISymbol
310foreach (var member in members)
320public static bool IsBodyLevelSymbol(ISymbol symbol)
SymbolKey.SymbolKeyReader.cs (14)
332private readonly Stack<ISymbol?> _contextualSymbolStack = new();
385where TOwningSymbol : ISymbol
425public ContextualSymbolPopper PushContextualSymbol(ISymbol? contextualSymbol)
431private void PopContextualSymbol(ISymbol? contextualSymbol)
438public ISymbol? CurrentContextualSymbol
459private readonly ISymbol? _contextualSymbol;
461public ContextualSymbolPopper(SymbolKeyReader reader, ISymbol? contextualSymbol)
486public SymbolKeyResolution ReadSymbolKey(ISymbol? contextualSymbol, out string? failureReason)
556Func<TContextualSymbol, int, ISymbol?>? getContextualSymbol,
575var nextContextualSymbol = contextualSymbol is null ? null : getContextualSymbol?.Invoke(contextualSymbol, i);
608Func<TContextualSymbol, int, ISymbol?>? getContextualSymbol,
610where TContextualSymbol : ISymbol
611where TSymbol : ISymbol
746var symbol = semanticModel.GetDeclaredSymbol(node, CancellationToken);
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)
199public void OnWriteReferenceFound(ISymbol symbol, IOperation operation, bool maybeWritten, bool isRef)
235foreach (var symbol in SymbolsWriteBuilder.Keys.Select(d => d.symbol).ToArray())
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(),
216private PooledHashSet<(ISymbol, IOperation)> GetOrCreateSymbolWritesInBlockRange(int firstBlockOrdinal, int lastBlockOrdinal, CancellationToken cancellationToken)
225writesInBlockRange = PooledHashSet<(ISymbol, IOperation)>.GetInstance();
461public override void OnLValueCaptureFound(ISymbol symbol, IOperation operation, CaptureId captureId)
465captures = PooledHashSet<(ISymbol, IOperation)>.GetInstance();
513public override void SetTargetsFromSymbolForDelegate(IOperation write, ISymbol symbol)
SymbolUsageAnalysis.OperationTreeAnalysisData.cs (8)
24PooledDictionary<(ISymbol symbol, IOperation operation), bool> symbolsWriteMap,
25PooledHashSet<ISymbol> symbolsRead,
35protected override PooledHashSet<ISymbol> SymbolsReadBuilder { get; }
37protected override PooledDictionary<(ISymbol symbol, IOperation operation), bool> SymbolsWriteBuilder { get; }
42ISymbol owningSymbol,
47symbolsRead: PooledHashSet<ISymbol>.GetInstance(),
66public override void OnLValueCaptureFound(ISymbol symbol, IOperation operation, CaptureId captureId)
78public override void SetTargetsFromSymbolForDelegate(IOperation write, ISymbol symbol)
SymbolUsageAnalysis.Walker.cs (13)
27private ISymbol _currentContainingSymbol;
30private PooledDictionary<IAssignmentOperation, PooledHashSet<(ISymbol, IOperation)>> _pendingWritesMap;
36ISymbol containingSymbol,
52private void Visit(ISymbol containingSymbol, IEnumerable<IOperation> operations, AnalysisData analysisData, CancellationToken cancellationToken)
59_pendingWritesMap = PooledDictionary<IAssignmentOperation, PooledHashSet<(ISymbol, IOperation)>>.GetInstance();
91private void OnReadReferenceFound(ISymbol symbol)
94private void OnWriteReferenceFound(ISymbol symbol, IOperation operation, ValueUsageInfo valueUsageInfo)
102private void OnLValueCaptureFound(ISymbol symbol, IOperation operation, CaptureId captureId)
108private void OnReferenceFound(ISymbol symbol, IOperation operation)
160private bool MakePendingWrite(IOperation operation, ISymbol symbolOpt)
167var set = PooledHashSet<(ISymbol, IOperation)>.GetInstance();
176set = PooledHashSet<(ISymbol, IOperation)>.GetInstance();
380private void ProcessPossibleDelegateCreationAssignment(ISymbol symbol, IOperation write)
Workspace\Solution\SolutionState.UnrootedSymbolSet.cs (14)
17/// A helper type for mapping <see cref="ISymbol"/> back to an originating <see cref="Project"/>.
20/// In IDE scenarios we have the need to map from an <see cref="ISymbol"/> to the <see cref="Project"/> that
28/// cref="ISymbol"/>. In other words, the <see cref="ISymbol"/> doesn't <c>root</c> the compilation. Because
54public readonly ImmutableArray<(int hashCode, WeakReference<ISymbol> symbol)> SecondaryReferencedSymbols;
59ImmutableArray<(int hashCode, WeakReference<ISymbol> symbol)> secondaryReferencedSymbols)
77using var _ = ArrayBuilder<(int hashcode, WeakReference<ISymbol> symbol)>.GetInstance(
82var symbol = compilation.GetAssemblyOrModuleSymbol(reference);
86secondarySymbols.Add((ReferenceEqualityComparer.GetHashCode(symbol), new WeakReference<ISymbol>(symbol)));
96public bool ContainsAssemblyOrModuleOrDynamic(ISymbol symbol, bool primary)
124if (cached.TryGetTarget(out var otherSymbol) && otherSymbol == symbol)
134private class WeakSymbolComparer : IComparer<(int hashcode, WeakReference<ISymbol> symbol)>
142public int Compare((int hashcode, WeakReference<ISymbol> symbol) x, (int hashcode, WeakReference<ISymbol> symbol) y)
CallHierarchy\Finders\ImplementerFinder.cs (4)
22public ImplementerFinder(ISymbol symbol, ProjectId projectId, IAsynchronousOperationListener asyncListener, CallHierarchyProvider provider)
35protected override Task<IEnumerable<SymbolCallerInfo>> GetCallersAsync(ISymbol symbol, Project project, IImmutableSet<Document> documents, CancellationToken cancellationToken)
38protected override async Task SearchWorkerAsync(ISymbol symbol, Project project, ICallHierarchySearchCallback callback, IImmutableSet<Document> documents, CancellationToken cancellationToken)
42foreach (var implementation in implementations)
CallHierarchy\Finders\OverridingMemberFinder.cs (4)
22public OverridingMemberFinder(ISymbol symbol, ProjectId projectId, IAsynchronousOperationListener asyncListener, CallHierarchyProvider provider)
31protected override Task<IEnumerable<SymbolCallerInfo>> GetCallersAsync(ISymbol symbol, Project project, IImmutableSet<Document> documents, CancellationToken cancellationToken)
34protected override async Task SearchWorkerAsync(ISymbol symbol, Project project, ICallHierarchySearchCallback callback, IImmutableSet<Document> documents, CancellationToken cancellationToken)
38foreach (var @override in overrides)
Implementation\VsRefactorNotifyService.cs (5)
36public bool TryOnBeforeGlobalSymbolRenamed(Workspace workspace, IEnumerable<DocumentId> changedDocumentIDs, ISymbol symbol, string newName, bool throwOnFailure)
73public bool TryOnAfterGlobalSymbolRenamed(Workspace workspace, IEnumerable<DocumentId> changedDocumentIDs, ISymbol symbol, string newName, bool throwOnFailure)
112ISymbol symbol,
131ISymbol symbol,
159private static bool TryGetRenamingRQNameForSymbol(ISymbol symbol, out string rqname)
Library\ObjectBrowser\AbstractListItemFactory.cs (20)
65protected abstract string GetMemberDisplayString(ISymbol memberSymbol);
66protected abstract string GetMemberAndTypeDisplayString(ISymbol memberSymbol);
68protected MemberListItem CreateFullyQualifiedMemberListItem(ISymbol memberSymbol, ProjectId projectId, bool hidden)
77protected MemberListItem CreateInheritedMemberListItem(ISymbol memberSymbol, ProjectId projectId, bool hidden)
80protected MemberListItem CreateSimpleMemberListItem(ISymbol memberSymbol, ProjectId projectId, bool hidden)
83private MemberListItem CreateMemberListItem(ISymbol memberSymbol, ProjectId projectId, bool hidden, bool isInherited)
130private static bool IncludeSymbol(ISymbol symbol)
136private static bool IncludeMemberSymbol(ISymbol symbol, IAssemblySymbol assemblySymbol)
172where TSymbol : class, ISymbol
187where TSymbol : class, ISymbol
316private static ImmutableArray<ISymbol> GetMemberSymbols(INamedTypeSymbol namedTypeSymbol, Compilation compilation)
319var symbolBuilder = ImmutableArray.CreateBuilder<ISymbol>(members.Length);
321foreach (var member in members)
332private static ImmutableArray<ISymbol> GetInheritedMemberSymbols(INamedTypeSymbol namedTypeSymbol, Compilation compilation)
334var symbolBuilder = ImmutableArray.CreateBuilder<ISymbol>();
336HashSet<ISymbol> overriddenMembers = null;
343foreach (var member in baseType.GetMembers())
376private static void AddOverriddenMembers(INamedTypeSymbol namedTypeSymbol, ref HashSet<ISymbol> overriddenMembers)
378foreach (var member in namedTypeSymbol.GetMembers())
382for (var overriddenMember = member.GetOverriddenMember(); overriddenMember != null; overriddenMember = overriddenMember.GetOverriddenMember())
Progression\GraphBuilder.cs (12)
35private readonly Dictionary<GraphNode, ISymbol> _nodeToSymbolMap = new();
119var symbol = symbolId.Value.Resolve(compilation, cancellationToken: cancellationToken).Symbol;
146public ProjectId GetContextProjectId(Project project, ISymbol symbol)
161public ISymbol GetSymbol(GraphNode node, CancellationToken cancellationToken)
165_nodeToSymbolMap.TryGetValue(node, out var symbol);
170public Task<GraphNode> AddNodeAsync(ISymbol symbol, GraphNode relatedNode, CancellationToken cancellationToken)
182ISymbol symbol, Project contextProject, Document contextDocument, CancellationToken cancellationToken)
199var newSymbol = await SymbolFinder.FindSourceDefinitionAsync(symbol, contextProject.Solution, cancellationToken).ConfigureAwait(false);
242internal static async Task<GraphNode> GetOrCreateNodeAsync(Graph graph, ISymbol symbol, Solution solution, CancellationToken cancellationToken)
309private static async Task<GraphNode> GetOrCreateNodeForLocalVariableAsync(Graph graph, ISymbol localSymbol, Solution solution, CancellationToken cancellationToken)
327private static void UpdateLabelsForNode(ISymbol symbol, Solution solution, GraphNode node)
418private static void UpdatePropertiesForNode(ISymbol symbol, GraphNode node)
Venus\ContainedLanguageCodeSupport.cs (10)
97var eventMember = GetEventSymbol(document, objectTypeName, nameOfEvent, type, cancellationToken);
172var eventMember = GetEventSymbol(thisDocument, objectTypeName, nameOfEvent, type, cancellationToken);
267var member = LookupMemberId(type, uniqueMemberID);
325var symbol = FindSymbol(document, clrt, oldFullyQualifiedName, cancellationToken);
366private static bool IncludeMember(ISymbol member, CODEMEMBERTYPE memberType, Compilation compilation)
416private static ISymbol FindSymbol(
451internal static string ConstructMemberId(ISymbol member)
467internal static ISymbol LookupMemberId(INamedTypeSymbol type, string uniqueMemberID)
472foreach (var m in members)
483private static ISymbol GetEventSymbol(