示例#1
0
            /// <summary>
            /// Searches for extension methods exactly called 'GetAwaiter'.  Returns
            /// <see cref="SymbolReference"/>s to the <see cref="INamespaceSymbol"/>s that contain
            /// the static classes that those extension methods are contained in.
            /// </summary>
            private async Task <ImmutableArray <SymbolReference> > GetReferencesForGetAwaiterAsync(SearchScope searchScope)
            {
                searchScope.CancellationToken.ThrowIfCancellationRequested();

                if (_owner.CanAddImportForGetAwaiter(_diagnosticId, _syntaxFacts, _node))
                {
                    var type = _owner.GetAwaitInfo(_semanticModel, _syntaxFacts, _node, searchScope.CancellationToken);
                    if (type != null)
                    {
                        return(await GetReferencesForExtensionMethodAsync(searchScope, WellKnownMemberNames.GetAwaiter, type,
                                                                          m => m.IsValidGetAwaiter()).ConfigureAwait(false));
                    }
                }

                return(ImmutableArray <SymbolReference> .Empty);
            }