private Location CreateModuleLocation( SymbolKeyResolution assembly, string moduleName) { var symbol = assembly.GetAnySymbol() as IAssemblySymbol; Debug.Assert(symbol != null); var module = symbol.Modules.FirstOrDefault(m => m.MetadataName == moduleName); return(module.Locations.FirstOrDefault()); }
private static IEnumerable <ISymbol> GetAllSymbolsWorker(SymbolKeyResolution resolution) { if (resolution.Symbol != null) { yield return(resolution.Symbol); } foreach (var symbol in resolution.CandidateSymbols) { yield return(symbol); } }
private static IEnumerable<ISymbol> GetAllSymbolsWorker(SymbolKeyResolution resolution) { if (resolution.Symbol != null) { yield return resolution.Symbol; } foreach (var symbol in resolution.CandidateSymbols) { yield return symbol; } }
private static IEnumerable <ISymbol> GetAllSymbols(SymbolKeyResolution info) { if (info.Symbol != null) { yield return(info.Symbol); } else { foreach (var symbol in info.CandidateSymbols) { yield return(symbol); } } }
internal static ISymbol GetAnySymbol(this SymbolKeyResolution resolution) { if (resolution.Symbol != null) { return(resolution.Symbol); } if (resolution.CandidateSymbols.Length > 0) { return(resolution.CandidateSymbols[0]); } return(null); }
private static IEnumerable<INamedTypeSymbol> ResolveErrorTypes( SymbolKeyReader reader, SymbolKeyResolution containingSymbolResolution, string name, int arity) { if (containingSymbolResolution.GetAnySymbol() == null) { yield return reader.Compilation.CreateErrorTypeSymbol(null, name, arity); } else { foreach (var container in containingSymbolResolution.GetAllSymbols().OfType<INamespaceOrTypeSymbol>()) { yield return reader.Compilation.CreateErrorTypeSymbol(container, name, arity); } } }
private static IEnumerable <INamedTypeSymbol> ResolveErrorTypes( SymbolKeyReader reader, SymbolKeyResolution containingSymbolResolution, string name, int arity) { if (containingSymbolResolution.GetAnySymbol() == null) { yield return(reader.Compilation.CreateErrorTypeSymbol(null, name, arity)); } else { foreach (var container in containingSymbolResolution.GetAllSymbols().OfType <INamespaceOrTypeSymbol>()) { yield return(reader.Compilation.CreateErrorTypeSymbol(container, name, arity)); } } }
private static TSymbol GetFirstSymbol <TSymbol>(SymbolKeyResolution resolution) where TSymbol : ISymbol { return(resolution.GetAllSymbols().OfType <TSymbol>().FirstOrDefault()); }
private static IEnumerable <TType> GetAllSymbols <TType>(SymbolKeyResolution info) => GetAllSymbols(info).OfType <TType>();
internal static IEnumerable <ISymbol> GetAllSymbols(this SymbolKeyResolution resolution) { return(GetAllSymbolsWorker(resolution).Distinct()); }