private static async Task AddMetadataDeclarationsWithNormalQueryAsync( Project project, IAssemblySymbol assembly, PortableExecutableReference referenceOpt, SearchQuery query, SymbolFilter filter, ArrayBuilder <ISymbol> list, CancellationToken cancellationToken) { // All entrypoints to this function are Find functions that are only searching // for specific strings (i.e. they never do a custom search). Contract.ThrowIfTrue(query.Kind == SearchKind.Custom, "Custom queries are not supported in this API"); using (Logger.LogBlock(FunctionId.SymbolFinder_Assembly_AddDeclarationsAsync, cancellationToken)) { if (referenceOpt != null) { var info = await SymbolTreeInfo.GetInfoForMetadataReferenceAsync( project.Solution, referenceOpt, loadOnly : false, cancellationToken : cancellationToken).ConfigureAwait(false); var symbols = await info.FindAsync( query, assembly, filter, cancellationToken).ConfigureAwait(false); list.AddRange(symbols); } } }
private static async Task AddDeclarationsAsync( Solution solution, IAssemblySymbol assembly, PortableExecutableReference referenceOpt, SearchQuery query, SymbolFilter filter, ArrayBuilder <ISymbol> list, CancellationToken cancellationToken) { // All entrypoints to this function are Find functions that are only searching // for specific strings (i.e. they never do a custom search). Debug.Assert(query.Kind != SearchKind.Custom); using (Logger.LogBlock(FunctionId.SymbolFinder_Assembly_AddDeclarationsAsync, cancellationToken)) { if (referenceOpt != null) { var info = await SymbolTreeInfo.GetInfoForMetadataReferenceAsync( solution, referenceOpt, loadOnly : false, cancellationToken : cancellationToken).ConfigureAwait(false); if (info != null) { var symbols = await info.FindAsync(query, assembly, filter, cancellationToken).ConfigureAwait(false); list.AddRange(symbols); } } } }
internal bool IsEquivalent(SymbolTreeInfo other) { if (!_version.Equals(other._version) || _nodes.Count != other._nodes.Count) { return false; } for (int i = 0, n = _nodes.Count; i < n; i++) { if (!_nodes[i].IsEquivalent(other._nodes[i])) { return false; } } return true; }
public MetadataInfo(DateTime timeStamp, SymbolTreeInfo info, HashSet<ProjectId> referencingProjects) { TimeStamp = timeStamp; SymbolTreeInfo = info; ReferencingProjects = referencingProjects; }
public ProjectInfo(VersionStamp versionStamp, SymbolTreeInfo info) { VersionStamp = versionStamp; SymbolTreeInfo = info; }
internal void AssertEquivalentTo(SymbolTreeInfo other) { Debug.Assert(_version.Equals(other._version)); Debug.Assert(_concatenatedNames == other._concatenatedNames); Debug.Assert(_nodes.Length == other._nodes.Length); for (int i = 0, n = _nodes.Length; i < n; i++) { _nodes[i].AssertEquivalentTo(other._nodes[i]); } Debug.Assert(_inheritanceMap.Keys.Count == other._inheritanceMap.Keys.Count); var orderedKeys1 = this._inheritanceMap.Keys.Order().ToList(); var orderedKeys2 = other._inheritanceMap.Keys.Order().ToList(); for (int i = 0; i < orderedKeys1.Count; i++) { var values1 = this._inheritanceMap[i]; var values2 = other._inheritanceMap[i]; Debug.Assert(values1.Length == values2.Length); for (int j = 0; j < values1.Length; j++) { Debug.Assert(values1[j] == values2[j]); } } }
private static IEnumerable<ISymbol> Find(SearchQuery query, SymbolTreeInfo info, IAssemblySymbol assembly, CancellationToken cancellationToken) { // If the query has a specific string provided, then call into the SymbolTreeInfo // helpers optimized for lookup based on an exact name. switch (query.Kind) { case SearchKind.Exact: return info.Find(assembly, query.Name, ignoreCase: false, cancellationToken: cancellationToken); case SearchKind.ExactIgnoreCase: return info.Find(assembly, query.Name, ignoreCase: true, cancellationToken: cancellationToken); case SearchKind.Fuzzy: return info.FuzzyFind(assembly, query.Name, cancellationToken); case SearchKind.Custom: // Otherwise, we'll have to do a slow linear search over all possible symbols. return info.Find(assembly, query.GetPredicate(), cancellationToken); } throw new InvalidOperationException(); }