GetSymbols() public method

public GetSymbols ( Compilation compilation, CancellationToken cancellationToken = default(CancellationToken) ) : NullabilityAttributeSymbols
compilation Compilation
cancellationToken System.Threading.CancellationToken
return NullabilityAttributeSymbols
        public NullabilityAttributeSymbols GetSymbols(Compilation compilation,
                                                      CancellationToken cancellationToken = default(CancellationToken))
        {
            Guard.NotNull(compilation, nameof(compilation));

            NullabilityAttributeSymbols symbolsSnapshot = symbols.Value;

            NullabilityAttributeMetadataNames previousNames =
                symbolsSnapshot?.GetMetadataNames() ?? names.Value ?? LastSeenNames.Value;

            symbolsSnapshot = previousNames?.GetSymbolsOrNull(compilation);

            if (symbolsSnapshot == null)
            {
                var provider = new SimpleNullabilityAttributeProvider();
                symbolsSnapshot = provider.GetSymbols(compilation, cancellationToken);
            }

            if (symbolsSnapshot != null)
            {
                names.Value         = symbolsSnapshot.GetMetadataNames();
                LastSeenNames.Value = names.Value;
            }

            symbols.Value = symbolsSnapshot;
            return(symbolsSnapshot);
        }
        public NullabilityAttributeSymbols GetSymbols(Compilation compilation,
            CancellationToken cancellationToken = default(CancellationToken))
        {
            Guard.NotNull(compilation, nameof(compilation));

            NullabilityAttributeSymbols symbolsSnapshot = symbols.Value;

            NullabilityAttributeMetadataNames previousNames = symbolsSnapshot?.GetMetadataNames() ??
                names.Value ?? LastSeenNames.Value;
            symbolsSnapshot = previousNames?.GetSymbolsOrNull(compilation);

            if (symbolsSnapshot == null)
            {
                var provider = new SimpleNullabilityAttributeProvider();
                symbolsSnapshot = provider.GetSymbols(compilation, cancellationToken);
            }

            if (symbolsSnapshot != null)
            {
                names.Value = symbolsSnapshot.GetMetadataNames();
                LastSeenNames.Value = names.Value;
            }

            symbols.Value = symbolsSnapshot;
            return symbolsSnapshot;
        }