提交 3993e8dd 编写于 作者: C Cyrus Najmabadi

Make readonly. Add docs.

上级 059a8a64
......@@ -3,10 +3,27 @@
namespace Microsoft.CodeAnalysis.FindSymbols.Finders
{
internal struct FinderLocation
internal readonly struct FinderLocation
{
public SyntaxNode Node;
public ReferenceLocation Location;
/// <summary>
/// The actual node that we found the reference on. Normally the 'Name' portion
/// of any piece of syntax. Might also be something like a 'foreach' statement node
/// when finding results for something like GetEnumerator.
/// </summary>
public readonly SyntaxNode Node;
/// <summary>
/// The location we want want to return through the FindRefs API. The location contains
/// additional information (like if this was a Write, or if it was Implicit). This value
/// also has a <see cref="ReferenceLocation.Location"/> property. Importantly, this value
/// is not necessarily the same location you would get by calling <see cref="Node"/>.<see
/// cref="SyntaxNode.GetLocation"/>. Instead, this location is where we want to navigate
/// the user to. A case where this can be different is with an indexer reference. The <see
/// cref="Node"/> will be the node for the full 'ElementAccessExpression', whereas the
/// location we will take the user to will be the zero-length position immediately preceding
/// the `[` character.
/// </summary>
public readonly ReferenceLocation Location;
public FinderLocation(SyntaxNode node, ReferenceLocation location)
{
......
......@@ -110,17 +110,17 @@ protected override bool CanFind(INamedTypeSymbol symbol)
}
var result = ArrayBuilder<FinderLocation>.GetInstance();
foreach (var reference in namedTypeReferences)
foreach (var finderLocation in namedTypeReferences)
{
if (Contains(constructorReferences, reference))
if (Contains(constructorReferences, finderLocation))
{
var localReference = reference;
localReference.Location.IsDuplicateReferenceLocation = true;
result.Add(localReference);
var location = finderLocation.Location;
location.IsDuplicateReferenceLocation = true;
result.Add(finderLocation);
}
else
{
result.Add(reference);
result.Add(finderLocation);
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册