Skip to content

Commit 4fb7734

Browse files
Simplify
1 parent 890b26a commit 4fb7734

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/AbstractReferenceFinder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ protected static Task FindDocumentsAsync<TData>(
119119
Action<Document, TData> processResult,
120120
TData processResultData,
121121
CancellationToken cancellationToken,
122-
params string[] values)
122+
params ImmutableArray<string> values)
123123
{
124124
return FindDocumentsWithPredicateAsync(project, documents, static (index, values) =>
125125
{

src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/MethodTypeParameterSymbolReferenceFinder.cs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using System.Collections.Immutable;
88
using System.Threading;
99
using System.Threading.Tasks;
10+
using Microsoft.CodeAnalysis.Shared.Collections;
1011
using Roslyn.Utilities;
1112

1213
namespace Microsoft.CodeAnalysis.FindSymbols.Finders;
@@ -58,23 +59,21 @@ protected sealed override Task DetermineDocumentsToSearchAsync<TData>(
5859
// document, and their containing type name ("Program") doesn't have to appear there at all.
5960

6061
Contract.ThrowIfNull(symbol.DeclaringMethod);
61-
if (symbol is
62+
63+
using var names = TemporaryArray<string>.Empty;
64+
names.Add(symbol.Name);
65+
names.Add(GetMemberNameWithoutInterfaceName(symbol.DeclaringMethod.Name));
66+
67+
if (symbol is not
6268
{
6369
ContainingSymbol: IMethodSymbol { MethodKind: MethodKind.LocalFunction },
6470
ContainingType: INamedTypeSymbol { Name: "Program", ContainingNamespace.IsGlobalNamespace: true }
6571
})
6672
{
67-
return FindDocumentsAsync(project, documents, processResult, processResultData, cancellationToken,
68-
symbol.Name,
69-
GetMemberNameWithoutInterfaceName(symbol.DeclaringMethod.Name));
70-
}
71-
else
72-
{
73-
return FindDocumentsAsync(project, documents, processResult, processResultData, cancellationToken,
74-
symbol.Name,
75-
GetMemberNameWithoutInterfaceName(symbol.DeclaringMethod.Name),
76-
symbol.DeclaringMethod.ContainingType.Name);
73+
names.Add(symbol.ContainingType.Name);
7774
}
75+
76+
return FindDocumentsAsync(project, documents, processResult, processResultData, cancellationToken, names.ToImmutableAndClear());
7877
}
7978

8079
private static string GetMemberNameWithoutInterfaceName(string fullName)

0 commit comments

Comments
 (0)