예제 #1
0
        /// <summary>
        /// Lookup a type defined in referenced assembly.
        /// </summary>
        /// <param name="referencedAssemblyIndex"></param>
        /// <param name="emittedName"></param>
        protected override TypeSymbol LookupTopLevelTypeDefSymbol(
            int referencedAssemblyIndex,
            ref MetadataTypeName emittedName)
        {
            AssemblySymbol assembly = moduleSymbol.GetReferencedAssemblySymbols()[referencedAssemblyIndex];

            return(assembly.LookupTopLevelMetadataType(ref emittedName, digThroughForwardedTypes: true));
        }
예제 #2
0
 /// <summary>
 /// Lookup a type defined in referenced assembly.
 /// </summary>
 /// <param name="referencedAssemblyIndex"></param>
 /// <param name="emittedName"></param>
 protected override TypeSymbol LookupTopLevelTypeDefSymbol(
     int referencedAssemblyIndex,
     ref MetadataTypeName emittedName)
 {
     try
     {
         AssemblySymbol assembly = moduleSymbol.GetReferencedAssemblySymbols()[referencedAssemblyIndex];
         return(assembly.LookupTopLevelMetadataType(ref emittedName, digThroughForwardedTypes: true));
     }
     catch (Exception e) when(FatalError.Report(e))  // Trying to get more useful Watson dumps.
     {
         throw ExceptionUtilities.Unreachable;
     }
 }
예제 #3
0
        internal IEnumerable <NamedTypeSymbol> GetForwardedTypes()
        {
            foreach (KeyValuePair <string, AssemblyReferenceHandle> forwareder in Module.GetForwardedTypes())
            {
                var            name = MetadataTypeName.FromFullName(forwareder.Key);
                AssemblySymbol assemblySymbol;

                try
                {
                    assemblySymbol = this.GetReferencedAssemblySymbols()[Module.GetAssemblyReferenceIndexOrThrow(forwareder.Value)];
                }
                catch (BadImageFormatException)
                {
                    continue;
                }

                yield return(assemblySymbol.LookupTopLevelMetadataType(ref name, digThroughForwardedTypes: true));
            }
        }
예제 #4
0
        internal IEnumerable <NamedTypeSymbol> GetForwardedTypes()
        {
            foreach (KeyValuePair <string, (int FirstIndex, int SecondIndex)> forwarder in Module.GetForwardedTypes())
            {
                var name = MetadataTypeName.FromFullName(forwarder.Key);

                Debug.Assert(forwarder.Value.FirstIndex >= 0, "First index should never be negative");
                AssemblySymbol firstSymbol = this.GetReferencedAssemblySymbol(forwarder.Value.FirstIndex);
                Debug.Assert((object)firstSymbol != null, "Invalid indexes (out of bound) are discarded during reading metadata in PEModule.EnsureForwardTypeToAssemblyMap()");

                if (forwarder.Value.SecondIndex >= 0)
                {
                    var secondSymbol = this.GetReferencedAssemblySymbol(forwarder.Value.SecondIndex);
                    Debug.Assert((object)secondSymbol != null, "Invalid indexes (out of bound) are discarded during reading metadata in PEModule.EnsureForwardTypeToAssemblyMap()");

                    yield return(ContainingAssembly.CreateMultipleForwardingErrorTypeSymbol(ref name, this, firstSymbol, secondSymbol));
                }
                else
                {
                    yield return(firstSymbol.LookupTopLevelMetadataType(ref name, digThroughForwardedTypes: true));
                }
            }
        }
        internal IEnumerable<NamedTypeSymbol> GetForwardedTypes()
        {
            foreach (KeyValuePair<string, AssemblyReferenceHandle> forwareder in Module.GetForwardedTypes())
            {
                var name = MetadataTypeName.FromFullName(forwareder.Key);
                AssemblySymbol assemblySymbol;

                try
                {
                    assemblySymbol = this.GetReferencedAssemblySymbols()[Module.GetAssemblyReferenceIndexOrThrow(forwareder.Value)];
                }
                catch (BadImageFormatException)
                {
                    continue;
                }

                yield return assemblySymbol.LookupTopLevelMetadataType(ref name, digThroughForwardedTypes: true);
            }
        }