Esempio n. 1
0
        public override void VisitIdentifierName(IdentifierNameSyntax node)
        {
            var refSymbol = RoslynUtils.GetReferenceSymbol(node, _semanticModel);

            if (refSymbol != null && RoslynUtils.IsVariableSymbol(refSymbol) && refSymbol.Locations[0].IsInSource)
            {
                var typeSymbol = RoslynUtils.GetVariableTypeSymbol(refSymbol);
                if (typeSymbol.ToString() == _targetType)
                {
                    _inScopeSymbols.Add(_tokenToLocation(node.GetLocation(), node.ToString()),
                                        new ScopeData(SymbolToString(refSymbol),
                                                      new HashSet <String>(_semanticModel.LookupSymbols(node.GetLocation().SourceSpan.End).Where(s => RoslynUtils.IsVariableSymbol(s)).
                                                                           Where(s => s.Locations[0].IsInSource).
                                                                           Where(s => RoslynUtils.GetVariableTypeSymbol(s).ToString() == _targetType).Select(s => SymbolToString(s)))));
                }
            }
            base.VisitIdentifierName(node);
        }