using System.Collections.Immutable; using System.Diagnostics; namespace Microsoft.CodeAnalysis.CSharp.Symbols; internal abstract class NonMissingModuleSymbol : ModuleSymbol { private ModuleReferences _moduleReferences; internal sealed override bool IsMissing => false; internal override bool HasUnifiedReferences => GetUnifiedAssemblies().Length > 0; internal sealed override ImmutableArray GetReferencedAssemblies() { return _moduleReferences.Identities; } internal sealed override ImmutableArray GetReferencedAssemblySymbols() { return _moduleReferences.Symbols; } internal ImmutableArray> GetUnifiedAssemblies() { return _moduleReferences.UnifiedAssemblies; } internal override bool GetUnificationUseSiteDiagnostic(ref DiagnosticInfo result, TypeSymbol dependentType) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) AssemblySymbol containingAssembly = ContainingAssembly; AssemblySymbol containingAssembly2 = dependentType.ContainingAssembly; if (containingAssembly == containingAssembly2) { return false; } ImmutableArray>.Enumerator enumerator = GetUnifiedAssemblies().GetEnumerator(); while (enumerator.MoveNext()) { UnifiedAssembly current = enumerator.Current; if ((object)current.TargetAssembly == containingAssembly2) { AssemblyIdentity originalReference = current.OriginalReference; AssemblyIdentity identity = containingAssembly2.Identity; ImmutableArray symbols = ImmutableArray.Create((Symbol)containingAssembly, (Symbol)containingAssembly2); DiagnosticInfo info = (DiagnosticInfo)(object)((!(identity.Version > originalReference.Version)) ? new CSDiagnosticInfo(ErrorCode.ERR_AssemblyMatchBadVersion, new object[5] { containingAssembly.Name, containingAssembly.Identity.GetDisplayName(false), originalReference.GetDisplayName(false), containingAssembly2.Name, identity.GetDisplayName(false) }, symbols, ImmutableArray.Empty) : new CSDiagnosticInfo((identity.Version.Major == originalReference.Version.Major && identity.Version.Minor == originalReference.Version.Minor) ? ErrorCode.WRN_UnifyReferenceBldRev : ErrorCode.WRN_UnifyReferenceMajMin, new object[4] { originalReference.GetDisplayName(false), containingAssembly.Name, identity.GetDisplayName(false), containingAssembly2.Name }, symbols, ImmutableArray.Empty)); if (MergeUseSiteDiagnostics(ref result, info)) { return true; } } } return false; } internal override void SetReferences(ModuleReferences moduleReferences, SourceAssemblySymbol originatingSourceAssemblyDebugOnly = null) { _moduleReferences = moduleReferences; } [Conditional("DEBUG")] internal void AssertReferencesUninitialized() { } [Conditional("DEBUG")] internal void AssertReferencesInitialized() { } internal sealed override NamedTypeSymbol? LookupTopLevelMetadataType(ref MetadataTypeName emittedName) { return GlobalNamespace.LookupNestedNamespace(((MetadataTypeName)(ref emittedName)).NamespaceSegmentsMemory)?.LookupMetadataType(ref emittedName); } }