Exemplo n.º 1
0
 public static (DmdType fieldType, DmdMethodSignature methodSignature, bool containedGenericParams) ReadMethodSignatureOrFieldType(DmdModule module, DmdDataStream reader, IList <DmdType> genericTypeArguments, IList <DmdType> genericMethodArguments, bool resolve)
 {
     try {
         using (var sigReader = new DmdSignatureReader(module, reader, genericTypeArguments, genericMethodArguments, resolve)) {
             var flags = (DmdSignatureCallingConvention)reader.ReadByte();
             if ((flags & DmdSignatureCallingConvention.Mask) == DmdSignatureCallingConvention.Field)
             {
                 var fieldType = sigReader.ReadType().type;
                 return(fieldType, null, sigReader.containedGenericParams);
             }
             else
             {
                 sigReader.ReadMethodSignature(flags, out var genericParameterCount, out var returnType, out var parameterTypes, out var varArgsParameterTypes);
                 if ((flags & DmdSignatureCallingConvention.Mask) != DmdSignatureCallingConvention.Property)
                 {
                     var methodSignature = new DmdMethodSignature(flags, genericParameterCount, returnType, parameterTypes, varArgsParameterTypes);
                     return(null, methodSignature, sigReader.containedGenericParams);
                 }
             }
         }
     }
     catch (IOException) {
     }
     catch (OutOfMemoryException) {
     }
     return(module.AppDomain.System_Void, null, false);
 }
Exemplo n.º 2
0
 public static (DmdType type, bool containedGenericParams) ReadTypeSignature(DmdModule module, DmdDataStream reader, IList <DmdType> genericTypeArguments, IList <DmdType> genericMethodArguments, bool resolve)
 {
     try {
         using (var sigReader = new DmdSignatureReader(module, reader, genericTypeArguments, genericMethodArguments, resolve)) {
             var type = sigReader.ReadType().type;
             return(type, sigReader.containedGenericParams);
         }
     }
     catch (IOException) {
     }
     catch (OutOfMemoryException) {
     }
     return(module.AppDomain.System_Void, false);
 }