public static bool TryGetAssemblySymbol(CSharpSymbols.AssemblySymbol csharpSymbol, out CSharpAssemblySymbol symbol) { if (csharpSymbol == null || !assemblyMap.TryGetValue(csharpSymbol, out CSharpAssemblySymbol cachedSymbol)) { symbol = null; return(false); } symbol = cachedSymbol; return((object)symbol != null); }
public static AssemblySymbol GetAssemblySymbol(CSharpSymbols.AssemblySymbol csharpSymbol) { if (csharpSymbol == null) { return(null); } if (!assemblyMap.TryGetValue(csharpSymbol, out CSharpAssemblySymbol symbol)) { symbol = new CSharpAssemblySymbol(csharpSymbol); if ((object)symbol != null) { assemblyMap.Add(csharpSymbol, symbol); } } return(symbol); }
/// <summary> /// Constructor. /// </summary> /// <param name="underlyingAssembly"> /// The underlying AssemblySymbol, cannot be an instance of CSharpAssemblySymbol. /// </param> internal CSharpAssemblySymbol(CSharpSymbols.AssemblySymbol underlyingAssembly) { Debug.Assert((object)underlyingAssembly != null); _underlyingAssembly = underlyingAssembly; ModuleSymbol[] modules = new CSharpModuleSymbol[underlyingAssembly.Modules.Length]; modules[0] = new CSharpModuleSymbol(this, underlyingAssembly.Modules[0], 0); for (int i = 1; i < underlyingAssembly.Modules.Length; i++) { PEModuleSymbol under = (PEModuleSymbol)underlyingAssembly.Modules[i]; modules[i] = new CSharpModuleSymbol(this, new PEModuleSymbol((PEAssemblySymbol)this._underlyingAssembly, under.Module, under.ImportOptions, i), i); } _modules = modules.AsImmutableOrNull(); foreach (var module in _modules) { CSharpSymbolMap.RegisterModuleSymbol((CSharpModuleSymbol)module); } }
public static CSharpAssemblySymbol GetCSharpAssemblySymbol(CSharpSymbols.AssemblySymbol csharpSymbol) { return((CSharpAssemblySymbol)GetAssemblySymbol(csharpSymbol)); }