// Create a TypeSystem.MethodSignature object from a RuntimeSignature that isn't a NativeLayoutSignature private TypeSystem.MethodSignature TypeSystemSigFromRuntimeSignature(TypeSystemContext context, RuntimeSignature signature) { Debug.Assert(!signature.IsNativeLayoutSignature); ModuleInfo module = signature.GetModuleInfo(); #if ECMA_METADATA_SUPPORT if (module is NativeFormatModuleInfo) #endif { NativeFormatModuleInfo nativeFormatModule = (NativeFormatModuleInfo)module; var metadataReader = nativeFormatModule.MetadataReader; var methodHandle = signature.Token.AsHandle().ToMethodHandle(metadataReader); var metadataUnit = ((TypeLoaderTypeSystemContext)context).ResolveMetadataUnit(nativeFormatModule); var parser = new Internal.TypeSystem.NativeFormat.NativeFormatSignatureParser(metadataUnit, metadataReader.GetMethod(methodHandle).Signature, metadataReader); return(parser.ParseMethodSignature()); } #if ECMA_METADATA_SUPPORT else { EcmaModuleInfo ecmaModuleInfo = (EcmaModuleInfo)module; TypeSystem.Ecma.EcmaModule ecmaModule = context.ResolveEcmaModule(ecmaModuleInfo); var ecmaHandle = System.Reflection.Metadata.Ecma335.MetadataTokens.EntityHandle(signature.Token); MethodDesc ecmaMethod = ecmaModule.GetMethod(ecmaHandle); return(ecmaMethod.Signature); } #endif }