提交 4d66ab35 编写于 作者: C CyrusNajmabadi

Don't search for files looking for a predefined type when the type we're...

Don't search for files looking for a predefined type when the type we're looking at is not predefined itself.
上级 e881925a
......@@ -87,6 +87,11 @@ protected Task<ImmutableArray<Document>> FindDocumentsAsync(Project project, IIm
PredefinedType predefinedType,
CancellationToken cancellationToken)
{
if (predefinedType == PredefinedType.None)
{
return SpecializedTasks.EmptyImmutableArray<Document>();
}
return FindDocumentsAsync(project, documents, async (d, c) =>
{
var info = await SyntaxTreeInfo.GetContextInfoAsync(d, c).ConfigureAwait(false);
......@@ -94,7 +99,7 @@ protected Task<ImmutableArray<Document>> FindDocumentsAsync(Project project, IIm
}, cancellationToken);
}
protected async Task<ImmutableArray<Document>> FindDocumentsAsync(
protected Task<ImmutableArray<Document>> FindDocumentsAsync(
Project project,
IImmutableSet<Document> documents,
PredefinedOperator op,
......@@ -102,14 +107,14 @@ protected Task<ImmutableArray<Document>> FindDocumentsAsync(Project project, IIm
{
if (op == PredefinedOperator.None)
{
return ImmutableArray<Document>.Empty;
return SpecializedTasks.EmptyImmutableArray<Document>();
}
return await FindDocumentsAsync(project, documents, async (d, c) =>
return FindDocumentsAsync(project, documents, async (d, c) =>
{
var info = await SyntaxTreeInfo.GetContextInfoAsync(d, c).ConfigureAwait(false);
return info.ContainsPredefinedOperator(op);
}, cancellationToken).ConfigureAwait(false);
}, cancellationToken);
}
protected static bool IdentifiersMatch(ISyntaxFactsService syntaxFacts, string name, SyntaxToken token)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册