提交 38d74207 编写于 作者: C CyrusNajmabadi

Rename methods.

上级 be6835be
......@@ -12,6 +12,9 @@ namespace Microsoft.CodeAnalysis.FindSymbols
// Logic related to finding declarations with a completely custom predicate goes here.
// Completely custom predicates can not be optimized in any way as there is no way to
// tell what the predicate will return true for.
//
// Also, because we have no control over these predicates, we cannot remote these queries
// over to the OOP process.
public static partial class SymbolFinder
{
......
......@@ -38,11 +38,6 @@ public static Task<IEnumerable<ISymbol>> FindSourceDeclarationsAsync(Solution so
throw new ArgumentNullException(nameof(name));
}
if (string.IsNullOrWhiteSpace(name))
{
return ImmutableArray<ISymbol>.Empty;
}
using (Logger.LogBlock(FunctionId.SymbolFinder_Solution_Name_FindSourceDeclarationsAsync, cancellationToken))
{
return await FindSourceDeclarationsWithNormalQueryAsync(
......@@ -50,26 +45,6 @@ public static Task<IEnumerable<ISymbol>> FindSourceDeclarationsAsync(Solution so
}
}
private static async Task<ImmutableArray<ISymbol>> FindSourceDeclarationsWithNormalQueryAsync(
Solution solution, SearchQuery query, SymbolFilter filter, CancellationToken cancellationToken)
{
Debug.Assert(query.Kind != SearchKind.Custom);
if (query.Name != null && string.IsNullOrWhiteSpace(query.Name))
{
return ImmutableArray<ISymbol>.Empty;
}
var result = ArrayBuilder<ISymbol>.GetInstance();
foreach (var projectId in solution.ProjectIds)
{
var project = solution.GetProject(projectId);
await AddCompilationDeclarationsWithNormalQueryAsync(project, query, filter, result, cancellationToken).ConfigureAwait(false);
}
return result.ToImmutableAndFree();
}
/// <summary>
/// Find the symbols for declarations made in source with the specified name.
/// </summary>
......@@ -92,18 +67,45 @@ public static Task<IEnumerable<ISymbol>> FindSourceDeclarationsAsync(Project pro
throw new ArgumentNullException(nameof(name));
}
if (string.IsNullOrWhiteSpace(name))
using (Logger.LogBlock(FunctionId.SymbolFinder_Project_Name_FindSourceDeclarationsAsync, cancellationToken))
{
return SpecializedCollections.EmptyEnumerable<ISymbol>();
return await FindSourceDeclarationsithNormalQueryInLocalProcessAsync(
project, name, ignoreCase, filter, cancellationToken).ConfigureAwait(false);
}
}
using (Logger.LogBlock(FunctionId.SymbolFinder_Project_Name_FindSourceDeclarationsAsync, cancellationToken))
private static async Task<ImmutableArray<ISymbol>> FindSourceDeclarationsWithNormalQueryAsync(
Solution solution, SearchQuery query, SymbolFilter filter, CancellationToken cancellationToken)
{
Debug.Assert(query.Kind != SearchKind.Custom);
if (query.Name != null && string.IsNullOrWhiteSpace(query.Name))
{
var list = ArrayBuilder<ISymbol>.GetInstance();
await AddCompilationDeclarationsWithNormalQueryAsync(
project, SearchQuery.Create(name, ignoreCase), filter, list, cancellationToken).ConfigureAwait(false);
return list.ToImmutableAndFree();
return ImmutableArray<ISymbol>.Empty;
}
var result = ArrayBuilder<ISymbol>.GetInstance();
foreach (var projectId in solution.ProjectIds)
{
var project = solution.GetProject(projectId);
await AddCompilationDeclarationsWithNormalQueryAsync(project, query, filter, result, cancellationToken).ConfigureAwait(false);
}
return result.ToImmutableAndFree();
}
private static async Task<IEnumerable<ISymbol>> FindSourceDeclarationsithNormalQueryInLocalProcessAsync(
Project project, string name, bool ignoreCase, SymbolFilter filter, CancellationToken cancellationToken)
{
if (string.IsNullOrWhiteSpace(name))
{
return SpecializedCollections.EmptyEnumerable<ISymbol>();
}
var list = ArrayBuilder<ISymbol>.GetInstance();
await AddCompilationDeclarationsWithNormalQueryAsync(
project, SearchQuery.Create(name, ignoreCase), filter, list, cancellationToken).ConfigureAwait(false);
return list.ToImmutableAndFree();
}
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册