Exemple #1
0
        private IEnumerable <ISymbol> GetDeclaredSymbolsInTree(
            SyntaxTree tree,
            Compilation compilation,
            Func <SyntaxTree, Compilation, CancellationToken, SemanticModel> getCachedSemanticModel,
            CancellationToken cancellationToken)
        {
            SemanticModel model = getCachedSemanticModel(tree, compilation, cancellationToken);

            Text.TextSpan          fullSpan         = tree.GetRoot(cancellationToken).FullSpan;
            List <DeclarationInfo> declarationInfos = new List <DeclarationInfo>();

            model.ComputeDeclarationsInSpan(fullSpan, getSymbol: true, builder: declarationInfos, cancellationToken: cancellationToken);
            return(declarationInfos.Select(declInfo => declInfo.DeclaredSymbol).Distinct().WhereNotNull());
        }