private static string GetItemKind(DeclaredSymbolInfo declaredSymbolInfo) { switch (declaredSymbolInfo.Kind) { case DeclaredSymbolInfoKind.Class: return NavigateToItemKind.Class; case DeclaredSymbolInfoKind.Constant: return NavigateToItemKind.Constant; case DeclaredSymbolInfoKind.Delegate: return NavigateToItemKind.Delegate; case DeclaredSymbolInfoKind.Enum: return NavigateToItemKind.Enum; case DeclaredSymbolInfoKind.EnumMember: return NavigateToItemKind.EnumItem; case DeclaredSymbolInfoKind.Event: return NavigateToItemKind.Event; case DeclaredSymbolInfoKind.Field: return NavigateToItemKind.Field; case DeclaredSymbolInfoKind.Interface: return NavigateToItemKind.Interface; case DeclaredSymbolInfoKind.Constructor: case DeclaredSymbolInfoKind.Method: return NavigateToItemKind.Method; case DeclaredSymbolInfoKind.Module: return NavigateToItemKind.Module; case DeclaredSymbolInfoKind.Indexer: case DeclaredSymbolInfoKind.Property: return NavigateToItemKind.Property; case DeclaredSymbolInfoKind.Struct: return NavigateToItemKind.Structure; default: return Contract.FailWithReturn<string>("Unknown declaration kind " + declaredSymbolInfo.Kind); } }
private static string ConstructSecondarySortString( Document document, DeclaredSymbolInfo declaredSymbolInfo) { var parts = ArrayBuilder<string>.GetInstance(); try { parts.Add(declaredSymbolInfo.ParameterCount.ToString("X4")); parts.Add(declaredSymbolInfo.TypeParameterCount.ToString("X4")); parts.Add(declaredSymbolInfo.Name); // For partial types, we break up the file name into pieces. i.e. If we have // Outer.cs and Outer.Inner.cs then we add "Outer" and "Outer Inner" to // the secondary sort string. That way "Outer.cs" will be weighted above // "Outer.Inner.cs" var fileName = Path.GetFileNameWithoutExtension(document.FilePath ?? ""); parts.AddRange(fileName.Split(s_dotArray)); return string.Join(" ", parts); } finally { parts.Free(); } }
public SearchResult(Document document, DeclaredSymbolInfo declaredSymbolInfo, string kind, MatchKind matchKind, bool isCaseSensitive, INavigableItem navigableItem) { _document = document; _declaredSymbolInfo = declaredSymbolInfo; Kind = kind; MatchKind = matchKind; IsCaseSensitive = isCaseSensitive; NavigableItem = navigableItem; SecondarySort = ConstructSecondarySortString(declaredSymbolInfo); var declaredNavigableItem = navigableItem as NavigableItemFactory.DeclaredSymbolNavigableItem; Debug.Assert(declaredNavigableItem != null); _lazySummary = new Lazy<string>(() => declaredNavigableItem.Symbol?.GetDocumentationComment()?.SummaryText); _lazyAdditionalInfo = new Lazy<string>(() => { switch (declaredSymbolInfo.Kind) { case DeclaredSymbolInfoKind.Class: case DeclaredSymbolInfoKind.Enum: case DeclaredSymbolInfoKind.Interface: case DeclaredSymbolInfoKind.Module: case DeclaredSymbolInfoKind.Struct: return EditorFeaturesResources.Project + document.Project.Name; default: return EditorFeaturesResources.Type + declaredSymbolInfo.ContainerDisplayName; } }); }
public DeclaredSymbolNavigableItem(Document document, DeclaredSymbolInfo declaredSymbolInfo) { Document = document; _declaredSymbolInfo = declaredSymbolInfo; // Cancellation isn't supported when computing the various properties that depend on the symbol, hence // CancellationToken.None. _lazySymbol = new Lazy<ISymbol>(() => declaredSymbolInfo.GetSymbolAsync(document, CancellationToken.None).ConfigureAwait(false).GetAwaiter().GetResult()); _lazyDisplayString = new Lazy<string>(() => { try { if (Symbol == null) { return null; } return GetSymbolDisplayString(Document.Project, Symbol); } catch (Exception e) when (FatalError.Report(e)) { throw ExceptionUtilities.Unreachable; } }); }
private static string ConstructSecondarySortString(DeclaredSymbolInfo declaredSymbolInfo) { var secondarySortString = string.Concat( declaredSymbolInfo.ParameterCount.ToString("X4"), declaredSymbolInfo.TypeParameterCount.ToString("X4"), declaredSymbolInfo.Name); return secondarySortString; }
private static async Task <SymbolAndProjectIdSet> ProcessSymbolInfo( Document document, DeclaredSymbolInfo info, SymbolAndProjectIdSet typesToSearchFor, InheritanceQuery inheritanceQuery, ConcurrentSet <SemanticModel> cachedModels, Func <SymbolAndProjectIdSet, INamedTypeSymbol, bool> typeImmediatelyMatches, SymbolAndProjectIdSet result, CancellationToken cancellationToken) { var projectId = document.Project.Id; // If we're searching for enums/structs/delegates, then we can just look at the kind of // the info to see if we have a match. if ((inheritanceQuery.DerivesFromSystemEnum && info.Kind == DeclaredSymbolInfoKind.Enum) || (inheritanceQuery.DerivesFromSystemValueType && info.Kind == DeclaredSymbolInfoKind.Struct) || (inheritanceQuery.DerivesFromSystemMulticastDelegate && info.Kind == DeclaredSymbolInfoKind.Delegate)) { var symbol = await ResolveAsync(document, info, cachedModels, cancellationToken).ConfigureAwait(false) as INamedTypeSymbol; if (symbol != null) { result = result ?? CreateSymbolAndProjectIdSet(); result.Add(SymbolAndProjectId.Create(symbol, projectId)); } } else if (inheritanceQuery.DerivesFromSystemObject && info.Kind == DeclaredSymbolInfoKind.Class) { // Searching for types derived from 'Object' needs to be handled specially. // There may be no indication in source what the type actually derives from. // Also, we can't just look for an empty inheritance list. We may have // something like: "class C : IFoo". This type derives from object, despite // having a non-empty list. var symbol = await ResolveAsync(document, info, cachedModels, cancellationToken).ConfigureAwait(false) as INamedTypeSymbol; if (symbol?.BaseType?.SpecialType == SpecialType.System_Object) { result = result ?? CreateSymbolAndProjectIdSet(); result.Add(SymbolAndProjectId.Create(symbol, projectId)); } } else if (AnyInheritanceNamesMatch(info, inheritanceQuery.TypeNames)) { // Looks like we have a potential match. Actually check if the symbol is viable. var symbol = await ResolveAsync(document, info, cachedModels, cancellationToken).ConfigureAwait(false) as INamedTypeSymbol; if (symbol != null) { if (typeImmediatelyMatches(typesToSearchFor, symbol)) { result = result ?? CreateSymbolAndProjectIdSet(); result.Add(SymbolAndProjectId.Create(symbol, projectId)); } } } return(result); }
private static async Task <ISymbol> ResolveAsync( Document document, DeclaredSymbolInfo info, ConcurrentSet <SemanticModel> cachedModels, CancellationToken cancellationToken) { var semanticModel = await document.GetSemanticModelAsync(cancellationToken).ConfigureAwait(false); cachedModels.Add(semanticModel); return(info.Resolve(semanticModel, cancellationToken)); }
private static IEnumerable<PatternMatch> TryGetDotSeparatedPatternMatches( PatternMatcher patternMatcher, string[] dotSeparatedPatternComponents, DeclaredSymbolInfo declaredSymbolInfo) { if (dotSeparatedPatternComponents == null || declaredSymbolInfo.FullyQualifiedContainerName == null || declaredSymbolInfo.Name == null) { return null; } // First, check that the last part of the dot separated pattern matches the name of the // declared symbol. If not, then there's no point in proceeding and doing the more // expensive work. var symbolNameMatch = patternMatcher.MatchPattern(GetSearchName(declaredSymbolInfo), dotSeparatedPatternComponents.Last()); if (symbolNameMatch == null) { return null; } // So far so good. Now break up the container for the symbol and check if all // the dotted parts match up correctly. var totalMatch = symbolNameMatch.ToList(); var containerParts = declaredSymbolInfo.FullyQualifiedContainerName .Split(DotArray, StringSplitOptions.RemoveEmptyEntries) .ToList(); // -1 because the last part was checked against hte name, and only the rest // of the parts are checked against the container. if (dotSeparatedPatternComponents.Length - 1 > containerParts.Count) { // There weren't enough container parts to match against the pattern parts. // So this definitely doesn't match. return null; } for (int i = dotSeparatedPatternComponents.Length - 2, j = containerParts.Count - 1; i >= 0; i--, j--) { var dotPattern = dotSeparatedPatternComponents[i]; var containerName = containerParts[j]; var containerMatch = patternMatcher.MatchPattern(containerName, dotPattern); if (containerMatch == null) { // This container didn't match the pattern piece. So there's no match at all. return null; } totalMatch.AddRange(containerMatch); } // Success, this symbol's full name matched against the dotted name the user was asking // about. return totalMatch; }
private static string GetSearchName(DeclaredSymbolInfo declaredSymbolInfo) { if (declaredSymbolInfo.Kind == DeclaredSymbolInfoKind.Indexer && declaredSymbolInfo.Name == WellKnownMemberNames.Indexer) { return "this"; } else { return declaredSymbolInfo.Name; } }
private static bool AnyInheritanceNamesMatch( DeclaredSymbolInfo info, HashSet <string> typeNamesToSearchFor) { foreach (var name in info.InheritanceNames) { if (typeNamesToSearchFor.Contains(name)) { return(true); } } return(false); }
private static INavigateToSearchResult ConvertResult( bool containsDots, DeclaredSymbolInfo declaredSymbolInfo, Document document, PatternMatches matches) { var matchKind = GetNavigateToMatchKind(containsDots, matches); // A match is considered to be case sensitive if all its constituent pattern matches are // case sensitive. var isCaseSensitive = matches.All(m => m.IsCaseSensitive); var kind = GetItemKind(declaredSymbolInfo); var navigableItem = NavigableItemFactory.GetItemFromDeclaredSymbolInfo(declaredSymbolInfo, document); return new SearchResult(document, declaredSymbolInfo, kind, matchKind, isCaseSensitive, navigableItem); }
private static SyntaxTreeDeclarationInfo ReadFrom(ObjectReader reader, VersionStamp version) { try { var declaredSymbolCount = reader.ReadInt32(); var declaredSymbols = new DeclaredSymbolInfo[declaredSymbolCount]; for (int i = 0; i < declaredSymbolCount; i++) { declaredSymbols[i] = DeclaredSymbolInfo.ReadFrom(reader); } return(new SyntaxTreeDeclarationInfo(version, declaredSymbols)); } catch (Exception) { } return(null); }
public static DeclarationInfo?ReadFrom(ObjectReader reader) { try { var declaredSymbolCount = reader.ReadInt32(); var builder = ImmutableArray.CreateBuilder <DeclaredSymbolInfo>(declaredSymbolCount); for (int i = 0; i < declaredSymbolCount; i++) { builder.Add(DeclaredSymbolInfo.ReadFrom(reader)); } return(new DeclarationInfo(builder.MoveToImmutable())); } catch (Exception) { } return(null); }
private static SyntaxTreeDeclarationInfo ReadFrom(ObjectReader reader, VersionStamp version) { try { var declaredSymbolCount = reader.ReadInt32(); var declaredSymbols = new DeclaredSymbolInfo[declaredSymbolCount]; for (int i = 0; i < declaredSymbolCount; i++) { declaredSymbols[i] = DeclaredSymbolInfo.ReadFrom(reader); } return new SyntaxTreeDeclarationInfo(version, declaredSymbols); } catch (Exception) { } return null; }
public static DeclarationInfo?TryReadFrom(StringTable stringTable, ObjectReader reader) { try { var declaredSymbolCount = reader.ReadInt32(); var builder = ImmutableArray.CreateBuilder <DeclaredSymbolInfo>(declaredSymbolCount); for (var i = 0; i < declaredSymbolCount; i++) { builder.Add(DeclaredSymbolInfo.ReadFrom_ThrowsOnFailure(stringTable, reader)); } return(new DeclarationInfo(builder.MoveToImmutable())); } catch (Exception) { } return(null); }
private static SyntaxTreeDeclarationInfo ReadFrom(ObjectReader reader, VersionStamp version) { try { var declaredSymbolCount = reader.ReadInt32(); var builder = ImmutableArray.CreateBuilder <DeclaredSymbolInfo>(declaredSymbolCount); for (int i = 0; i < declaredSymbolCount; i++) { builder.Add(DeclaredSymbolInfo.ReadFrom(reader)); } return(new SyntaxTreeDeclarationInfo( version, builder.MoveToImmutable())); } catch (Exception) { } return(null); }
private static IEnumerable<PatternMatch> TryMatch( string pattern, string[] dotSeparatedPatternComponents, PatternMatcher patternMatcher, DeclaredSymbolInfo declaredSymbolInfo) { var matches1 = TryGetDotSeparatedPatternMatches(patternMatcher, dotSeparatedPatternComponents, declaredSymbolInfo); var matches2 = patternMatcher.MatchPattern(GetSearchName(declaredSymbolInfo), pattern); if (matches1 == null) { return matches2; } if (matches2 == null) { return matches1; } return matches1.Concat(matches2); }
public DeclaredSymbolNavigableItem(Document document, DeclaredSymbolInfo declaredSymbolInfo) { Document = document; _declaredSymbolInfo = declaredSymbolInfo; // Cancellation isn't supported when computing the various properties that depend on the symbol, hence // CancellationToken.None. _lazySymbol = new Lazy<ISymbol>(() => declaredSymbolInfo.GetSymbolAsync(document, CancellationToken.None).ConfigureAwait(false).GetAwaiter().GetResult()); _lazyDisplayName = new Lazy<string>(() => { try { if (Symbol == null) { return null; } var symbolDisplayService = Document.GetLanguageService<ISymbolDisplayService>(); switch (Symbol.Kind) { case SymbolKind.NamedType: return symbolDisplayService.ToDisplayString(Symbol, s_shortFormatWithModifiers); case SymbolKind.Method: return Symbol.IsStaticConstructor() ? symbolDisplayService.ToDisplayString(Symbol, s_shortFormatWithModifiers) : symbolDisplayService.ToDisplayString(Symbol, s_shortFormat); default: return symbolDisplayService.ToDisplayString(Symbol, s_shortFormat); } } catch (Exception e) when (FatalError.Report(e)) { throw ExceptionUtilities.Unreachable; } }); }
public DeclaredSymbolNavigableItem(Document document, DeclaredSymbolInfo declaredSymbolInfo) { Document = document; _declaredSymbolInfo = declaredSymbolInfo; _lazySymbol = new Lazy<ISymbol>(FindSymbol); _lazyDisplayString = new Lazy<string>(() => { try { if (Symbol == null) { return null; } return GetSymbolDisplayString(Document.Project, Symbol); } catch (Exception e) when (FatalError.Report(e)) { throw ExceptionUtilities.Unreachable; } }); }
public DeclaredSymbolNavigableItem(Document document, DeclaredSymbolInfo declaredSymbolInfo) { Document = document; _declaredSymbolInfo = declaredSymbolInfo; _lazySymbol = new Lazy<ISymbol>(FindSymbol); _lazyDisplayTaggedParts = new Lazy<ImmutableArray<TaggedText>>(() => { try { if (Symbol == null) { return default(ImmutableArray<TaggedText>); } return GetSymbolDisplayTaggedParts(Document.Project, Symbol); } catch (Exception e) when (FatalError.Report(e)) { throw ExceptionUtilities.Unreachable; } }); }
public bool TryGetDeclaredSymbolInfo(SyntaxNode node, out DeclaredSymbolInfo declaredSymbolInfo) { switch (node.Kind()) { case SyntaxKind.ClassDeclaration: var classDecl = (ClassDeclarationSyntax)node; declaredSymbolInfo = new DeclaredSymbolInfo(classDecl.Identifier.ValueText, GetContainerDisplayName(node.Parent), GetFullyQualifiedContainerName(node.Parent), DeclaredSymbolInfoKind.Class, classDecl.Identifier.Span, GetInheritanceNames(classDecl.BaseList)); return true; case SyntaxKind.ConstructorDeclaration: var ctorDecl = (ConstructorDeclarationSyntax)node; declaredSymbolInfo = new DeclaredSymbolInfo( ctorDecl.Identifier.ValueText, GetContainerDisplayName(node.Parent), GetFullyQualifiedContainerName(node.Parent), DeclaredSymbolInfoKind.Constructor, ctorDecl.Identifier.Span, inheritanceNames: ImmutableArray<string>.Empty, parameterCount: (ushort)(ctorDecl.ParameterList?.Parameters.Count ?? 0)); return true; case SyntaxKind.DelegateDeclaration: var delegateDecl = (DelegateDeclarationSyntax)node; declaredSymbolInfo = new DeclaredSymbolInfo(delegateDecl.Identifier.ValueText, GetContainerDisplayName(node.Parent), GetFullyQualifiedContainerName(node.Parent), DeclaredSymbolInfoKind.Delegate, delegateDecl.Identifier.Span, inheritanceNames: ImmutableArray<string>.Empty); return true; case SyntaxKind.EnumDeclaration: var enumDecl = (EnumDeclarationSyntax)node; declaredSymbolInfo = new DeclaredSymbolInfo(enumDecl.Identifier.ValueText, GetContainerDisplayName(node.Parent), GetFullyQualifiedContainerName(node.Parent), DeclaredSymbolInfoKind.Enum, enumDecl.Identifier.Span, inheritanceNames: ImmutableArray<string>.Empty); return true; case SyntaxKind.EnumMemberDeclaration: var enumMember = (EnumMemberDeclarationSyntax)node; declaredSymbolInfo = new DeclaredSymbolInfo(enumMember.Identifier.ValueText, GetContainerDisplayName(node.Parent), GetFullyQualifiedContainerName(node.Parent), DeclaredSymbolInfoKind.EnumMember, enumMember.Identifier.Span, inheritanceNames: ImmutableArray<string>.Empty); return true; case SyntaxKind.EventDeclaration: var eventDecl = (EventDeclarationSyntax)node; declaredSymbolInfo = new DeclaredSymbolInfo(ExpandExplicitInterfaceName(eventDecl.Identifier.ValueText, eventDecl.ExplicitInterfaceSpecifier), GetContainerDisplayName(node.Parent), GetFullyQualifiedContainerName(node.Parent), DeclaredSymbolInfoKind.Event, eventDecl.Identifier.Span, inheritanceNames: ImmutableArray<string>.Empty); return true; case SyntaxKind.IndexerDeclaration: var indexerDecl = (IndexerDeclarationSyntax)node; declaredSymbolInfo = new DeclaredSymbolInfo(WellKnownMemberNames.Indexer, GetContainerDisplayName(node.Parent), GetFullyQualifiedContainerName(node.Parent), DeclaredSymbolInfoKind.Indexer, indexerDecl.ThisKeyword.Span, inheritanceNames: ImmutableArray<string>.Empty); return true; case SyntaxKind.InterfaceDeclaration: var interfaceDecl = (InterfaceDeclarationSyntax)node; declaredSymbolInfo = new DeclaredSymbolInfo(interfaceDecl.Identifier.ValueText, GetContainerDisplayName(node.Parent), GetFullyQualifiedContainerName(node.Parent), DeclaredSymbolInfoKind.Interface, interfaceDecl.Identifier.Span, GetInheritanceNames(interfaceDecl.BaseList)); return true; case SyntaxKind.MethodDeclaration: var method = (MethodDeclarationSyntax)node; declaredSymbolInfo = new DeclaredSymbolInfo( ExpandExplicitInterfaceName(method.Identifier.ValueText, method.ExplicitInterfaceSpecifier), GetContainerDisplayName(node.Parent), GetFullyQualifiedContainerName(node.Parent), DeclaredSymbolInfoKind.Method, method.Identifier.Span, inheritanceNames: ImmutableArray<string>.Empty, parameterCount: (ushort)(method.ParameterList?.Parameters.Count ?? 0), typeParameterCount: (ushort)(method.TypeParameterList?.Parameters.Count ?? 0)); return true; case SyntaxKind.PropertyDeclaration: var property = (PropertyDeclarationSyntax)node; declaredSymbolInfo = new DeclaredSymbolInfo(ExpandExplicitInterfaceName(property.Identifier.ValueText, property.ExplicitInterfaceSpecifier), GetContainerDisplayName(node.Parent), GetFullyQualifiedContainerName(node.Parent), DeclaredSymbolInfoKind.Property, property.Identifier.Span, inheritanceNames: ImmutableArray<string>.Empty); return true; case SyntaxKind.StructDeclaration: var structDecl = (StructDeclarationSyntax)node; declaredSymbolInfo = new DeclaredSymbolInfo(structDecl.Identifier.ValueText, GetContainerDisplayName(node.Parent), GetFullyQualifiedContainerName(node.Parent), DeclaredSymbolInfoKind.Struct, structDecl.Identifier.Span, GetInheritanceNames(structDecl.BaseList)); return true; case SyntaxKind.VariableDeclarator: // could either be part of a field declaration or an event field declaration var variableDeclarator = (VariableDeclaratorSyntax)node; var variableDeclaration = variableDeclarator.Parent as VariableDeclarationSyntax; var fieldDeclaration = variableDeclaration?.Parent as BaseFieldDeclarationSyntax; if (fieldDeclaration != null) { var kind = fieldDeclaration is EventFieldDeclarationSyntax ? DeclaredSymbolInfoKind.Event : fieldDeclaration.Modifiers.Any(m => m.Kind() == SyntaxKind.ConstKeyword) ? DeclaredSymbolInfoKind.Constant : DeclaredSymbolInfoKind.Field; declaredSymbolInfo = new DeclaredSymbolInfo( variableDeclarator.Identifier.ValueText, GetContainerDisplayName(fieldDeclaration.Parent), GetFullyQualifiedContainerName(fieldDeclaration.Parent), kind, variableDeclarator.Identifier.Span, inheritanceNames: ImmutableArray<string>.Empty); return true; } break; } declaredSymbolInfo = default(DeclaredSymbolInfo); return false; }
public bool TryGetDeclaredSymbolInfo(SyntaxNode node, out DeclaredSymbolInfo declaredSymbolInfo) { throw new NotImplementedException(); }
public static INavigableItem GetItemFromDeclaredSymbolInfo(DeclaredSymbolInfo declaredSymbolInfo, Document document) { return new DeclaredSymbolNavigableItem(document, declaredSymbolInfo); }
private static async Task<HashSet<INamedTypeSymbol>> ProcessSymbolInfo( Document document, DeclaredSymbolInfo info, HashSet<INamedTypeSymbol> typesToSearchFor, InheritanceQuery inheritanceQuery, ConcurrentSet<SemanticModel> cachedModels, Func<HashSet<INamedTypeSymbol>, INamedTypeSymbol, bool> typeImmediatelyMatches, HashSet<INamedTypeSymbol> result, CancellationToken cancellationToken) { // If we're searching for enums/structs/delegates, then we can just look at the kind of // the info to see if we have a match. if ((inheritanceQuery.DerivesFromSystemEnum && info.Kind == DeclaredSymbolInfoKind.Enum) || (inheritanceQuery.DerivesFromSystemValueType && info.Kind == DeclaredSymbolInfoKind.Struct) || (inheritanceQuery.DerivesFromSystemMulticastDelegate && info.Kind == DeclaredSymbolInfoKind.Delegate)) { var symbol = await ResolveAsync(document, info, cachedModels, cancellationToken).ConfigureAwait(false) as INamedTypeSymbol; if (symbol != null) { result = result ?? new HashSet<INamedTypeSymbol>(); result.Add(symbol); } } else if (inheritanceQuery.DerivesFromSystemObject && info.Kind == DeclaredSymbolInfoKind.Class) { // Searching for types derived from 'Object' needs to be handled specially. // There may be no indication in source what the type actually derives from. // Also, we can't just look for an empty inheritance list. We may have // something like: "class C : IFoo". This type derives from object, despite // having a non-empty list. var symbol = await ResolveAsync(document, info, cachedModels, cancellationToken).ConfigureAwait(false) as INamedTypeSymbol; if (symbol?.BaseType?.SpecialType == SpecialType.System_Object) { result = result ?? new HashSet<INamedTypeSymbol>(); result.Add(symbol); } } else if (AnyInheritanceNamesMatch(info, inheritanceQuery.TypeNames)) { // Looks like we have a potential match. Actually check if the symbol is viable. var symbol = await ResolveAsync(document, info, cachedModels, cancellationToken).ConfigureAwait(false) as INamedTypeSymbol; if (symbol != null) { if (typeImmediatelyMatches(typesToSearchFor, symbol)) { result = result ?? new HashSet<INamedTypeSymbol>(); result.Add(symbol); } } } return result; }
private static bool AnyInheritanceNamesMatch( DeclaredSymbolInfo info, HashSet<string> typeNamesToSearchFor) { foreach (var name in info.InheritanceNames) { if (typeNamesToSearchFor.Contains(name)) { return true; } } return false; }
private static async Task<ISymbol> ResolveAsync( Document document, DeclaredSymbolInfo info, ConcurrentSet<SemanticModel> cachedModels, CancellationToken cancellationToken) { var semanticModel = await document.GetSemanticModelAsync(cancellationToken).ConfigureAwait(false); cachedModels.Add(semanticModel); return info.Resolve(semanticModel, cancellationToken); }