private static async Task<IEnumerable<ISymbol>> FindDeclarationsAsyncImpl( Project project, string name, bool ignoreCase, SymbolFilter criteria, CancellationToken cancellationToken) { var compilation = await project.GetCompilationAsync(cancellationToken).ConfigureAwait(false); var list = new List<ISymbol>(); // get declarations from the compilation's assembly await AddDeclarationsAsync(project, name, ignoreCase, criteria, list, cancellationToken).ConfigureAwait(false); // get declarations from directly referenced projects and metadata foreach (var assembly in compilation.GetReferencedAssemblySymbols()) { var assemblyProject = project.Solution.GetProject(assembly, cancellationToken); if (assemblyProject != null) { await AddDeclarationsAsync(assemblyProject, compilation, assembly, name, ignoreCase, criteria, list, cancellationToken).ConfigureAwait(false); } else { await AddDeclarationsAsync(project.Solution, assembly, GetMetadataReferenceFilePath(compilation.GetMetadataReference(assembly)), name, ignoreCase, criteria, list, cancellationToken).ConfigureAwait(false); } } return TranslateNamespaces(list, compilation); }
public override bool MatchFilter(SymbolFilter filter) { if ((filter & SymbolFilter.Members) == 0) { return false; } SymbolFilter memberTypeFilter = (filter & SymbolFilter.AnyMember); if ((memberTypeFilter == SymbolFilter.InstanceMembers) && ((_visibility & MemberVisibility.Static) != 0)) { // Filter specifies member should be an instance member; // Visibility of member indicates it is a static member. return false; } if ((memberTypeFilter == SymbolFilter.StaticMembers) && ((_visibility & MemberVisibility.Static) == 0)) { // Filter specifies member should be a static member; // Visibility of member indicates it is an instance member. return false; } SymbolFilter visibilityFilter = (filter & SymbolFilter.AnyVisibility); if ((visibilityFilter == SymbolFilter.Public) && ((_visibility & (MemberVisibility.Public | MemberVisibility.Internal)) == 0)) { // Filter specifies member should be public; // Visibility of member indicates it is not public or internal return false; } if ((visibilityFilter == (SymbolFilter.Public | SymbolFilter.Protected)) && ((_visibility & (MemberVisibility.Public | MemberVisibility.Internal | MemberVisibility.Protected)) == 0)) { // Filter specifies member should be public or protected; // Visibility of member indicates it is not public, internal or protected return false; } return true; }
public override bool MatchFilter(SymbolFilter filter) { if ((filter & SymbolFilter.Locals) == 0) { return false; } return true; }
public async Task<IEnumerable<ISymbol>> FindAsync( SearchQuery query, AsyncLazy<IAssemblySymbol> lazyAssembly, SymbolFilter filter, CancellationToken cancellationToken) { return SymbolFinder.FilterByCriteria( await FindAsyncWorker(query, lazyAssembly, cancellationToken).ConfigureAwait(false), filter); }
Symbol ISymbolTable.FindSymbol(string name, Symbol context, SymbolFilter filter) { Debug.Assert(String.IsNullOrEmpty(name) == false); Debug.Assert(context == null); Debug.Assert(filter == SymbolFilter.Types); if (_typeMap.ContainsKey(name)) { return _typeMap[name]; } return null; }
/// <summary> /// Find the declared symbols from either source, referenced projects or metadata assemblies with the specified name. /// </summary> public static Task<IEnumerable<ISymbol>> FindDeclarationsAsync( Project project, string name, bool ignoreCase, SymbolFilter filter, CancellationToken cancellationToken = default(CancellationToken)) { if (name == null) { throw new ArgumentNullException(nameof(name)); } if (string.IsNullOrWhiteSpace(name)) { return SpecializedTasks.EmptyEnumerable<ISymbol>(); } return FindDeclarationsAsync(project, new SearchQuery(name, ignoreCase), filter, includeDirectReferences: true, cancellationToken: cancellationToken); }
Symbol ISymbolTable.FindSymbol(string name, Symbol context, SymbolFilter filter) { Symbol symbol = null; if ((filter & SymbolFilter.Locals) != 0) { if (_localTable.ContainsKey(name)) { symbol = _localTable[name]; } } if (symbol == null) { Debug.Assert(_parentSymbolTable != null); symbol = _parentSymbolTable.FindSymbol(name, context, filter); } return symbol; }
/// <summary> /// Find the declared symbols from either source, referenced projects or metadata assemblies with the specified name. /// </summary> public static Task<IEnumerable<ISymbol>> FindDeclarationsAsync(Project project, string name, bool ignoreCase, SymbolFilter filter, CancellationToken cancellationToken = default(CancellationToken)) { if (project == null) { throw new ArgumentNullException(nameof(project)); } if (name == null) { throw new ArgumentNullException(nameof(name)); } if (string.IsNullOrWhiteSpace(name)) { return SpecializedTasks.EmptyEnumerable<ISymbol>(); } using (Logger.LogBlock(FunctionId.SymbolFinder_FindDeclarationsAsync, cancellationToken)) { return FindDeclarationsAsyncImpl(project, name, ignoreCase, filter, cancellationToken); } }
private static bool ContainsNameHelper( MergedDeclaration mergedRoot, Func <string, bool> predicate, SymbolFilter filter, Func <SingleDeclaration, bool> typePredicate, CancellationToken cancellationToken) { var includeNamespace = (filter & SymbolFilter.Namespace) == SymbolFilter.Namespace; var includeType = (filter & SymbolFilter.Type) == SymbolFilter.Type; var includeMember = (filter & SymbolFilter.Member) == SymbolFilter.Member; var stack = new Stack <MergedDeclaration>(); stack.Push(mergedRoot); while (stack.Count > 0) { cancellationToken.ThrowIfCancellationRequested(); var current = stack.Pop(); if (current == null) { continue; } if (current.IsNamespace) { if (includeNamespace && predicate(current.Name)) { return(true); } } else { if (includeType && predicate(current.Name)) { return(true); } if (includeMember) { var mergedType = (MergedDeclaration)current; foreach (var typeDecl in mergedType.Declarations) { if (typePredicate(typeDecl)) { return(true); } } } } foreach (var child in current.Children) { if (child is MergedDeclaration childNamespaceOrType) { if (includeMember || includeType || childNamespaceOrType.IsNamespace) { stack.Push(childNamespaceOrType); } } } } return(false); }
internal static async Task <IEnumerable <ISymbol> > FindSourceDeclarationsAsync(Solution solution, SearchQuery query, SymbolFilter filter, CancellationToken cancellationToken) { if (solution == null) { throw new ArgumentNullException(nameof(solution)); } if (query.Name != null && string.IsNullOrWhiteSpace(query.Name)) { return(SpecializedCollections.EmptyEnumerable <ISymbol>()); } using (Logger.LogBlock(FunctionId.SymbolFinder_Solution_Predicate_FindSourceDeclarationsAsync, cancellationToken)) { var result = new List <ISymbol>(); foreach (var projectId in solution.ProjectIds) { var project = solution.GetProject(projectId); var symbols = await FindSourceDeclarationsAsync(project, query, filter, cancellationToken).ConfigureAwait(false); result.AddRange(symbols); } return(result); } }
/// <summary> /// Find the symbols for declarations made in source with a matching name. /// </summary> public static async Task<IEnumerable<ISymbol>> FindSourceDeclarationsAsync(Project project, Func<string, bool> predicate, SymbolFilter filter, CancellationToken cancellationToken = default(CancellationToken)) { if (project == null) { throw new ArgumentNullException(nameof(project)); } if (predicate == null) { throw new ArgumentNullException(nameof(predicate)); } using (Logger.LogBlock(FunctionId.SymbolFinder_Project_Predicate_FindSourceDeclarationsAsync, cancellationToken)) { var result = new List<ISymbol>(); if (!await project.ContainsSymbolsWithNameAsync(predicate, filter, cancellationToken).ConfigureAwait(false)) { return result; } var compilation = await project.GetCompilationAsync(cancellationToken).ConfigureAwait(false); result.AddRange(FilterByCriteria(compilation.GetSymbolsWithName(predicate, filter, cancellationToken), filter)); return result; } }
private static bool MeetCriteria(ISymbol symbol, SymbolFilter filter) { if (IsOn(filter, SymbolFilter.Namespace) && symbol.Kind == SymbolKind.Namespace) { return true; } if (IsOn(filter, SymbolFilter.Type) && symbol is ITypeSymbol) { return true; } if (IsOn(filter, SymbolFilter.Member) && IsNonTypeMember(symbol)) { return true; } return false; }
private static async Task AddDeclarationsAsync(Project project, Compilation startingCompilation, IAssemblySymbol startingAssembly, string name, bool ignoreCase, SymbolFilter filter, List<ISymbol> list, CancellationToken cancellationToken) { Func<string, bool> predicate = n => ignoreCase ? CaseInsensitiveComparison.Comparer.Equals(name, n) : StringComparer.Ordinal.Equals(name, n); using (Logger.LogBlock(FunctionId.SymbolFinder_Project_AddDeclarationsAsync, cancellationToken)) using (var set = SharedPools.Default<HashSet<ISymbol>>().GetPooledObject()) { if (!await project.ContainsSymbolsWithNameAsync(predicate, filter, cancellationToken).ConfigureAwait(false)) { return; } var compilation = await project.GetCompilationAsync(cancellationToken).ConfigureAwait(false); if ((startingCompilation != null) && (startingAssembly != null) && (compilation.Assembly != startingAssembly)) { // Return symbols from skeleton assembly in this case so that symbols have the same language as startingCompilation. list.AddRange( FilterByCriteria(compilation.GetSymbolsWithName(predicate, filter, cancellationToken), filter) .Select(s => s.GetSymbolKey().Resolve(startingCompilation, cancellationToken: cancellationToken).Symbol).WhereNotNull()); } else { list.AddRange(FilterByCriteria(compilation.GetSymbolsWithName(predicate, filter, cancellationToken), filter)); } } }
public override IEnumerable <ISymbol> GetSymbolsWithName(string name, SymbolFilter filter = SymbolFilter.TypeAndMember, CancellationToken cancellationToken = default(CancellationToken)) { throw new NotImplementedException(); }
> FindSourceDeclarationsWithNormalQueryAsync( Project project, string name, bool ignoreCase, SymbolFilter criteria, CancellationToken cancellationToken ) { if (project == null) { throw new ArgumentNullException(nameof(project)); } if (name == null) { throw new ArgumentNullException(nameof(name)); } if (string.IsNullOrWhiteSpace(name)) { return(ImmutableArray <ISymbol> .Empty); } var client = await RemoteHostClient .TryGetClientAsync(project, cancellationToken) .ConfigureAwait(false); if (client != null) { var result = await client .TryInvokeAsync < IRemoteSymbolFinderService, ImmutableArray <SerializableSymbolAndProjectId> >( project.Solution, (service, solutionInfo, cancellationToken) => service.FindProjectSourceDeclarationsWithNormalQueryAsync( solutionInfo, project.Id, name, ignoreCase, criteria, cancellationToken ), cancellationToken ) .ConfigureAwait(false); if (!result.HasValue) { return(ImmutableArray <ISymbol> .Empty); } return(await RehydrateAsync(project.Solution, result.Value, cancellationToken) .ConfigureAwait(false)); } return(await FindSourceDeclarationsWithNormalQueryInCurrentProcessAsync( project, name, ignoreCase, criteria, cancellationToken ) .ConfigureAwait(false)); }
Symbol ISymbolTable.FindSymbol(string name, Symbol context, SymbolFilter filter) { Debug.Assert(String.IsNullOrEmpty(name) == false); Debug.Assert(context != null); Symbol symbol = null; if ((filter & SymbolFilter.Members) != 0) { SymbolFilter baseFilter = filter | SymbolFilter.ExcludeParent; symbol = GetMember(name); if (symbol == null) { TypeSymbol baseType = GetBaseType(); TypeSymbol objectType = (TypeSymbol)((ISymbolTable)this.SymbolSet.SystemNamespace).FindSymbol("Object", null, SymbolFilter.Types); if ((baseType == null) && (this != objectType)) { baseType = objectType; } if (baseType != null) { symbol = ((ISymbolTable)baseType).FindSymbol(name, context, baseFilter); } } if ((symbol != null) && (symbol.MatchFilter(filter) == false)) { symbol = null; } } if ((symbol == null) && (_parentSymbolTable != null) && ((filter & SymbolFilter.ExcludeParent) == 0)) { symbol = _parentSymbolTable.FindSymbol(name, context, filter); } return symbol; }
public LocalExpression(LocalSymbol symbol, SymbolFilter memberMask) : base(ExpressionType.Local, symbol.ValueType, memberMask) { _symbol = symbol; }
/// <summary> /// Finds symbol declarations matching <paramref name="symbolName"/> within given <paramref name="project"/>. /// </summary> public static async Task <IEnumerable <ISymbol> > FindDeclarationsAsync(this Project project, string symbolName, int resultLimit, bool fullMatch, bool matchCase, SymbolFilter filter = SymbolFilter.All, CancellationToken token = default) { var symbols = new SortedSet <ISymbol>(CreateSymbolComparer()); int maxNameLength = 0; var predicate = CreateNameFilter(symbolName, fullMatch, matchCase); foreach (var symbol in await Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.FindSourceDeclarationsAsync(project, predicate, token)) { if (symbols.Count < resultLimit) { symbols.Add(symbol); } else { maxNameLength = symbols.Max.Name.Length; if (symbol.Name.Length < maxNameLength) { symbols.Remove(symbols.Max); symbols.Add(symbol); } } } return(symbols); }
protected override async Task <IEnumerable <ISymbol> > FindDeclarationsAsync(string name, SymbolFilter filter, SearchQuery searchQuery) { var service = _project.Solution.Workspace.Services.GetService <ISymbolTreeInfoCacheService>(); var info = await service.TryGetSourceSymbolTreeInfoAsync(_project, CancellationToken).ConfigureAwait(false); if (info == null) { // Looks like there was nothing in the cache. Return no results for now. return(SpecializedCollections.EmptyEnumerable <ISymbol>()); } // Don't create the assembly until it is actually needed by the SymbolTreeInfo.FindAsync // code. Creating the assembly can be costly and we want to avoid it until it is actually // needed. var lazyAssembly = _projectToAssembly.GetOrAdd(_project, CreateLazyAssembly); return(await info.FindAsync(searchQuery, lazyAssembly, CancellationToken).ConfigureAwait(false)); }
public static T FindSymbol <T>(this ISymbolTable table, string name, Symbol context, SymbolFilter filter) where T : Symbol { return((T)table.FindSymbol(name, context, filter)); }
public override IEnumerable <ISymbol> GetSymbolsWithName(Func <string, bool> predicate, SymbolFilter filter = SymbolFilter.TypeAndMember, CancellationToken cancellationToken = default(CancellationToken)) { if (predicate == null) { throw new ArgumentNullException(nameof(predicate)); } if (filter == SymbolFilter.None) { //throw new ArgumentException(CSharpResources.NoNoneSearchCriteria, nameof(filter)); } //return new SymbolSearcher(this).GetSymbolsWithName(predicate, filter, cancellationToken); throw new NotImplementedException(); }
internal static IEnumerable <ISymbol> FilterByCriteria(IEnumerable <ISymbol> symbols, SymbolFilter criteria) { foreach (var symbol in symbols) { if (symbol.IsImplicitlyDeclared || symbol.IsAccessor()) { continue; } if (MeetCriteria(symbol, criteria)) { yield return(symbol); } } }
/// <summary> /// Find the symbols for declarations made in source with a matching name. /// </summary> public static Task <IEnumerable <ISymbol> > FindSourceDeclarationsAsync(Project project, Func <string, bool> predicate, SymbolFilter filter, CancellationToken cancellationToken = default(CancellationToken)) { return(FindSourceDeclarationsAsync(project, SearchQuery.CreateCustom(predicate), filter, cancellationToken)); }
private static async Task<IEnumerable<ISymbol>> FindSourceDeclarationsAsyncImpl( Solution solution, string name, bool ignoreCase, SymbolFilter filter, CancellationToken cancellationToken) { var result = new List<ISymbol>(); foreach (var projectId in solution.ProjectIds) { var project = solution.GetProject(projectId); var symbols = await FindSourceDeclarationsAsyncImpl(project, name, ignoreCase, filter, cancellationToken).ConfigureAwait(false); result.AddRange(symbols); } return result; }
private static async Task AddDeclarationsAsync(Project project, string name, bool ignoreCase, SymbolFilter filter, List<ISymbol> list, CancellationToken cancellationToken) { await AddDeclarationsAsync(project, null, null, name, ignoreCase, filter, list, cancellationToken).ConfigureAwait(false); }
/// <summary> /// Find the symbols for declarations made in source with a matching name. /// </summary> public static async Task<IEnumerable<ISymbol>> FindSourceDeclarationsAsync(Solution solution, Func<string, bool> predicate, SymbolFilter filter, CancellationToken cancellationToken = default(CancellationToken)) { if (solution == null) { throw new ArgumentNullException(nameof(solution)); } if (predicate == null) { throw new ArgumentNullException(nameof(predicate)); } using (Logger.LogBlock(FunctionId.SymbolFinder_Solution_Predicate_FindSourceDeclarationsAsync, cancellationToken)) { var result = new List<ISymbol>(); foreach (var projectId in solution.ProjectIds) { var project = solution.GetProject(projectId); var symbols = await FindSourceDeclarationsAsync(project, predicate, filter, cancellationToken).ConfigureAwait(false); result.AddRange(symbols); } return result; } }
private static async Task AddDeclarationsAsync( Solution solution, IAssemblySymbol assembly, string filePath, string name, bool ignoreCase, SymbolFilter filter, List<ISymbol> list, CancellationToken cancellationToken) { using (Logger.LogBlock(FunctionId.SymbolFinder_Assembly_AddDeclarationsAsync, cancellationToken)) { var info = await SymbolTreeInfo.GetInfoForAssemblyAsync(solution, assembly, filePath, cancellationToken).ConfigureAwait(false); if (info.HasSymbols(name, ignoreCase)) { list.AddRange(FilterByCriteria(info.Find(assembly, name, ignoreCase, cancellationToken), filter)); } } }
public override bool ContainsSymbolsWithName(string name, SymbolFilter filter = SymbolFilter.TypeAndMember, CancellationToken cancellationToken = default(CancellationToken)) { throw new NotImplementedException(); }
private static async Task<IEnumerable<ISymbol>> FindSourceDeclarationsAsyncImpl( Project project, string name, bool ignoreCase, SymbolFilter filter, CancellationToken cancellationToken) { var list = new List<ISymbol>(); await AddDeclarationsAsync(project, name, ignoreCase, filter, list, cancellationToken).ConfigureAwait(false); return list; }
internal static async Task <IEnumerable <ISymbol> > FindSourceDeclarationsAsync(Project project, SearchQuery query, SymbolFilter filter, CancellationToken cancellationToken) { if (project == null) { throw new ArgumentNullException(nameof(project)); } if (query.Name != null && string.IsNullOrWhiteSpace(query.Name)) { return(SpecializedCollections.EmptyEnumerable <ISymbol>()); } using (Logger.LogBlock(FunctionId.SymbolFinder_Project_Predicate_FindSourceDeclarationsAsync, cancellationToken)) { var result = new List <ISymbol>(); if (!await project.ContainsSymbolsWithNameAsync(query.GetPredicate(), filter, cancellationToken).ConfigureAwait(false)) { return(result); } var compilation = await project.GetCompilationAsync(cancellationToken).ConfigureAwait(false); result.AddRange(FilterByCriteria(compilation.GetSymbolsWithName(query.GetPredicate(), filter, cancellationToken), filter)); return(result); } }
protected Expression(ExpressionType type, TypeSymbol evaluatedType, SymbolFilter memberMask) { _type = type; _evaluatedType = evaluatedType; _memberMask = memberMask | SymbolFilter.Members; }
internal async Task<IEnumerable<Document>> GetDocumentsWithNameAsync(Func<string, bool> predicate, SymbolFilter filter, CancellationToken cancellationToken) { return (await _solution.State.GetDocumentsWithNameAsync(Id, predicate, filter, cancellationToken).ConfigureAwait(false)).Select(s => _solution.GetDocument(s.Id)); }
private static IEnumerable<ISymbol> FilterByCriteria(IEnumerable<ISymbol> symbols, SymbolFilter criteria) { foreach (var symbol in symbols) { if (symbol.IsImplicitlyDeclared || symbol.IsAccessor()) { continue; } if (MeetCriteria(symbol, criteria)) { yield return symbol; } } }
public async Task<IEnumerable<DocumentState>> GetDocumentsWithNameAsync(ProjectId id, Func<string, bool> predicate, SymbolFilter filter, CancellationToken cancellationToken) { // this will be used to find documents that contain declaration information in IDE cache such as DeclarationSyntaxTreeInfo for "NavigateTo" var trees = GetCompilationTracker(id).GetSyntaxTreesWithNameFromDeclarationOnlyCompilation(predicate, filter, cancellationToken); if (trees != null) { return ConvertTreesToDocuments(id, trees); } // it looks like declaration compilation doesn't exist yet. we have to build full compilation var compilation = await GetCompilationAsync(id, cancellationToken).ConfigureAwait(false); if (compilation == null) { // some projects don't support compilations (e.g., TypeScript) so there's nothing to check return SpecializedCollections.EmptyEnumerable<DocumentState>(); } return ConvertTreesToDocuments( id, compilation.GetSymbolsWithName(predicate, filter, cancellationToken).SelectMany(s => s.DeclaringSyntaxReferences.Select(r => r.SyntaxTree))); }
private static bool IsOn(SymbolFilter filter, SymbolFilter flag) { return (filter & flag) == flag; }
private static bool IsOn(SymbolFilter filter, SymbolFilter flag) { return((filter & flag) == flag); }
internal Task<IEnumerable<Document>> GetDocumentsWithNameAsync(Func<string, bool> predicate, SymbolFilter filter, CancellationToken cancellationToken) { return _solution.GetDocumentsWithNameAsync(Id, predicate, filter, cancellationToken); }
public async Task<IEnumerable<ISymbol>> FindAsync( SearchQuery query, AsyncLazy<IAssemblySymbol> lazyAssembly, SymbolFilter filter, 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); return SymbolFinder.FilterByCriteria( await FindAsyncWorker(query, lazyAssembly, cancellationToken).ConfigureAwait(false), filter); }
internal Task<bool> ContainsSymbolsWithNameAsync(Func<string, bool> predicate, SymbolFilter filter, CancellationToken cancellationToken) { return _solution.State.ContainsSymbolsWithNameAsync(Id, predicate, filter, cancellationToken); }
/// <summary> /// check whether the compilation contains any declaration symbol from syntax trees with given name /// </summary> public bool? ContainsSymbolsWithNameFromDeclarationOnlyCompilation(Func<string, bool> predicate, SymbolFilter filter, CancellationToken cancellationToken) { var state = this.ReadState(); if (state.DeclarationOnlyCompilation == null) { return null; } // DO NOT expose declaration only compilation to outside since it can be held alive long time, we don't want to create any symbol from the declaration only compilation. return state.DeclarationOnlyCompilation.ContainsSymbolsWithName(predicate, filter, cancellationToken); }
public async Task<bool> ContainsSymbolsWithNameAsync(ProjectId id, Func<string, bool> predicate, SymbolFilter filter, CancellationToken cancellationToken) { var result = GetCompilationTracker(id).ContainsSymbolsWithNameFromDeclarationOnlyCompilation(predicate, filter, cancellationToken); if (result.HasValue) { return result.Value; } // it looks like declaration compilation doesn't exist yet. we have to build full compilation var compilation = await GetCompilationAsync(id, cancellationToken).ConfigureAwait(false); if (compilation == null) { // some projects don't support compilations (e.g., TypeScript) so there's nothing to check return false; } return compilation.ContainsSymbolsWithName(predicate, filter, cancellationToken); }
/// <summary> /// get all syntax trees that contain declaration node with the given name /// </summary> public IEnumerable<SyntaxTree> GetSyntaxTreesWithNameFromDeclarationOnlyCompilation(Func<string, bool> predicate, SymbolFilter filter, CancellationToken cancellationToken) { var state = this.ReadState(); if (state.DeclarationOnlyCompilation == null) { return null; } // DO NOT expose declaration only compilation to outside since it can be held alive long time, we don't want to create any symbol from the declaration only compilation. // use cloned compilation since this will cause symbols to be created. var clone = state.DeclarationOnlyCompilation.Clone(); return clone.GetSymbolsWithName(predicate, filter, cancellationToken).SelectMany(s => s.DeclaringSyntaxReferences.Select(r => r.SyntaxTree)); }
Symbol ISymbolTable.FindSymbol(string name, Symbol context, SymbolFilter filter) { Debug.Assert(_currentScope != null); return ((ISymbolTable)_currentScope).FindSymbol(name, context, filter); }
/// <summary> /// Find the symbols for declarations made in source with the specified name. /// </summary> public static Task <IEnumerable <ISymbol> > FindSourceDeclarationsAsync(Project project, string name, bool ignoreCase, SymbolFilter filter, CancellationToken cancellationToken = default(CancellationToken)) { if (project == null) { throw new ArgumentNullException(nameof(project)); } if (name == null) { throw new ArgumentNullException(nameof(name)); } if (string.IsNullOrWhiteSpace(name)) { return(SpecializedTasks.EmptyEnumerable <ISymbol>()); } using (Logger.LogBlock(FunctionId.SymbolFinder_Project_Name_FindSourceDeclarationsAsync, cancellationToken)) { return(FindSourceDeclarationsAsyncImpl(project, SearchQuery.Create(name, ignoreCase), filter, cancellationToken)); } }