提交 57662a07 编写于 作者: S Sam Harwell

Remove unused field ReferenceLocation.IsDuplicateReferenceLocation

上级 22286daa
......@@ -117,12 +117,6 @@ public async Task OnDefinitionFoundAsync(SymbolAndProjectId definition)
public async Task OnReferenceFoundAsync(SymbolAndProjectId definition, ReferenceLocation location)
{
// Ignore duplicate locations. We don't want to clutter the UI with them.
if (location.IsDuplicateReferenceLocation)
{
return;
}
var definitionItem = await GetDefinitionItemAsync(definition).ConfigureAwait(false);
var referenceItem = await location.TryCreateSourceReferenceItemAsync(
definitionItem, includeHiddenLocations: false,
......
......@@ -85,68 +85,6 @@ protected override bool CanFind(INamedTypeSymbol symbol)
SemanticModel semanticModel,
FindReferencesSearchOptions options,
CancellationToken cancellationToken)
{
var namedTypeReferences = await FindReferencesInDocumentWorker(
namedType, document, semanticModel, cancellationToken).ConfigureAwait(false);
// Mark any references that are also Constructor references. Some callers
// will want to know about these so they won't display duplicates.
return await MarkConstructorReferences(
namedType, document, semanticModel, namedTypeReferences, cancellationToken).ConfigureAwait(false);
}
private async Task<ImmutableArray<FinderLocation>> MarkConstructorReferences(
INamedTypeSymbol namedType, Document document,
SemanticModel semanticModel,
ImmutableArray<FinderLocation> namedTypeReferences,
CancellationToken cancellationToken)
{
var constructorReferences = ArrayBuilder<FinderLocation>.GetInstance();
foreach (var constructor in namedType.Constructors)
{
var references = await ConstructorSymbolReferenceFinder.Instance.FindAllReferencesInDocumentAsync(
constructor, document, semanticModel, cancellationToken).ConfigureAwait(false);
constructorReferences.AddRange(references);
}
var result = ArrayBuilder<FinderLocation>.GetInstance();
foreach (var finderLocation in namedTypeReferences)
{
if (Contains(constructorReferences, finderLocation))
{
var location = finderLocation.Location;
location.IsDuplicateReferenceLocation = true;
result.Add(finderLocation);
}
else
{
result.Add(finderLocation);
}
}
return result.ToImmutableAndFree();
}
private bool Contains(
ArrayBuilder<FinderLocation> constructorReferences,
FinderLocation reference)
{
foreach (var constructorRef in constructorReferences)
{
if (reference.Location.Location == constructorRef.Location.Location)
{
return true;
}
}
return false;
}
private static async Task<ImmutableArray<FinderLocation>> FindReferencesInDocumentWorker(
INamedTypeSymbol namedType,
Document document,
SemanticModel semanticModel,
CancellationToken cancellationToken)
{
var nonAliasReferences = await FindNonAliasReferencesAsync(namedType, document, semanticModel, cancellationToken).ConfigureAwait(false);
var symbolsMatch = GetStandardSymbolsMatchFunction(namedType, null, document.Project.Solution, cancellationToken);
......
......@@ -11,7 +11,7 @@ namespace Microsoft.CodeAnalysis.FindSymbols
/// Information about a reference to a symbol.
/// </summary>
[DebuggerDisplay("{GetDebuggerDisplay(),nq}")]
public struct ReferenceLocation : IComparable<ReferenceLocation>, IEquatable<ReferenceLocation>
public readonly struct ReferenceLocation : IComparable<ReferenceLocation>, IEquatable<ReferenceLocation>
{
/// <summary>
/// The document that the reference was found in.
......@@ -46,13 +46,6 @@ public struct ReferenceLocation : IComparable<ReferenceLocation>, IEquatable<Ref
/// </summary>
internal SymbolUsageInfo SymbolUsageInfo { get; }
/// <summary>
/// Indicates if this location is a duplicate of some another ReferenceLocation.
/// In this case, it's acceptable for a presenter to not show this location and
/// intead prefer the latter.
/// </summary>
internal bool IsDuplicateReferenceLocation;
public CandidateReason CandidateReason { get; }
internal ReferenceLocation(Document document, IAliasSymbol alias, Location location, bool isImplicit, SymbolUsageInfo symbolUsageInfo, CandidateReason candidateReason)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册