in dotnet/CSharpSourceGraphExtraction/Utils/RoslynUtils.cs [162:187]
public static ISymbol GetTokenSymbolReference(SyntaxToken token, SemanticModel semanticModel)
{
if (!token.IsKind(SyntaxKind.IdentifierToken) && !token.IsKind(SyntaxKind.ThisKeyword)) return null;
SyntaxNode node = token.Parent;
while (node.Parent != null)
{
ISymbol nodeSymbol = RoslynUtils.GetReferenceSymbol(node, semanticModel);
if (nodeSymbol == null)
{
node = node.Parent;
continue;
}
if (token.Text.StartsWith("@"))
{
if (token.Text.Substring(1) != nodeSymbol.Name) break;
}
else if (nodeSymbol.ToDisplayString() != token.Text && nodeSymbol.Name != token.Text)
{
break;
}
return nodeSymbol;
}
return null;
}