コード例 #1
0
        public override void VisitIdentifierName(IdentifierNameSyntax node)
        {
            string name = node.Identifier.ValueText;

            if (Nodes.TryGetValue(name, out NodeSymbolInfo info))
            {
                if (info.Symbol == null)
                {
                    ISymbol declaredSymbol = SemanticModel.GetDeclaredSymbol(info.Node, CancellationToken);

                    if (declaredSymbol == null)
                    {
                        RemoveNode(name);
                        return;
                    }

                    info = new NodeSymbolInfo(info.Name, info.Node, declaredSymbol);

                    Nodes[name] = info;
                }

                ISymbol symbol = SemanticModel.GetSymbol(node, CancellationToken);

                if (IsIndexer)
                {
                    symbol = GetIndexerParameterSymbol(node, symbol);
                }

                if (info.Symbol.Equals(symbol))
                {
                    RemoveNode(name);
                }
            }
        }
コード例 #2
0
 private void AddNode(string name, SyntaxNode node)
 {
     Nodes[name] = new NodeSymbolInfo(name, node);
 }