private static IEnumerable <INamedTypeSymbol> FindDerivedInterfaces(Workspace workspace, INamedTypeSymbol interfaceSymbol) { foreach (var compilation in GetCompilations(workspace)) { var visitor = new DerivedInterfacesFinderVisitor(interfaceSymbol); compilation.Assembly?.Accept(visitor); foreach (var descendant in visitor.DerivedInterfaces) { yield return(descendant); } } }
private static async Task <IEnumerable <INamedTypeSymbol> > FindDerivedInterfacesAsync(Workspace workspace, INamedTypeSymbol interfaceSymbol) { var result = new List <INamedTypeSymbol>(); foreach (var compilation in await GetCompilationsAsync(workspace)) { var visitor = new DerivedInterfacesFinderVisitor(interfaceSymbol); compilation.Assembly?.Accept(visitor); result.AddRange(visitor.DerivedInterfaces); } return(result); }
private async Task <IEnumerable <INamedTypeSymbol> > FindDerivedInterfacesAsync([NotNull] ISymbol symbol) { var namedTypeSymbol = symbol.EnsureType <INamedTypeSymbol>(); var result = new List <INamedTypeSymbol>(); foreach (var compilation in await GetCompilationsAsync()) { var visitor = new DerivedInterfacesFinderVisitor(namedTypeSymbol, _symbolEqualityComparer); compilation.Assembly?.Accept(visitor); result.AddRange(visitor.DerivedInterfaces); } return(result); }