示例#1
0
        /// <summary>
        /// Moves all the types in <paramref name="tempBuffer"/> to <paramref name="result"/>.  If these are types we
        /// haven't seen before, and the caller says we <paramref name="shouldContinueSearching"/> on them, then add
        /// them to <paramref name="typesToSearchFor"/> for the next round of searching.
        /// </summary>
        private static void PropagateTemporaryResults(
            SymbolSet result,
            SymbolSet typesToSearchFor,
            SymbolSet tempBuffer,
            bool transitive,
            Func <INamedTypeSymbol, bool> shouldContinueSearching)
        {
            // Clear out the information about the types we're looking for.  We'll
            // fill these in if we discover any more types that we need to keep searching
            // for.
            typesToSearchFor.Clear();

            foreach (var derivedType in tempBuffer)
            {
                // See if it's a type we've never seen before.
                if (result.Add(derivedType))
                {
                    // If we should keep going, add it to the next batch of items we'll search for in this project.
                    if (transitive && shouldContinueSearching(derivedType))
                    {
                        typesToSearchFor.Add(derivedType);
                    }
                }
            }

            tempBuffer.Clear();
        }