

using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Mirage.Core.Plugin")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+edb1e0f57ae300054b6da4ebfa7f5537b97c4e93")]
[assembly: AssemblyProduct("Mirage.Core.Plugin")]
[assembly: AssemblyTitle("Mirage.Core.Plugin")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Mirage.Core.Plugin;
[BepInPlugin("qwbarch.Mirage.Core", "Mirage.Core", "1.0.4")]
public class Plugin : BaseUnityPlugin
{
private static string directory;
public static string Directory => directory;
private void Awake()
{
directory = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location);
}
}
public static class PluginInfo
{
public const string PLUGIN_NAME = "Mirage.Core";
public const string PLUGIN_ID = "qwbarch.Mirage.Core";
public const string PLUGIN_VERSION = "1.0.4";
}using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.ExceptionServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Runtime.Versioning;
using System.Threading;
using System.Threading.Tasks;
using System.Threading.Tasks.Sources;
using FxResources.System.Threading.Channels;
using Internal;
using Microsoft.CodeAnalysis;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: AssemblyMetadata("PreferInbox", "True")]
[assembly: AssemblyDefaultAlias("System.Threading.Channels")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: CLSCompliant(true)]
[assembly: AssemblyMetadata("IsTrimmable", "True")]
[assembly: DefaultDllImportSearchPaths(DllImportSearchPath.System32 | DllImportSearchPath.AssemblyDirectory)]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyDescription("Provides types for passing data between producers and consumers.\r\n\r\nCommonly Used Types:\r\nSystem.Threading.Channel\r\nSystem.Threading.Channel<T>")]
[assembly: AssemblyFileVersion("8.0.23.53103")]
[assembly: AssemblyInformationalVersion("8.0.0+5535e31a712343a63f5d7d796cd874e563e5ac14")]
[assembly: AssemblyProduct("Microsoft® .NET")]
[assembly: AssemblyTitle("System.Threading.Channels")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/dotnet/runtime")]
[assembly: AssemblyVersion("8.0.0.0")]
[module: RefSafetyRules(11)]
[module: System.Runtime.CompilerServices.NullablePublicOnly(false)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class NullablePublicOnlyAttribute : Attribute
{
public readonly bool IncludesInternals;
public NullablePublicOnlyAttribute(bool P_0)
{
IncludesInternals = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace FxResources.System.Threading.Channels
{
internal static class SR
{
}
}
namespace Internal
{
internal static class PaddingHelpers
{
internal const int CACHE_LINE_SIZE = 128;
}
[StructLayout(LayoutKind.Explicit, Size = 124)]
internal struct PaddingFor32
{
}
}
namespace System
{
[StructLayout(LayoutKind.Sequential, Size = 1)]
internal readonly struct VoidResult
{
}
internal static class Obsoletions
{
internal const string SharedUrlFormat = "https://aka.ms/dotnet-warnings/{0}";
internal const string SystemTextEncodingUTF7Message = "The UTF-7 encoding is insecure and should not be used. Consider using UTF-8 instead.";
internal const string SystemTextEncodingUTF7DiagId = "SYSLIB0001";
internal const string PrincipalPermissionAttributeMessage = "PrincipalPermissionAttribute is not honored by the runtime and must not be used.";
internal const string PrincipalPermissionAttributeDiagId = "SYSLIB0002";
internal const string CodeAccessSecurityMessage = "Code Access Security is not supported or honored by the runtime.";
internal const string CodeAccessSecurityDiagId = "SYSLIB0003";
internal const string ConstrainedExecutionRegionMessage = "The Constrained Execution Region (CER) feature is not supported.";
internal const string ConstrainedExecutionRegionDiagId = "SYSLIB0004";
internal const string GlobalAssemblyCacheMessage = "The Global Assembly Cache is not supported.";
internal const string GlobalAssemblyCacheDiagId = "SYSLIB0005";
internal const string ThreadAbortMessage = "Thread.Abort is not supported and throws PlatformNotSupportedException.";
internal const string ThreadResetAbortMessage = "Thread.ResetAbort is not supported and throws PlatformNotSupportedException.";
internal const string ThreadAbortDiagId = "SYSLIB0006";
internal const string DefaultCryptoAlgorithmsMessage = "The default implementation of this cryptography algorithm is not supported.";
internal const string DefaultCryptoAlgorithmsDiagId = "SYSLIB0007";
internal const string CreatePdbGeneratorMessage = "The CreatePdbGenerator API is not supported and throws PlatformNotSupportedException.";
internal const string CreatePdbGeneratorDiagId = "SYSLIB0008";
internal const string AuthenticationManagerMessage = "The AuthenticationManager Authenticate and PreAuthenticate methods are not supported and throw PlatformNotSupportedException.";
internal const string AuthenticationManagerDiagId = "SYSLIB0009";
internal const string RemotingApisMessage = "This Remoting API is not supported and throws PlatformNotSupportedException.";
internal const string RemotingApisDiagId = "SYSLIB0010";
internal const string BinaryFormatterMessage = "BinaryFormatter serialization is obsolete and should not be used. See https://aka.ms/binaryformatter for more information.";
internal const string BinaryFormatterDiagId = "SYSLIB0011";
internal const string CodeBaseMessage = "Assembly.CodeBase and Assembly.EscapedCodeBase are only included for .NET Framework compatibility. Use Assembly.Location instead.";
internal const string CodeBaseDiagId = "SYSLIB0012";
internal const string EscapeUriStringMessage = "Uri.EscapeUriString can corrupt the Uri string in some cases. Consider using Uri.EscapeDataString for query string components instead.";
internal const string EscapeUriStringDiagId = "SYSLIB0013";
internal const string WebRequestMessage = "WebRequest, HttpWebRequest, ServicePoint, and WebClient are obsolete. Use HttpClient instead.";
internal const string WebRequestDiagId = "SYSLIB0014";
internal const string DisablePrivateReflectionAttributeMessage = "DisablePrivateReflectionAttribute has no effect in .NET 6.0+.";
internal const string DisablePrivateReflectionAttributeDiagId = "SYSLIB0015";
internal const string GetContextInfoMessage = "Use the Graphics.GetContextInfo overloads that accept arguments for better performance and fewer allocations.";
internal const string GetContextInfoDiagId = "SYSLIB0016";
internal const string StrongNameKeyPairMessage = "Strong name signing is not supported and throws PlatformNotSupportedException.";
internal const string StrongNameKeyPairDiagId = "SYSLIB0017";
internal const string ReflectionOnlyLoadingMessage = "ReflectionOnly loading is not supported and throws PlatformNotSupportedException.";
internal const string ReflectionOnlyLoadingDiagId = "SYSLIB0018";
internal const string RuntimeEnvironmentMessage = "RuntimeEnvironment members SystemConfigurationFile, GetRuntimeInterfaceAsIntPtr, and GetRuntimeInterfaceAsObject are not supported and throw PlatformNotSupportedException.";
internal const string RuntimeEnvironmentDiagId = "SYSLIB0019";
internal const string JsonSerializerOptionsIgnoreNullValuesMessage = "JsonSerializerOptions.IgnoreNullValues is obsolete. To ignore null values when serializing, set DefaultIgnoreCondition to JsonIgnoreCondition.WhenWritingNull.";
internal const string JsonSerializerOptionsIgnoreNullValuesDiagId = "SYSLIB0020";
internal const string DerivedCryptographicTypesMessage = "Derived cryptographic types are obsolete. Use the Create method on the base type instead.";
internal const string DerivedCryptographicTypesDiagId = "SYSLIB0021";
internal const string RijndaelMessage = "The Rijndael and RijndaelManaged types are obsolete. Use Aes instead.";
internal const string RijndaelDiagId = "SYSLIB0022";
internal const string RNGCryptoServiceProviderMessage = "RNGCryptoServiceProvider is obsolete. To generate a random number, use one of the RandomNumberGenerator static methods instead.";
internal const string RNGCryptoServiceProviderDiagId = "SYSLIB0023";
internal const string AppDomainCreateUnloadMessage = "Creating and unloading AppDomains is not supported and throws an exception.";
internal const string AppDomainCreateUnloadDiagId = "SYSLIB0024";
internal const string SuppressIldasmAttributeMessage = "SuppressIldasmAttribute has no effect in .NET 6.0+.";
internal const string SuppressIldasmAttributeDiagId = "SYSLIB0025";
internal const string X509CertificateImmutableMessage = "X509Certificate and X509Certificate2 are immutable. Use the appropriate constructor to create a new certificate.";
internal const string X509CertificateImmutableDiagId = "SYSLIB0026";
internal const string PublicKeyPropertyMessage = "PublicKey.Key is obsolete. Use the appropriate method to get the public key, such as GetRSAPublicKey.";
internal const string PublicKeyPropertyDiagId = "SYSLIB0027";
internal const string X509CertificatePrivateKeyMessage = "X509Certificate2.PrivateKey is obsolete. Use the appropriate method to get the private key, such as GetRSAPrivateKey, or use the CopyWithPrivateKey method to create a new instance with a private key.";
internal const string X509CertificatePrivateKeyDiagId = "SYSLIB0028";
internal const string ProduceLegacyHmacValuesMessage = "ProduceLegacyHmacValues is obsolete. Producing legacy HMAC values is not supported.";
internal const string ProduceLegacyHmacValuesDiagId = "SYSLIB0029";
internal const string UseManagedSha1Message = "HMACSHA1 always uses the algorithm implementation provided by the platform. Use a constructor without the useManagedSha1 parameter.";
internal const string UseManagedSha1DiagId = "SYSLIB0030";
internal const string CryptoConfigEncodeOIDMessage = "EncodeOID is obsolete. Use the ASN.1 functionality provided in System.Formats.Asn1.";
internal const string CryptoConfigEncodeOIDDiagId = "SYSLIB0031";
internal const string CorruptedStateRecoveryMessage = "Recovery from corrupted process state exceptions is not supported; HandleProcessCorruptedStateExceptionsAttribute is ignored.";
internal const string CorruptedStateRecoveryDiagId = "SYSLIB0032";
internal const string Rfc2898CryptDeriveKeyMessage = "Rfc2898DeriveBytes.CryptDeriveKey is obsolete and is not supported. Use PasswordDeriveBytes.CryptDeriveKey instead.";
internal const string Rfc2898CryptDeriveKeyDiagId = "SYSLIB0033";
internal const string CmsSignerCspParamsCtorMessage = "CmsSigner(CspParameters) is obsolete and is not supported. Use an alternative constructor instead.";
internal const string CmsSignerCspParamsCtorDiagId = "SYSLIB0034";
internal const string SignerInfoCounterSigMessage = "ComputeCounterSignature without specifying a CmsSigner is obsolete and is not supported. Use the overload that accepts a CmsSigner.";
internal const string SignerInfoCounterSigDiagId = "SYSLIB0035";
internal const string RegexCompileToAssemblyMessage = "Regex.CompileToAssembly is obsolete and not supported. Use the GeneratedRegexAttribute with the regular expression source generator instead.";
internal const string RegexCompileToAssemblyDiagId = "SYSLIB0036";
internal const string AssemblyNameMembersMessage = "AssemblyName members HashAlgorithm, ProcessorArchitecture, and VersionCompatibility are obsolete and not supported.";
internal const string AssemblyNameMembersDiagId = "SYSLIB0037";
internal const string SystemDataSerializationFormatBinaryMessage = "SerializationFormat.Binary is obsolete and should not be used. See https://aka.ms/serializationformat-binary-obsolete for more information.";
internal const string SystemDataSerializationFormatBinaryDiagId = "SYSLIB0038";
internal const string TlsVersion10and11Message = "TLS versions 1.0 and 1.1 have known vulnerabilities and are not recommended. Use a newer TLS version instead, or use SslProtocols.None to defer to OS defaults.";
internal const string TlsVersion10and11DiagId = "SYSLIB0039";
internal const string EncryptionPolicyMessage = "EncryptionPolicy.NoEncryption and AllowEncryption significantly reduce security and should not be used in production code.";
internal const string EncryptionPolicyDiagId = "SYSLIB0040";
internal const string Rfc2898OutdatedCtorMessage = "The default hash algorithm and iteration counts in Rfc2898DeriveBytes constructors are outdated and insecure. Use a constructor that accepts the hash algorithm and the number of iterations.";
internal const string Rfc2898OutdatedCtorDiagId = "SYSLIB0041";
internal const string EccXmlExportImportMessage = "ToXmlString and FromXmlString have no implementation for ECC types, and are obsolete. Use a standard import and export format such as ExportSubjectPublicKeyInfo or ImportSubjectPublicKeyInfo for public keys and ExportPkcs8PrivateKey or ImportPkcs8PrivateKey for private keys.";
internal const string EccXmlExportImportDiagId = "SYSLIB0042";
internal const string EcDhPublicKeyBlobMessage = "ECDiffieHellmanPublicKey.ToByteArray() and the associated constructor do not have a consistent and interoperable implementation on all platforms. Use ECDiffieHellmanPublicKey.ExportSubjectPublicKeyInfo() instead.";
internal const string EcDhPublicKeyBlobDiagId = "SYSLIB0043";
internal const string AssemblyNameCodeBaseMessage = "AssemblyName.CodeBase and AssemblyName.EscapedCodeBase are obsolete. Using them for loading an assembly is not supported.";
internal const string AssemblyNameCodeBaseDiagId = "SYSLIB0044";
internal const string CryptoStringFactoryMessage = "Cryptographic factory methods accepting an algorithm name are obsolete. Use the parameterless Create factory method on the algorithm type instead.";
internal const string CryptoStringFactoryDiagId = "SYSLIB0045";
internal const string ControlledExecutionRunMessage = "ControlledExecution.Run method may corrupt the process and should not be used in production code.";
internal const string ControlledExecutionRunDiagId = "SYSLIB0046";
internal const string XmlSecureResolverMessage = "XmlSecureResolver is obsolete. Use XmlResolver.ThrowingResolver instead when attempting to forbid XML external entity resolution.";
internal const string XmlSecureResolverDiagId = "SYSLIB0047";
internal const string RsaEncryptDecryptValueMessage = "RSA.EncryptValue and DecryptValue are not supported and throw NotSupportedException. Use RSA.Encrypt and RSA.Decrypt instead.";
internal const string RsaEncryptDecryptDiagId = "SYSLIB0048";
internal const string JsonSerializerOptionsAddContextMessage = "JsonSerializerOptions.AddContext is obsolete. To register a JsonSerializerContext, use either the TypeInfoResolver or TypeInfoResolverChain properties.";
internal const string JsonSerializerOptionsAddContextDiagId = "SYSLIB0049";
internal const string LegacyFormatterMessage = "Formatter-based serialization is obsolete and should not be used.";
internal const string LegacyFormatterDiagId = "SYSLIB0050";
internal const string LegacyFormatterImplMessage = "This API supports obsolete formatter-based serialization. It should not be called or extended by application code.";
internal const string LegacyFormatterImplDiagId = "SYSLIB0051";
internal const string RegexExtensibilityImplMessage = "This API supports obsolete mechanisms for Regex extensibility. It is not supported.";
internal const string RegexExtensibilityDiagId = "SYSLIB0052";
internal const string AesGcmTagConstructorMessage = "AesGcm should indicate the required tag size for encryption and decryption. Use a constructor that accepts the tag size.";
internal const string AesGcmTagConstructorDiagId = "SYSLIB0053";
}
internal static class SR
{
private static readonly bool s_usingResourceKeys = AppContext.TryGetSwitch("System.Resources.UseSystemResourceKeys", out var isEnabled) && isEnabled;
private static ResourceManager s_resourceManager;
internal static ResourceManager ResourceManager => s_resourceManager ?? (s_resourceManager = new ResourceManager(typeof(SR)));
internal static string ChannelClosedException_DefaultMessage => GetResourceString("ChannelClosedException_DefaultMessage");
internal static string InvalidOperation_IncompleteAsyncOperation => GetResourceString("InvalidOperation_IncompleteAsyncOperation");
internal static string InvalidOperation_MultipleContinuations => GetResourceString("InvalidOperation_MultipleContinuations");
internal static string InvalidOperation_IncorrectToken => GetResourceString("InvalidOperation_IncorrectToken");
internal static bool UsingResourceKeys()
{
return s_usingResourceKeys;
}
private static string GetResourceString(string resourceKey)
{
if (UsingResourceKeys())
{
return resourceKey;
}
string result = null;
try
{
result = ResourceManager.GetString(resourceKey);
}
catch (MissingManifestResourceException)
{
}
return result;
}
private static string GetResourceString(string resourceKey, string defaultString)
{
string resourceString = GetResourceString(resourceKey);
if (!(resourceKey == resourceString) && resourceString != null)
{
return resourceString;
}
return defaultString;
}
internal static string Format(string resourceFormat, object p1)
{
if (UsingResourceKeys())
{
return string.Join(", ", resourceFormat, p1);
}
return string.Format(resourceFormat, p1);
}
internal static string Format(string resourceFormat, object p1, object p2)
{
if (UsingResourceKeys())
{
return string.Join(", ", resourceFormat, p1, p2);
}
return string.Format(resourceFormat, p1, p2);
}
internal static string Format(string resourceFormat, object p1, object p2, object p3)
{
if (UsingResourceKeys())
{
return string.Join(", ", resourceFormat, p1, p2, p3);
}
return string.Format(resourceFormat, p1, p2, p3);
}
internal static string Format(string resourceFormat, params object[] args)
{
if (args != null)
{
if (UsingResourceKeys())
{
return resourceFormat + ", " + string.Join(", ", args);
}
return string.Format(resourceFormat, args);
}
return resourceFormat;
}
internal static string Format(IFormatProvider provider, string resourceFormat, object p1)
{
if (UsingResourceKeys())
{
return string.Join(", ", resourceFormat, p1);
}
return string.Format(provider, resourceFormat, p1);
}
internal static string Format(IFormatProvider provider, string resourceFormat, object p1, object p2)
{
if (UsingResourceKeys())
{
return string.Join(", ", resourceFormat, p1, p2);
}
return string.Format(provider, resourceFormat, p1, p2);
}
internal static string Format(IFormatProvider provider, string resourceFormat, object p1, object p2, object p3)
{
if (UsingResourceKeys())
{
return string.Join(", ", resourceFormat, p1, p2, p3);
}
return string.Format(provider, resourceFormat, p1, p2, p3);
}
internal static string Format(IFormatProvider provider, string resourceFormat, params object[] args)
{
if (args != null)
{
if (UsingResourceKeys())
{
return resourceFormat + ", " + string.Join(", ", args);
}
return string.Format(provider, resourceFormat, args);
}
return resourceFormat;
}
}
}
namespace System.Diagnostics.CodeAnalysis
{
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
internal sealed class MemberNotNullAttribute : Attribute
{
public string[] Members { get; }
public MemberNotNullAttribute(string member)
{
Members = new string[1] { member };
}
public MemberNotNullAttribute(params string[] members)
{
Members = members;
}
}
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
internal sealed class MemberNotNullWhenAttribute : Attribute
{
public bool ReturnValue { get; }
public string[] Members { get; }
public MemberNotNullWhenAttribute(bool returnValue, string member)
{
ReturnValue = returnValue;
Members = new string[1] { member };
}
public MemberNotNullWhenAttribute(bool returnValue, params string[] members)
{
ReturnValue = returnValue;
Members = members;
}
}
}
namespace System.Runtime.InteropServices
{
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
internal sealed class LibraryImportAttribute : Attribute
{
public string LibraryName { get; }
public string EntryPoint { get; set; }
public StringMarshalling StringMarshalling { get; set; }
public Type StringMarshallingCustomType { get; set; }
public bool SetLastError { get; set; }
public LibraryImportAttribute(string libraryName)
{
LibraryName = libraryName;
}
}
internal enum StringMarshalling
{
Custom,
Utf8,
Utf16
}
}
namespace System.Collections.Generic
{
[DebuggerDisplay("Count = {_size}")]
internal sealed class Deque<T>
{
private T[] _array = Array.Empty<T>();
private int _head;
private int _tail;
private int _size;
public int Count => _size;
public bool IsEmpty => _size == 0;
public void EnqueueTail(T item)
{
if (_size == _array.Length)
{
Grow();
}
_array[_tail] = item;
if (++_tail == _array.Length)
{
_tail = 0;
}
_size++;
}
public T DequeueHead()
{
T result = _array[_head];
_array[_head] = default(T);
if (++_head == _array.Length)
{
_head = 0;
}
_size--;
return result;
}
public T PeekHead()
{
return _array[_head];
}
public T PeekTail()
{
int num = _tail - 1;
if (num == -1)
{
num = _array.Length - 1;
}
return _array[num];
}
public T DequeueTail()
{
if (--_tail == -1)
{
_tail = _array.Length - 1;
}
T result = _array[_tail];
_array[_tail] = default(T);
_size--;
return result;
}
public IEnumerator<T> GetEnumerator()
{
int pos = _head;
int count = _size;
while (count-- > 0)
{
yield return _array[pos];
pos = (pos + 1) % _array.Length;
}
}
private void Grow()
{
int num = (int)((long)_array.Length * 2L);
if (num < _array.Length + 4)
{
num = _array.Length + 4;
}
T[] array = new T[num];
if (_head == 0)
{
Array.Copy(_array, array, _size);
}
else
{
Array.Copy(_array, _head, array, 0, _array.Length - _head);
Array.Copy(_array, 0, array, _array.Length - _head, _tail);
}
_array = array;
_head = 0;
_tail = _size;
}
}
}
namespace System.Collections.Concurrent
{
internal interface IProducerConsumerQueue<T> : IEnumerable<T>, IEnumerable
{
bool IsEmpty { get; }
int Count { get; }
void Enqueue(T item);
bool TryDequeue([MaybeNullWhen(false)] out T result);
int GetCountSafe(object syncObj);
}
[DebuggerDisplay("Count = {Count}")]
internal sealed class MultiProducerMultiConsumerQueue<T> : ConcurrentQueue<T>, IProducerConsumerQueue<T>, IEnumerable<T>, IEnumerable
{
bool IProducerConsumerQueue<T>.IsEmpty => base.IsEmpty;
int IProducerConsumerQueue<T>.Count => base.Count;
void IProducerConsumerQueue<T>.Enqueue(T item)
{
Enqueue(item);
}
bool IProducerConsumerQueue<T>.TryDequeue([MaybeNullWhen(false)] out T result)
{
return TryDequeue(out result);
}
int IProducerConsumerQueue<T>.GetCountSafe(object syncObj)
{
return base.Count;
}
}
[DebuggerDisplay("Count = {Count}")]
[DebuggerTypeProxy(typeof(SingleProducerSingleConsumerQueue<>.SingleProducerSingleConsumerQueue_DebugView))]
internal sealed class SingleProducerSingleConsumerQueue<T> : IProducerConsumerQueue<T>, IEnumerable<T>, IEnumerable
{
[StructLayout(LayoutKind.Sequential)]
private sealed class Segment
{
internal Segment _next;
internal readonly T[] _array;
internal SegmentState _state;
internal Segment(int size)
{
_array = new T[size];
}
}
private struct SegmentState
{
internal Internal.PaddingFor32 _pad0;
internal volatile int _first;
internal int _lastCopy;
internal Internal.PaddingFor32 _pad1;
internal int _firstCopy;
internal volatile int _last;
internal Internal.PaddingFor32 _pad2;
}
private sealed class SingleProducerSingleConsumerQueue_DebugView
{
private readonly SingleProducerSingleConsumerQueue<T> _queue;
[DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
public T[] Items => new List<T>(_queue).ToArray();
public SingleProducerSingleConsumerQueue_DebugView(SingleProducerSingleConsumerQueue<T> queue)
{
_queue = queue;
}
}
private const int InitialSegmentSize = 32;
private const int MaxSegmentSize = 16777216;
private volatile Segment _head;
private volatile Segment _tail;
public bool IsEmpty
{
get
{
Segment head = _head;
if (head._state._first != head._state._lastCopy)
{
return false;
}
if (head._state._first != head._state._last)
{
return false;
}
return head._next == null;
}
}
public int Count
{
get
{
int num = 0;
for (Segment segment = _head; segment != null; segment = segment._next)
{
int num2 = segment._array.Length;
int first;
int last;
do
{
first = segment._state._first;
last = segment._state._last;
}
while (first != segment._state._first);
num += (last - first) & (num2 - 1);
}
return num;
}
}
public SingleProducerSingleConsumerQueue()
{
_head = (_tail = new Segment(32));
}
public void Enqueue(T item)
{
Segment segment = _tail;
T[] array = segment._array;
int last = segment._state._last;
int num = (last + 1) & (array.Length - 1);
if (num != segment._state._firstCopy)
{
array[last] = item;
segment._state._last = num;
}
else
{
EnqueueSlow(item, ref segment);
}
}
private void EnqueueSlow(T item, ref Segment segment)
{
if (segment._state._firstCopy != segment._state._first)
{
segment._state._firstCopy = segment._state._first;
Enqueue(item);
return;
}
int size = Math.Min(_tail._array.Length * 2, 16777216);
Segment segment2 = new Segment(size);
segment2._array[0] = item;
segment2._state._last = 1;
segment2._state._lastCopy = 1;
try
{
}
finally
{
Volatile.Write(ref _tail._next, segment2);
_tail = segment2;
}
}
public bool TryDequeue([MaybeNullWhen(false)] out T result)
{
Segment head = _head;
T[] array = head._array;
int first = head._state._first;
if (first != head._state._lastCopy)
{
result = array[first];
array[first] = default(T);
head._state._first = (first + 1) & (array.Length - 1);
return true;
}
return TryDequeueSlow(head, array, peek: false, out result);
}
public bool TryPeek([MaybeNullWhen(false)] out T result)
{
Segment head = _head;
T[] array = head._array;
int first = head._state._first;
if (first != head._state._lastCopy)
{
result = array[first];
return true;
}
return TryDequeueSlow(head, array, peek: true, out result);
}
private bool TryDequeueSlow(Segment segment, T[] array, bool peek, [MaybeNullWhen(false)] out T result)
{
if (segment._state._last != segment._state._lastCopy)
{
segment._state._lastCopy = segment._state._last;
if (!peek)
{
return TryDequeue(out result);
}
return TryPeek(out result);
}
if (segment._next != null && segment._state._first == segment._state._last)
{
segment = segment._next;
array = segment._array;
_head = segment;
}
int first = segment._state._first;
if (first == segment._state._last)
{
result = default(T);
return false;
}
result = array[first];
if (!peek)
{
array[first] = default(T);
segment._state._first = (first + 1) & (segment._array.Length - 1);
segment._state._lastCopy = segment._state._last;
}
return true;
}
public bool TryDequeueIf(Predicate<T> predicate, [MaybeNullWhen(false)] out T result)
{
Segment head = _head;
T[] array = head._array;
int first = head._state._first;
if (first != head._state._lastCopy)
{
result = array[first];
if (predicate == null || predicate(result))
{
array[first] = default(T);
head._state._first = (first + 1) & (array.Length - 1);
return true;
}
result = default(T);
return false;
}
return TryDequeueIfSlow(predicate, head, array, out result);
}
private bool TryDequeueIfSlow(Predicate<T> predicate, Segment segment, T[] array, [MaybeNullWhen(false)] out T result)
{
if (segment._state._last != segment._state._lastCopy)
{
segment._state._lastCopy = segment._state._last;
return TryDequeueIf(predicate, out result);
}
if (segment._next != null && segment._state._first == segment._state._last)
{
segment = segment._next;
array = segment._array;
_head = segment;
}
int first = segment._state._first;
if (first == segment._state._last)
{
result = default(T);
return false;
}
result = array[first];
if (predicate == null || predicate(result))
{
array[first] = default(T);
segment._state._first = (first + 1) & (segment._array.Length - 1);
segment._state._lastCopy = segment._state._last;
return true;
}
result = default(T);
return false;
}
public void Clear()
{
T result;
while (TryDequeue(out result))
{
}
}
public IEnumerator<T> GetEnumerator()
{
for (Segment segment = _head; segment != null; segment = segment._next)
{
for (int pt = segment._state._first; pt != segment._state._last; pt = (pt + 1) & (segment._array.Length - 1))
{
yield return segment._array[pt];
}
}
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
int IProducerConsumerQueue<T>.GetCountSafe(object syncObj)
{
lock (syncObj)
{
return Count;
}
}
}
}
namespace System.Threading.Channels
{
internal abstract class AsyncOperation
{
protected static readonly Action<object> s_availableSentinel = AvailableSentinel;
protected static readonly Action<object> s_completedSentinel = CompletedSentinel;
private static void AvailableSentinel(object s)
{
}
private static void CompletedSentinel(object s)
{
}
protected static void ThrowIncompleteOperationException()
{
throw new InvalidOperationException(System.SR.InvalidOperation_IncompleteAsyncOperation);
}
protected static void ThrowMultipleContinuations()
{
throw new InvalidOperationException(System.SR.InvalidOperation_MultipleContinuations);
}
protected static void ThrowIncorrectCurrentIdException()
{
throw new InvalidOperationException(System.SR.InvalidOperation_IncorrectToken);
}
}
internal class AsyncOperation<TResult> : AsyncOperation, IValueTaskSource, IValueTaskSource<TResult>
{
private readonly CancellationTokenRegistration _registration;
private readonly bool _pooled;
private readonly bool _runContinuationsAsynchronously;
private volatile int _completionReserved;
private TResult _result;
private ExceptionDispatchInfo _error;
private Action<object> _continuation;
private object _continuationState;
private object _schedulingContext;
private ExecutionContext _executionContext;
private short _currentId;
public AsyncOperation<TResult> Next { get; set; }
public CancellationToken CancellationToken { get; }
public ValueTask ValueTask => new ValueTask(this, _currentId);
public ValueTask<TResult> ValueTaskOfT => new ValueTask<TResult>(this, _currentId);
internal bool IsCompleted => (object)_continuation == AsyncOperation.s_completedSentinel;
public AsyncOperation(bool runContinuationsAsynchronously, CancellationToken cancellationToken = default(CancellationToken), bool pooled = false)
{
_continuation = (pooled ? AsyncOperation.s_availableSentinel : null);
_pooled = pooled;
_runContinuationsAsynchronously = runContinuationsAsynchronously;
if (cancellationToken.CanBeCanceled)
{
CancellationToken = cancellationToken;
_registration = UnsafeRegister(cancellationToken, delegate(object s)
{
AsyncOperation<TResult> asyncOperation = (AsyncOperation<TResult>)s;
asyncOperation.TrySetCanceled(asyncOperation.CancellationToken);
}, this);
}
}
public ValueTaskSourceStatus GetStatus(short token)
{
if (_currentId != token)
{
AsyncOperation.ThrowIncorrectCurrentIdException();
}
if (IsCompleted)
{
if (_error != null)
{
if (!(_error.SourceException is OperationCanceledException))
{
return ValueTaskSourceStatus.Faulted;
}
return ValueTaskSourceStatus.Canceled;
}
return ValueTaskSourceStatus.Succeeded;
}
return ValueTaskSourceStatus.Pending;
}
public TResult GetResult(short token)
{
if (_currentId != token)
{
AsyncOperation.ThrowIncorrectCurrentIdException();
}
if (!IsCompleted)
{
AsyncOperation.ThrowIncompleteOperationException();
}
ExceptionDispatchInfo error = _error;
TResult result = _result;
_currentId++;
if (_pooled)
{
Volatile.Write(ref _continuation, AsyncOperation.s_availableSentinel);
}
error?.Throw();
return result;
}
void IValueTaskSource.GetResult(short token)
{
if (_currentId != token)
{
AsyncOperation.ThrowIncorrectCurrentIdException();
}
if (!IsCompleted)
{
AsyncOperation.ThrowIncompleteOperationException();
}
ExceptionDispatchInfo error = _error;
_currentId++;
if (_pooled)
{
Volatile.Write(ref _continuation, AsyncOperation.s_availableSentinel);
}
error?.Throw();
}
public bool TryOwnAndReset()
{
if ((object)Interlocked.CompareExchange(ref _continuation, null, AsyncOperation.s_availableSentinel) == AsyncOperation.s_availableSentinel)
{
_continuationState = null;
_result = default(TResult);
_error = null;
_schedulingContext = null;
_executionContext = null;
return true;
}
return false;
}
public void OnCompleted(Action<object> continuation, object state, short token, ValueTaskSourceOnCompletedFlags flags)
{
if (_currentId != token)
{
AsyncOperation.ThrowIncorrectCurrentIdException();
}
if (_continuationState != null)
{
AsyncOperation.ThrowMultipleContinuations();
}
_continuationState = state;
if ((flags & ValueTaskSourceOnCompletedFlags.FlowExecutionContext) != 0)
{
_executionContext = ExecutionContext.Capture();
}
SynchronizationContext synchronizationContext = null;
TaskScheduler taskScheduler = null;
if ((flags & ValueTaskSourceOnCompletedFlags.UseSchedulingContext) != 0)
{
synchronizationContext = SynchronizationContext.Current;
if (synchronizationContext != null && synchronizationContext.GetType() != typeof(SynchronizationContext))
{
_schedulingContext = synchronizationContext;
}
else
{
synchronizationContext = null;
taskScheduler = TaskScheduler.Current;
if (taskScheduler != TaskScheduler.Default)
{
_schedulingContext = taskScheduler;
}
}
}
Action<object> action = Interlocked.CompareExchange(ref _continuation, continuation, null);
if (action == null)
{
return;
}
if ((object)action != AsyncOperation.s_completedSentinel)
{
AsyncOperation.ThrowMultipleContinuations();
}
if (_schedulingContext == null)
{
if (_executionContext == null)
{
UnsafeQueueUserWorkItem(continuation, state);
}
else
{
QueueUserWorkItem(continuation, state);
}
}
else if (synchronizationContext != null)
{
synchronizationContext.Post(delegate(object s)
{
KeyValuePair<Action<object>, object> keyValuePair = (KeyValuePair<Action<object>, object>)s;
keyValuePair.Key(keyValuePair.Value);
}, new KeyValuePair<Action<object>, object>(continuation, state));
}
else
{
Task.Factory.StartNew(continuation, state, CancellationToken.None, TaskCreationOptions.DenyChildAttach, taskScheduler);
}
}
public bool UnregisterCancellation()
{
if (CancellationToken.CanBeCanceled)
{
_registration.Dispose();
return _completionReserved == 0;
}
return true;
}
public bool TrySetResult(TResult item)
{
UnregisterCancellation();
if (TryReserveCompletionIfCancelable())
{
_result = item;
SignalCompletion();
return true;
}
return false;
}
public bool TrySetException(Exception exception)
{
UnregisterCancellation();
if (TryReserveCompletionIfCancelable())
{
_error = ExceptionDispatchInfo.Capture(exception);
SignalCompletion();
return true;
}
return false;
}
public bool TrySetCanceled(CancellationToken cancellationToken = default(CancellationToken))
{
if (TryReserveCompletionIfCancelable())
{
_error = ExceptionDispatchInfo.Capture(new OperationCanceledException(cancellationToken));
SignalCompletion();
return true;
}
return false;
}
private bool TryReserveCompletionIfCancelable()
{
if (CancellationToken.CanBeCanceled)
{
return Interlocked.CompareExchange(ref _completionReserved, 1, 0) == 0;
}
return true;
}
private void SignalCompletion()
{
if (_continuation == null && Interlocked.CompareExchange(ref _continuation, AsyncOperation.s_completedSentinel, null) == null)
{
return;
}
if (_schedulingContext == null)
{
if (_runContinuationsAsynchronously)
{
UnsafeQueueSetCompletionAndInvokeContinuation();
return;
}
}
else if (_schedulingContext is SynchronizationContext synchronizationContext)
{
if (_runContinuationsAsynchronously || synchronizationContext != SynchronizationContext.Current)
{
synchronizationContext.Post(delegate(object s)
{
((AsyncOperation<TResult>)s).SetCompletionAndInvokeContinuation();
}, this);
return;
}
}
else
{
TaskScheduler taskScheduler = (TaskScheduler)_schedulingContext;
if (_runContinuationsAsynchronously || taskScheduler != TaskScheduler.Current)
{
Task.Factory.StartNew(delegate(object s)
{
((AsyncOperation<TResult>)s).SetCompletionAndInvokeContinuation();
}, this, CancellationToken.None, TaskCreationOptions.DenyChildAttach, taskScheduler);
return;
}
}
SetCompletionAndInvokeContinuation();
}
private void SetCompletionAndInvokeContinuation()
{
if (_executionContext == null)
{
Action<object> continuation = _continuation;
_continuation = AsyncOperation.s_completedSentinel;
continuation(_continuationState);
return;
}
ExecutionContext.Run(_executionContext, delegate(object s)
{
AsyncOperation<TResult> asyncOperation = (AsyncOperation<TResult>)s;
Action<object> continuation2 = asyncOperation._continuation;
asyncOperation._continuation = AsyncOperation.s_completedSentinel;
continuation2(asyncOperation._continuationState);
}, this);
}
private void UnsafeQueueSetCompletionAndInvokeContinuation()
{
ThreadPool.UnsafeQueueUserWorkItem(delegate(object s)
{
((AsyncOperation<TResult>)s).SetCompletionAndInvokeContinuation();
}, this);
}
private static void UnsafeQueueUserWorkItem(Action<object> action, object state)
{
QueueUserWorkItem(action, state);
}
private static void QueueUserWorkItem(Action<object> action, object state)
{
Task.Factory.StartNew(action, state, CancellationToken.None, TaskCreationOptions.DenyChildAttach, TaskScheduler.Default);
}
private static CancellationTokenRegistration UnsafeRegister(CancellationToken cancellationToken, Action<object> action, object state)
{
return cancellationToken.Register(action, state);
}
}
internal sealed class VoidAsyncOperationWithData<TData> : AsyncOperation<VoidResult>
{
public TData Item { get; set; }
public VoidAsyncOperationWithData(bool runContinuationsAsynchronously, CancellationToken cancellationToken = default(CancellationToken), bool pooled = false)
: base(runContinuationsAsynchronously, cancellationToken, pooled)
{
}
}
[DebuggerDisplay("Items = {ItemsCountForDebugger}, Capacity = {_bufferedCapacity}, Mode = {_mode}, Closed = {ChannelIsClosedForDebugger}")]
[DebuggerTypeProxy(typeof(DebugEnumeratorDebugView<>))]
internal sealed class BoundedChannel<T> : Channel<T>, IDebugEnumerable<T>
{
[DebuggerDisplay("Items = {ItemsCountForDebugger}")]
[DebuggerTypeProxy(typeof(DebugEnumeratorDebugView<>))]
private sealed class BoundedChannelReader : ChannelReader<T>, IDebugEnumerable<T>
{
internal readonly BoundedChannel<T> _parent;
private readonly AsyncOperation<T> _readerSingleton;
private readonly AsyncOperation<bool> _waiterSingleton;
public override Task Completion => _parent._completion.Task;
public override bool CanCount => true;
public override bool CanPeek => true;
public override int Count
{
get
{
BoundedChannel<T> parent = _parent;
lock (parent.SyncObj)
{
return parent._items.Count;
}
}
}
private int ItemsCountForDebugger => _parent._items.Count;
internal BoundedChannelReader(BoundedChannel<T> parent)
{
_parent = parent;
_readerSingleton = new AsyncOperation<T>(parent._runContinuationsAsynchronously, default(CancellationToken), pooled: true);
_waiterSingleton = new AsyncOperation<bool>(parent._runContinuationsAsynchronously, default(CancellationToken), pooled: true);
}
public override bool TryRead([MaybeNullWhen(false)] out T item)
{
BoundedChannel<T> parent = _parent;
lock (parent.SyncObj)
{
if (!parent._items.IsEmpty)
{
item = DequeueItemAndPostProcess();
return true;
}
}
item = default(T);
return false;
}
public override bool TryPeek([MaybeNullWhen(false)] out T item)
{
BoundedChannel<T> parent = _parent;
lock (parent.SyncObj)
{
if (!parent._items.IsEmpty)
{
item = parent._items.PeekHead();
return true;
}
}
item = default(T);
return false;
}
public override ValueTask<T> ReadAsync(CancellationToken cancellationToken)
{
if (cancellationToken.IsCancellationRequested)
{
return new ValueTask<T>(Task.FromCanceled<T>(cancellationToken));
}
BoundedChannel<T> parent = _parent;
lock (parent.SyncObj)
{
if (!parent._items.IsEmpty)
{
return new ValueTask<T>(DequeueItemAndPostProcess());
}
if (parent._doneWriting != null)
{
return ChannelUtilities.GetInvalidCompletionValueTask<T>(parent._doneWriting);
}
if (!cancellationToken.CanBeCanceled)
{
AsyncOperation<T> readerSingleton = _readerSingleton;
if (readerSingleton.TryOwnAndReset())
{
parent._blockedReaders.EnqueueTail(readerSingleton);
return readerSingleton.ValueTaskOfT;
}
}
AsyncOperation<T> asyncOperation = new AsyncOperation<T>(parent._runContinuationsAsynchronously | cancellationToken.CanBeCanceled, cancellationToken);
parent._blockedReaders.EnqueueTail(asyncOperation);
return asyncOperation.ValueTaskOfT;
}
}
public override ValueTask<bool> WaitToReadAsync(CancellationToken cancellationToken)
{
if (cancellationToken.IsCancellationRequested)
{
return new ValueTask<bool>(Task.FromCanceled<bool>(cancellationToken));
}
BoundedChannel<T> parent = _parent;
lock (parent.SyncObj)
{
if (!parent._items.IsEmpty)
{
return new ValueTask<bool>(result: true);
}
if (parent._doneWriting != null)
{
return (parent._doneWriting != ChannelUtilities.s_doneWritingSentinel) ? new ValueTask<bool>(Task.FromException<bool>(parent._doneWriting)) : default(ValueTask<bool>);
}
if (!cancellationToken.CanBeCanceled)
{
AsyncOperation<bool> waiterSingleton = _waiterSingleton;
if (waiterSingleton.TryOwnAndReset())
{
ChannelUtilities.QueueWaiter(ref parent._waitingReadersTail, waiterSingleton);
return waiterSingleton.ValueTaskOfT;
}
}
AsyncOperation<bool> asyncOperation = new AsyncOperation<bool>(parent._runContinuationsAsynchronously | cancellationToken.CanBeCanceled, cancellationToken);
ChannelUtilities.QueueWaiter(ref _parent._waitingReadersTail, asyncOperation);
return asyncOperation.ValueTaskOfT;
}
}
private T DequeueItemAndPostProcess()
{
BoundedChannel<T> parent = _parent;
T result = parent._items.DequeueHead();
if (parent._doneWriting != null)
{
if (parent._items.IsEmpty)
{
ChannelUtilities.Complete(parent._completion, parent._doneWriting);
}
}
else
{
while (!parent._blockedWriters.IsEmpty)
{
VoidAsyncOperationWithData<T> voidAsyncOperationWithData = parent._blockedWriters.DequeueHead();
if (voidAsyncOperationWithData.TrySetResult(default(VoidResult)))
{
parent._items.EnqueueTail(voidAsyncOperationWithData.Item);
return result;
}
}
ChannelUtilities.WakeUpWaiters(ref parent._waitingWritersTail, result: true);
}
return result;
}
IEnumerator<T> IDebugEnumerable<T>.GetEnumerator()
{
return _parent._items.GetEnumerator();
}
}
[DebuggerDisplay("Items = {ItemsCountForDebugger}, Capacity = {CapacityForDebugger}")]
[DebuggerTypeProxy(typeof(DebugEnumeratorDebugView<>))]
private sealed class BoundedChannelWriter : ChannelWriter<T>, IDebugEnumerable<T>
{
internal readonly BoundedChannel<T> _parent;
private readonly VoidAsyncOperationWithData<T> _writerSingleton;
private readonly AsyncOperation<bool> _waiterSingleton;
private int ItemsCountForDebugger => _parent._items.Count;
private int CapacityForDebugger => _parent._bufferedCapacity;
internal BoundedChannelWriter(BoundedChannel<T> parent)
{
_parent = parent;
_writerSingleton = new VoidAsyncOperationWithData<T>(runContinuationsAsynchronously: true, default(CancellationToken), pooled: true);
_waiterSingleton = new AsyncOperation<bool>(runContinuationsAsynchronously: true, default(CancellationToken), pooled: true);
}
public override bool TryComplete(Exception error)
{
BoundedChannel<T> parent = _parent;
bool isEmpty;
lock (parent.SyncObj)
{
if (parent._doneWriting != null)
{
return false;
}
parent._doneWriting = error ?? ChannelUtilities.s_doneWritingSentinel;
isEmpty = parent._items.IsEmpty;
}
if (isEmpty)
{
ChannelUtilities.Complete(parent._completion, error);
}
ChannelUtilities.FailOperations<AsyncOperation<T>, T>(parent._blockedReaders, ChannelUtilities.CreateInvalidCompletionException(error));
ChannelUtilities.FailOperations<VoidAsyncOperationWithData<T>, VoidResult>(parent._blockedWriters, ChannelUtilities.CreateInvalidCompletionException(error));
ChannelUtilities.WakeUpWaiters(ref parent._waitingReadersTail, result: false, error);
ChannelUtilities.WakeUpWaiters(ref parent._waitingWritersTail, result: false, error);
return true;
}
public override bool TryWrite(T item)
{
AsyncOperation<T> asyncOperation = null;
AsyncOperation<bool> listTail = null;
BoundedChannel<T> parent = _parent;
bool lockTaken = false;
try
{
Monitor.Enter(parent.SyncObj, ref lockTaken);
if (parent._doneWriting != null)
{
return false;
}
int count = parent._items.Count;
if (count != 0)
{
if (count < parent._bufferedCapacity)
{
parent._items.EnqueueTail(item);
return true;
}
if (parent._mode == BoundedChannelFullMode.Wait)
{
return false;
}
if (parent._mode == BoundedChannelFullMode.DropWrite)
{
Monitor.Exit(parent.SyncObj);
lockTaken = false;
parent._itemDropped?.Invoke(item);
return true;
}
T obj = ((parent._mode == BoundedChannelFullMode.DropNewest) ? parent._items.DequeueTail() : parent._items.DequeueHead());
parent._items.EnqueueTail(item);
Monitor.Exit(parent.SyncObj);
lockTaken = false;
parent._itemDropped?.Invoke(obj);
return true;
}
while (!parent._blockedReaders.IsEmpty)
{
AsyncOperation<T> asyncOperation2 = parent._blockedReaders.DequeueHead();
if (asyncOperation2.UnregisterCancellation())
{
asyncOperation = asyncOperation2;
break;
}
}
if (asyncOperation == null)
{
parent._items.EnqueueTail(item);
listTail = parent._waitingReadersTail;
if (listTail == null)
{
return true;
}
parent._waitingReadersTail = null;
}
}
finally
{
if (lockTaken)
{
Monitor.Exit(parent.SyncObj);
}
}
if (asyncOperation != null)
{
bool flag = asyncOperation.TrySetResult(item);
}
else
{
ChannelUtilities.WakeUpWaiters(ref listTail, result: true);
}
return true;
}
public override ValueTask<bool> WaitToWriteAsync(CancellationToken cancellationToken)
{
if (cancellationToken.IsCancellationRequested)
{
return new ValueTask<bool>(Task.FromCanceled<bool>(cancellationToken));
}
BoundedChannel<T> parent = _parent;
lock (parent.SyncObj)
{
if (parent._doneWriting != null)
{
return (parent._doneWriting != ChannelUtilities.s_doneWritingSentinel) ? new ValueTask<bool>(Task.FromException<bool>(parent._doneWriting)) : default(ValueTask<bool>);
}
if (parent._items.Count < parent._bufferedCapacity || parent._mode != 0)
{
return new ValueTask<bool>(result: true);
}
if (!cancellationToken.CanBeCanceled)
{
AsyncOperation<bool> waiterSingleton = _waiterSingleton;
if (waiterSingleton.TryOwnAndReset())
{
ChannelUtilities.QueueWaiter(ref parent._waitingWritersTail, waiterSingleton);
return waiterSingleton.ValueTaskOfT;
}
}
AsyncOperation<bool> asyncOperation = new AsyncOperation<bool>(runContinuationsAsynchronously: true, cancellationToken);
ChannelUtilities.QueueWaiter(ref parent._waitingWritersTail, asyncOperation);
return asyncOperation.ValueTaskOfT;
}
}
public override ValueTask WriteAsync(T item, CancellationToken cancellationToken)
{
if (cancellationToken.IsCancellationRequested)
{
return new ValueTask(Task.FromCanceled(cancellationToken));
}
AsyncOperation<T> asyncOperation = null;
AsyncOperation<bool> listTail = null;
BoundedChannel<T> parent = _parent;
bool lockTaken = false;
try
{
Monitor.Enter(parent.SyncObj, ref lockTaken);
if (parent._doneWriting != null)
{
return new ValueTask(Task.FromException(ChannelUtilities.CreateInvalidCompletionException(parent._doneWriting)));
}
int count = parent._items.Count;
if (count != 0)
{
if (count < parent._bufferedCapacity)
{
parent._items.EnqueueTail(item);
return default(ValueTask);
}
if (parent._mode == BoundedChannelFullMode.Wait)
{
if (!cancellationToken.CanBeCanceled)
{
VoidAsyncOperationWithData<T> writerSingleton = _writerSingleton;
if (writerSingleton.TryOwnAndReset())
{
writerSingleton.Item = item;
parent._blockedWriters.EnqueueTail(writerSingleton);
return writerSingleton.ValueTask;
}
}
VoidAsyncOperationWithData<T> voidAsyncOperationWithData = new VoidAsyncOperationWithData<T>(runContinuationsAsynchronously: true, cancellationToken);
voidAsyncOperationWithData.Item = item;
parent._blockedWriters.EnqueueTail(voidAsyncOperationWithData);
return voidAsyncOperationWithData.ValueTask;
}
if (parent._mode == BoundedChannelFullMode.DropWrite)
{
Monitor.Exit(parent.SyncObj);
lockTaken = false;
parent._itemDropped?.Invoke(item);
return default(ValueTask);
}
T obj = ((parent._mode == BoundedChannelFullMode.DropNewest) ? parent._items.DequeueTail() : parent._items.DequeueHead());
parent._items.EnqueueTail(item);
Monitor.Exit(parent.SyncObj);
lockTaken = false;
parent._itemDropped?.Invoke(obj);
return default(ValueTask);
}
while (!parent._blockedReaders.IsEmpty)
{
AsyncOperation<T> asyncOperation2 = parent._blockedReaders.DequeueHead();
if (asyncOperation2.UnregisterCancellation())
{
asyncOperation = asyncOperation2;
break;
}
}
if (asyncOperation == null)
{
parent._items.EnqueueTail(item);
listTail = parent._waitingReadersTail;
if (listTail == null)
{
return default(ValueTask);
}
parent._waitingReadersTail = null;
}
}
finally
{
if (lockTaken)
{
Monitor.Exit(parent.SyncObj);
}
}
if (asyncOperation != null)
{
bool flag = asyncOperation.TrySetResult(item);
}
else
{
ChannelUtilities.WakeUpWaiters(ref listTail, result: true);
}
return default(ValueTask);
}
IEnumerator<T> IDebugEnumerable<T>.GetEnumerator()
{
return _parent._items.GetEnumerator();
}
}
private readonly BoundedChannelFullMode _mode;
private readonly Action<T> _itemDropped;
private readonly TaskCompletionSource _completion;
private readonly int _bufferedCapacity;
private readonly Deque<T> _items = new Deque<T>();
private readonly Deque<AsyncOperation<T>> _blockedReaders = new Deque<AsyncOperation<T>>();
private readonly Deque<VoidAsyncOperationWithData<T>> _blockedWriters = new Deque<VoidAsyncOperationWithData<T>>();
private AsyncOperation<bool> _waitingReadersTail;
private AsyncOperation<bool> _waitingWritersTail;
private readonly bool _runContinuationsAsynchronously;
private Exception _doneWriting;
private object SyncObj => _items;
private int ItemsCountForDebugger => _items.Count;
private bool ChannelIsClosedForDebugger => _doneWriting != null;
internal BoundedChannel(int bufferedCapacity, BoundedChannelFullMode mode, bool runContinuationsAsynchronously, Action<T> itemDropped)
{
_bufferedCapacity = bufferedCapacity;
_mode = mode;
_runContinuationsAsynchronously = runContinuationsAsynchronously;
_itemDropped = itemDropped;
_completion = new TaskCompletionSource(runContinuationsAsynchronously ? TaskCreationOptions.RunContinuationsAsynchronously : TaskCreationOptions.None);
base.Reader = new BoundedChannelReader(this);
base.Writer = new BoundedChannelWriter(this);
}
[Conditional("DEBUG")]
private void AssertInvariants()
{
_ = _items.IsEmpty;
_ = _items.Count;
_ = _bufferedCapacity;
_ = _blockedReaders.IsEmpty;
_ = _blockedWriters.IsEmpty;
_ = _completion.Task.IsCompleted;
}
IEnumerator<T> IDebugEnumerable<T>.GetEnumerator()
{
return _items.GetEnumerator();
}
}
public enum BoundedChannelFullMode
{
Wait,
DropNewest,
DropOldest,
DropWrite
}
public static class Channel
{
public static Channel<T> CreateUnbounded<T>()
{
return new UnboundedChannel<T>(runContinuationsAsynchronously: true);
}
public static Channel<T> CreateUnbounded<T>(UnboundedChannelOptions options)
{
if (options == null)
{
throw new ArgumentNullException("options");
}
if (options.SingleReader)
{
return new SingleConsumerUnboundedChannel<T>(!options.AllowSynchronousContinuations);
}
return new UnboundedChannel<T>(!options.AllowSynchronousContinuations);
}
public static Channel<T> CreateBounded<T>(int capacity)
{
if (capacity < 1)
{
throw new ArgumentOutOfRangeException("capacity");
}
return new BoundedChannel<T>(capacity, BoundedChannelFullMode.Wait, runContinuationsAsynchronously: true, null);
}
public static Channel<T> CreateBounded<T>(BoundedChannelOptions options)
{
return CreateBounded<T>(options, null);
}
public static Channel<T> CreateBounded<T>(BoundedChannelOptions options, Action<T>? itemDropped)
{
if (options == null)
{
throw new ArgumentNullException("options");
}
return new BoundedChannel<T>(options.Capacity, options.FullMode, !options.AllowSynchronousContinuations, itemDropped);
}
}
[Serializable]
public class ChannelClosedException : InvalidOperationException
{
public ChannelClosedException()
: base(System.SR.ChannelClosedException_DefaultMessage)
{
}
public ChannelClosedException(string? message)
: base(message)
{
}
public ChannelClosedException(Exception? innerException)
: base(System.SR.ChannelClosedException_DefaultMessage, innerException)
{
}
public ChannelClosedException(string? message, Exception? innerException)
: base(message, innerException)
{
}
protected ChannelClosedException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
}
public abstract class ChannelOptions
{
public bool SingleWriter { get; set; }
public bool SingleReader { get; set; }
public bool AllowSynchronousContinuations { get; set; }
}
public sealed class BoundedChannelOptions : ChannelOptions
{
private int _capacity;
private BoundedChannelFullMode _mode;
public int Capacity
{
get
{
return _capacity;
}
set
{
if (value < 1)
{
throw new ArgumentOutOfRangeException("value");
}
_capacity = value;
}
}
public BoundedChannelFullMode FullMode
{
get
{
return _mode;
}
set
{
if ((uint)value <= 3u)
{
_mode = value;
return;
}
throw new ArgumentOutOfRangeException("value");
}
}
public BoundedChannelOptions(int capacity)
{
if (capacity < 1)
{
throw new ArgumentOutOfRangeException("capacity");
}
_capacity = capacity;
}
}
public sealed class UnboundedChannelOptions : ChannelOptions
{
}
public abstract class ChannelReader<T>
{
public virtual Task Completion => ChannelUtilities.s_neverCompletingTask;
public virtual bool CanCount => false;
public virtual bool CanPeek => false;
public virtual int Count
{
get
{
throw new NotSupportedException();
}
}
public abstract bool TryRead([MaybeNullWhen(false)] out T item);
public virtual bool TryPeek([MaybeNullWhen(false)] out T item)
{
item = default(T);
return false;
}
public abstract ValueTask<bool> WaitToReadAsync(CancellationToken cancellationToken = default(CancellationToken));
public virtual ValueTask<T> ReadAsync(CancellationToken cancellationToken = default(CancellationToken))
{
if (cancellationToken.IsCancellationRequested)
{
return new ValueTask<T>(Task.FromCanceled<T>(cancellationToken));
}
try
{
if (TryRead(out var item))
{
return new ValueTask<T>(item);
}
}
catch (Exception ex) when (!(ex is ChannelClosedException) && !(ex is OperationCanceledException))
{
return new ValueTask<T>(Task.FromException<T>(ex));
}
return ReadAsyncCore(cancellationToken);
async ValueTask<T> ReadAsyncCore(CancellationToken ct)
{
T item2;
do
{
if (!(await WaitToReadAsync(ct).ConfigureAwait(continueOnCapturedContext: false)))
{
throw new ChannelClosedException();
}
}
while (!TryRead(out item2));
return item2;
}
}
public virtual async IAsyncEnumerable<T> ReadAllAsync([EnumeratorCancellation] CancellationToken cancellationToken = default(CancellationToken))
{
while (await WaitToReadAsync(cancellationToken).ConfigureAwait(continueOnCapturedContext: false))
{
T item;
while (TryRead(out item))
{
yield return item;
}
}
}
}
internal static class ChannelUtilities
{
internal static readonly Exception s_doneWritingSentinel = new Exception("s_doneWritingSentinel");
internal static readonly Task<bool> s_trueTask = Task.FromResult(result: true);
internal static readonly Task<bool> s_falseTask = Task.FromResult(result: false);
internal static readonly Task s_neverCompletingTask = new TaskCompletionSource<bool>().Task;
internal static void Complete(TaskCompletionSource tcs, Exception error = null)
{
if (error is OperationCanceledException ex)
{
tcs.TrySetCanceled(ex.CancellationToken);
}
else if (error != null && error != s_doneWritingSentinel)
{
if (tcs.TrySetException(error))
{
_ = tcs.Task.Exception;
}
}
else
{
tcs.TrySetResult();
}
}
internal static ValueTask<T> GetInvalidCompletionValueTask<T>(Exception error)
{
Task<T> task = ((error == s_doneWritingSentinel) ? Task.FromException<T>(CreateInvalidCompletionException()) : ((error is OperationCanceledException ex) ? Task.FromCanceled<T>(ex.CancellationToken.IsCancellationRequested ? ex.CancellationToken : new CancellationToken(canceled: true)) : Task.FromException<T>(CreateInvalidCompletionException(error))));
return new ValueTask<T>(task);
}
internal static void QueueWaiter(ref AsyncOperation<bool> tail, AsyncOperation<bool> waiter)
{
AsyncOperation<bool> asyncOperation = tail;
if (asyncOperation == null)
{
waiter.Next = waiter;
}
else
{
waiter.Next = asyncOperation.Next;
asyncOperation.Next = waiter;
}
tail = waiter;
}
internal static void WakeUpWaiters(ref AsyncOperation<bool> listTail, bool result, Exception error = null)
{
AsyncOperation<bool> asyncOperation = listTail;
if (asyncOperation != null)
{
listTail = null;
AsyncOperation<bool> next = asyncOperation.Next;
AsyncOperation<bool> asyncOperation2 = next;
do
{
AsyncOperation<bool> next2 = asyncOperation2.Next;
asyncOperation2.Next = null;
bool flag = ((error != null) ? asyncOperation2.TrySetException(error) : asyncOperation2.TrySetResult(result));
asyncOperation2 = next2;
}
while (asyncOperation2 != next);
}
}
internal static void FailOperations<T, TInner>(Deque<T> operations, Exception error) where T : AsyncOperation<TInner>
{
while (!operations.IsEmpty)
{
operations.DequeueHead().TrySetException(error);
}
}
internal static Exception CreateInvalidCompletionException(Exception inner = null)
{
if (!(inner is OperationCanceledException))
{
if (inner == null || inner == s_doneWritingSentinel)
{
return new ChannelClosedException();
}
return new ChannelClosedException(inner);
}
return inner;
}
}
public abstract class ChannelWriter<T>
{
public virtual bool TryComplete(Exception? error = null)
{
return false;
}
public abstract bool TryWrite(T item);
public abstract ValueTask<bool> WaitToWriteAsync(CancellationToken cancellationToken = default(CancellationToken));
public virtual ValueTask WriteAsync(T item, CancellationToken cancellationToken = default(CancellationToken))
{
try
{
return cancellationToken.IsCancellationRequested ? new ValueTask(Task.FromCanceled<T>(cancellationToken)) : (TryWrite(item) ? default(ValueTask) : WriteAsyncCore(item, cancellationToken));
}
catch (Exception exception)
{
return new ValueTask(Task.FromException(exception));
}
}
private async ValueTask WriteAsyncCore(T innerItem, CancellationToken ct)
{
while (await WaitToWriteAsync(ct).ConfigureAwait(continueOnCapturedContext: false))
{
if (TryWrite(innerItem))
{
return;
}
}
throw ChannelUtilities.CreateInvalidCompletionException();
}
public void Complete(Exception? error = null)
{
if (!TryComplete(error))
{
throw ChannelUtilities.CreateInvalidCompletionException();
}
}
}
public abstract class Channel<T> : Channel<T, T>
{
}
public abstract class Channel<TWrite, TRead>
{
public ChannelReader<TRead> Reader { get; protected set; }
public ChannelWriter<TWrite> Writer { get; protected set; }
public static implicit operator ChannelReader<TRead>(Channel<TWrite, TRead> channel)
{
return channel.Reader;
}
public static implicit operator ChannelWriter<TWrite>(Channel<TWrite, TRead> channel)
{
return channel.Writer;
}
}
internal interface IDebugEnumerable<T>
{
IEnumerator<T> GetEnumerator();
}
internal sealed class DebugEnumeratorDebugView<T>
{
[DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
public T[] Items { get; }
public DebugEnumeratorDebugView(IDebugEnumerable<T> enumerable)
{
List<T> list = new List<T>();
foreach (T item in enumerable)
{
list.Add(item);
}
Items = list.ToArray();
}
}
[DebuggerDisplay("Items = {ItemsCountForDebugger}, Closed = {ChannelIsClosedForDebugger}")]
[DebuggerTypeProxy(typeof(DebugEnumeratorDebugView<>))]
internal sealed class SingleConsumerUnboundedChannel<T> : Channel<T>, IDebugEnumerable<T>
{
[DebuggerDisplay("Items = {ItemsCountForDebugger}")]
[DebuggerTypeProxy(typeof(DebugEnumeratorDebugView<>))]
private sealed class UnboundedChannelReader : ChannelReader<T>, IDebugEnumerable<T>
{
internal readonly SingleConsumerUnboundedChannel<T> _parent;
private readonly AsyncOperation<T> _readerSingleton;
private readonly AsyncOperation<bool> _waiterSingleton;
public override Task Completion => _parent._completion.Task;
public override bool CanPeek => true;
private int ItemsCountForDebugger => _parent._items.Count;
internal UnboundedChannelReader(SingleConsumerUnboundedChannel<T> parent)
{
_parent = parent;
_readerSingleton = new AsyncOperation<T>(parent._runContinuationsAsynchronously, default(CancellationToken), pooled: true);
_waiterSingleton = new AsyncOperation<bool>(parent._runContinuationsAsynchronously, default(CancellationToken), pooled: true);
}
public override ValueTask<T> ReadAsync(CancellationToken cancellationToken)
{
if (cancellationToken.IsCancellationRequested)
{
return new ValueTask<T>(Task.FromCanceled<T>(cancellationToken));
}
if (TryRead(out var item))
{
return new ValueTask<T>(item);
}
SingleConsumerUnboundedChannel<T> parent = _parent;
AsyncOperation<T> asyncOperation;
AsyncOperation<T> asyncOperation2;
lock (parent.SyncObj)
{
if (TryRead(out item))
{
return new ValueTask<T>(item);
}
if (parent._doneWriting != null)
{
return ChannelUtilities.GetInvalidCompletionValueTask<T>(parent._doneWriting);
}
asyncOperation = parent._blockedReader;
if (!cancellationToken.CanBeCanceled && _readerSingleton.TryOwnAndReset())
{
asyncOperation2 = _readerSingleton;
if (asyncOperation2 == asyncOperation)
{
asyncOperation = null;
}
}
else
{
asyncOperation2 = new AsyncOperation<T>(_parent._runContinuationsAsynchronously, cancellationToken);
}
parent._blockedReader = asyncOperation2;
}
asyncOperation?.TrySetCanceled();
return asyncOperation2.ValueTaskOfT;
}
public override bool TryRead([MaybeNullWhen(false)] out T item)
{
SingleConsumerUnboundedChannel<T> parent = _parent;
if (parent._items.TryDequeue(out item))
{
if (parent._doneWriting != null && parent._items.IsEmpty)
{
ChannelUtilities.Complete(parent._completion, parent._doneWriting);
}
return true;
}
return false;
}
public override bool TryPeek([MaybeNullWhen(false)] out T item)
{
return _parent._items.TryPeek(out item);
}
public override ValueTask<bool> WaitToReadAsync(CancellationToken cancellationToken)
{
if (cancellationToken.IsCancellationRequested)
{
return new ValueTask<bool>(Task.FromCanceled<bool>(cancellationToken));
}
if (!_parent._items.IsEmpty)
{
return new ValueTask<bool>(result: true);
}
SingleConsumerUnboundedChannel<T> parent = _parent;
AsyncOperation<bool> asyncOperation = null;
AsyncOperation<bool> asyncOperation2;
lock (parent.SyncObj)
{
if (!parent._items.IsEmpty)
{
return new ValueTask<bool>(result: true);
}
if (parent._doneWriting != null)
{
return (parent._doneWriting != ChannelUtilities.s_doneWritingSentinel) ? new ValueTask<bool>(Task.FromException<bool>(parent._doneWriting)) : default(ValueTask<bool>);
}
asyncOperation = parent._waitingReader;
if (!cancellationToken.CanBeCanceled && _waiterSingleton.TryOwnAndReset())
{
asyncOperation2 = _waiterSingleton;
if (asyncOperation2 == asyncOperation)
{
asyncOperation = null;
}
}
else
{
asyncOperation2 = new AsyncOperation<bool>(_parent._runContinuationsAsynchronously, cancellationToken);
}
parent._waitingReader = asyncOperation2;
}
asyncOperation?.TrySetCanceled();
return asyncOperation2.ValueTaskOfT;
}
IEnumerator<T> IDebugEnumerable<T>.GetEnumerator()
{
return _parent._items.GetEnumerator();
}
}
[DebuggerDisplay("Items = {ItemsCountForDebugger}")]
[DebuggerTypeProxy(typeof(DebugEnumeratorDebugView<>))]
private sealed class UnboundedChannelWriter : ChannelWriter<T>, IDebugEnumerable<T>
{
internal readonly SingleConsumerUnboundedChannel<T> _parent;
private int ItemsCountForDebugger => _parent._items.Count;
internal UnboundedChannelWriter(SingleConsumerUnboundedChannel<T> parent)
{
_parent = parent;
}
public override bool TryComplete(Exception error)
{
AsyncOperation<T> asyncOperation = null;
AsyncOperation<bool> asyncOperation2 = null;
bool flag = false;
SingleConsumerUnboundedChannel<T> parent = _parent;
lock (parent.SyncObj)
{
if (parent._doneWriting != null)
{
return false;
}
parent._doneWriting = error ?? ChannelUtilities.s_doneWritingSentinel;
if (parent._items.IsEmpty)
{
flag = true;
if (parent._blockedReader != null)
{
asyncOperation = parent._blockedReader;
parent._blockedReader = null;
}
if (parent._waitingReader != null)
{
asyncOperation2 = parent._waitingReader;
parent._waitingReader = null;
}
}
}
if (flag)
{
ChannelUtilities.Complete(parent._completion, error);
}
if (asyncOperation != null)
{
error = ChannelUtilities.CreateInvalidCompletionException(error);
asyncOperation.TrySetException(error);
}
if (asyncOperation2 != null)
{
if (error != null)
{
asyncOperation2.TrySetException(error);
}
else
{
asyncOperation2.TrySetResult(item: false);
}
}
return true;
}
public override bool TryWrite(T item)
{
SingleConsumerUnboundedChannel<T> parent = _parent;
AsyncOperation<T> asyncOperation;
do
{
asyncOperation = null;
AsyncOperation<bool> asyncOperation2 = null;
lock (parent.SyncObj)
{
if (parent._doneWriting != null)
{
return false;
}
asyncOperation = parent._blockedReader;
if (asyncOperation != null)
{
parent._blockedReader = null;
}
else
{
parent._items.Enqueue(item);
asyncOperation2 = parent._waitingReader;
if (asyncOperation2 == null)
{
return true;
}
parent._waitingReader = null;
}
}
if (asyncOperation2 != null)
{
asyncOperation2.TrySetResult(item: true);
return true;
}
}
while (!asyncOperation.TrySetResult(item));
return true;
}
public override ValueTask<bool> WaitToWriteAsync(CancellationToken cancellationToken)
{
Exception doneWriting = _parent._doneWriting;
if (!cancellationToken.IsCancellationRequested)
{
if (doneWriting != null)
{
if (doneWriting == ChannelUtilities.s_doneWritingSentinel)
{
return default(ValueTask<bool>);
}
return new ValueTask<bool>(Task.FromException<bool>(doneWriting));
}
return new ValueTask<bool>(result: true);
}
return new ValueTask<bool>(Task.FromCanceled<bool>(cancellationToken));
}
public override ValueTask WriteAsync(T item, CancellationToken cancellationToken)
{
if (!cancellationToken.IsCancellationRequested)
{
if (!TryWrite(item))
{
return new ValueTask(Task.FromException(ChannelUtilities.CreateInvalidCompletionException(_parent._doneWriting)));
}
return default(ValueTask);
}
return new ValueTask(Task.FromCanceled(cancellationToken));
}
IEnumerator<T> IDebugEnumerable<T>.GetEnumerator()
{
return _parent._items.GetEnumerator();
}
}
private readonly TaskCompletionSource _completion;
private readonly SingleProducerSingleConsumerQueue<T> _items = new SingleProducerSingleConsumerQueue<T>();
private readonly bool _runContinuationsAsynchronously;
private volatile Exception _doneWriting;
private AsyncOperation<T> _blockedReader;
private AsyncOperation<bool> _waitingReader;
private object SyncObj => _items;
private int ItemsCountForDebugger => _items.Count;
private bool ChannelIsClosedForDebugger => _doneWriting != null;
internal SingleConsumerUnboundedChannel(bool runContinuationsAsynchronously)
{
_runContinuationsAsynchronously = runContinuationsAsynchronously;
_completion = new TaskCompletionSource(runContinuationsAsynchronously ? TaskCreationOptions.RunContinuationsAsynchronously : TaskCreationOptions.None);
base.Reader = new UnboundedChannelReader(this);
base.Writer = new UnboundedChannelWriter(this);
}
IEnumerator<T> IDebugEnumerable<T>.GetEnumerator()
{
return _items.GetEnumerator();
}
}
internal sealed class TaskCompletionSource : TaskCompletionSource<VoidResult>
{
public TaskCompletionSource(TaskCreationOptions creationOptions)
: base(creationOptions)
{
}
public bool TrySetResult()
{
return TrySetResult(default(VoidResult));
}
}
[DebuggerDisplay("Items = {ItemsCountForDebugger}, Closed = {ChannelIsClosedForDebugger}")]
[DebuggerTypeProxy(typeof(DebugEnumeratorDebugView<>))]
internal sealed class UnboundedChannel<T> : Channel<T>, IDebugEnumerable<T>
{
[DebuggerDisplay("Items = {Count}")]
[DebuggerTypeProxy(typeof(DebugEnumeratorDebugView<>))]
private sealed class UnboundedChannelReader : ChannelReader<T>, IDebugEnumerable<T>
{
internal readonly UnboundedChannel<T> _parent;
private readonly AsyncOperation<T> _readerSingleton;
private readonly AsyncOperation<bool> _waiterSingleton;
public override Task Completion => _parent._completion.Task;
public override bool CanCount => true;
public override bool CanPeek => true;
public override int Count => _parent._items.Count;
internal UnboundedChannelReader(UnboundedChannel<T> parent)
{
_parent = parent;
_readerSingleton = new AsyncOperation<T>(parent._runContinuationsAsynchronously, default(CancellationToken), pooled: true);
_waiterSingleton = new AsyncOperation<bool>(parent._runContinuationsAsynchronously, default(CancellationToken), pooled: true);
}
public override ValueTask<T> ReadAsync(CancellationToken cancellationToken)
{
if (cancellationToken.IsCancellationRequested)
{
return new ValueTask<T>(Task.FromCanceled<T>(cancellationToken));
}
UnboundedChannel<T> parent = _parent;
if (parent._items.TryDequeue(out var result))
{
CompleteIfDone(parent);
return new ValueTask<T>(result);
}
lock (parent.SyncObj)
{
if (parent._items.TryDequeue(out result))
{
CompleteIfDone(parent);
return new ValueTask<T>(result);
}
if (parent._doneWriting != null)
{
return ChannelUtilities.GetInvalidCompletionValueTask<T>(parent._doneWriting);
}
if (!cancellationToken.CanBeCanceled)
{
AsyncOperation<T> readerSingleton = _readerSingleton;
if (readerSingleton.TryOwnAndReset())
{
parent._blockedReaders.EnqueueTail(readerSingleton);
return readerSingleton.ValueTaskOfT;
}
}
AsyncOperation<T> asyncOperation = new AsyncOperation<T>(parent._runContinuationsAsynchronously, cancellationToken);
parent._blockedReaders.EnqueueTail(asyncOperation);
return asyncOperation.ValueTaskOfT;
}
}
public override bool TryRead([MaybeNullWhen(false)] out T item)
{
UnboundedChannel<T> parent = _parent;
if (parent._items.TryDequeue(out item))
{
CompleteIfDone(parent);
return true;
}
item = default(T);
return false;
}
public override bool TryPeek([MaybeNullWhen(false)] out T item)
{
return _parent._items.TryPeek(out item);
}
private static void CompleteIfDone(UnboundedChannel<T> parent)
{
if (parent._doneWriting != null && parent._items.IsEmpty)
{
ChannelUtilities.Complete(parent._completion, parent._doneWriting);
}
}
public override ValueTask<bool> WaitToReadAsync(CancellationToken cancellationToken)
{
if (cancellationToken.IsCancellationRequested)
{
return new ValueTask<bool>(Task.FromCanceled<bool>(cancellationToken));
}
if (!_parent._items.IsEmpty)
{
return new ValueTask<bool>(result: true);
}
UnboundedChannel<T> parent = _parent;
lock (parent.SyncObj)
{
if (!parent._items.IsEmpty)
{
return new ValueTask<bool>(result: true);
}
if (parent._doneWriting != null)
{
return (parent._doneWriting != ChannelUtilities.s_doneWritingSentinel) ? new ValueTask<bool>(Task.FromException<bool>(parent._doneWriting)) : default(ValueTask<bool>);
}
if (!cancellationToken.CanBeCanceled)
{
AsyncOperation<bool> waiterSingleton = _waiterSingleton;
if (waiterSingleton.TryOwnAndReset())
{
ChannelUtilities.QueueWaiter(ref parent._waitingReadersTail, waiterSingleton);
return waiterSingleton.ValueTaskOfT;
}
}
AsyncOperation<bool> asyncOperation = new AsyncOperation<bool>(parent._runContinuationsAsynchronously, cancellationToken);
ChannelUtilities.QueueWaiter(ref parent._waitingReadersTail, asyncOperation);
return asyncOperation.ValueTaskOfT;
}
}
IEnumerator<T> IDebugEnumerable<T>.GetEnumerator()
{
return _parent._items.GetEnumerator();
}
}
[DebuggerDisplay("Items = {ItemsCountForDebugger}")]
[DebuggerTypeProxy(typeof(DebugEnumeratorDebugView<>))]
private sealed class UnboundedChannelWriter : ChannelWriter<T>, IDebugEnumerable<T>
{
internal readonly UnboundedChannel<T> _parent;
private int ItemsCountForDebugger => _parent._items.Count;
internal UnboundedChannelWriter(UnboundedChannel<T> parent)
{
_parent = parent;
}
public override bool TryComplete(Exception error)
{
UnboundedChannel<T> parent = _parent;
bool isEmpty;
lock (parent.SyncObj)
{
if (parent._doneWriting != null)
{
return false;
}
parent._doneWriting = error ?? ChannelUtilities.s_doneWritingSentinel;
isEmpty = parent._items.IsEmpty;
}
if (isEmpty)
{
ChannelUtilities.Complete(parent._completion, error);
}
ChannelUtilities.FailOperations<AsyncOperation<T>, T>(parent._blockedReaders, ChannelUtilities.CreateInvalidCompletionException(error));
ChannelUtilities.WakeUpWaiters(ref parent._waitingReadersTail, result: false, error);
return true;
}
public override bool TryWrite(T item)
{
UnboundedChannel<T> parent = _parent;
AsyncOperation<bool> listTail;
while (true)
{
AsyncOperation<T> asyncOperation = null;
listTail = null;
lock (parent.SyncObj)
{
if (parent._doneWriting != null)
{
return false;
}
if (parent._blockedReaders.IsEmpty)
{
parent._items.Enqueue(item);
listTail = parent._waitingReadersTail;
if (listTail == null)
{
return true;
}
parent._waitingReadersTail = null;
}
else
{
asyncOperation = parent._blockedReaders.DequeueHead();
}
}
if (asyncOperation == null)
{
break;
}
if (asyncOperation.TrySetResult(item))
{
return true;
}
}
ChannelUtilities.WakeUpWaiters(ref listTail, result: true);
return true;
}
public override ValueTask<bool> WaitToWriteAsync(CancellationToken cancellationToken)
{
Exception doneWriting = _parent._doneWriting;
if (!cancellationToken.IsCancellationRequested)
{
if (doneWriting != null)
{
if (doneWriting == ChannelUtilities.s_doneWritingSentinel)
{
return default(ValueTask<bool>);
}
return new ValueTask<bool>(Task.FromException<bool>(doneWriting));
}
return new ValueTask<bool>(result: true);
}
return new ValueTask<bool>(Task.FromCanceled<bool>(cancellationToken));
}
public override ValueTask WriteAsync(T item, CancellationToken cancellationToken)
{
if (!cancellationToken.IsCancellationRequested)
{
if (!TryWrite(item))
{
return new ValueTask(Task.FromException(ChannelUtilities.CreateInvalidCompletionException(_parent._doneWriting)));
}
return default(ValueTask);
}
return new ValueTask(Task.FromCanceled(cancellationToken));
}
IEnumerator<T> IDebugEnumerable<T>.GetEnumerator()
{
return _parent._items.GetEnumerator();
}
}
private readonly TaskCompletionSource _completion;
private readonly ConcurrentQueue<T> _items = new ConcurrentQueue<T>();
private readonly Deque<AsyncOperation<T>> _blockedReaders = new Deque<AsyncOperation<T>>();
private readonly bool _runContinuationsAsynchronously;
private AsyncOperation<bool> _waitingReadersTail;
private Exception _doneWriting;
private object SyncObj => _items;
private int ItemsCountForDebugger => _items.Count;
private bool ChannelIsClosedForDebugger => _doneWriting != null;
internal UnboundedChannel(bool runContinuationsAsynchronously)
{
_runContinuationsAsynchronously = runContinuationsAsynchronously;
_completion = new TaskCompletionSource(runContinuationsAsynchronously ? TaskCreationOptions.RunContinuationsAsynchronously : TaskCreationOptions.None);
base.Reader = new UnboundedChannelReader(this);
base.Writer = new UnboundedChannelWriter(this);
}
[Conditional("DEBUG")]
private void AssertInvariants()
{
if (!_items.IsEmpty)
{
_ = _runContinuationsAsynchronously;
}
if (!_blockedReaders.IsEmpty || _waitingReadersTail != null)
{
_ = _runContinuationsAsynchronously;
}
_ = _completion.Task.IsCompleted;
}
IEnumerator<T> IDebugEnumerable<T>.GetEnumerator()
{
return _items.GetEnumerator();
}
}
}using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Net;
using System.Numerics;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.ExceptionServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Runtime.Versioning;
using System.Security;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using <StartupCode$FSharp-Core>;
using Microsoft.FSharp.Collections;
using Microsoft.FSharp.Control;
using Microsoft.FSharp.Core;
using Microsoft.FSharp.Core.CompilerServices;
using Microsoft.FSharp.Linq;
using Microsoft.FSharp.Linq.RuntimeHelpers;
using Microsoft.FSharp.Primitives.Basics;
using Microsoft.FSharp.Quotations;
using Microsoft.FSharp.Reflection;
using Microsoft.FSharp.Text.StructuredPrintfImpl;
[assembly: FSharpInterfaceDataVersion(2, 0, 0)]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyFileVersion("9.1.24.52202")]
[assembly: AssemblyInformationalVersion("9.0.100-beta.24522.2+f07a91420bec3f657153e16c9f047cf151c1179f")]
[assembly: AssemblyProduct("FSharp.Core")]
[assembly: AssemblyTitle("FSharp.Core")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/dotnet/fsharp")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: ComVisible(false)]
[assembly: CLSCompliant(true)]
[assembly: SecurityTransparent]
[assembly: AutoOpen("Microsoft.FSharp")]
[assembly: AutoOpen("Microsoft.FSharp.Core.LanguagePrimitives.IntrinsicOperators")]
[assembly: AutoOpen("Microsoft.FSharp.Core")]
[assembly: AutoOpen("Microsoft.FSharp.Collections")]
[assembly: AutoOpen("Microsoft.FSharp.Control")]
[assembly: AutoOpen("Microsoft.FSharp.Control.TaskBuilderExtensions.LowPriority")]
[assembly: AutoOpen("Microsoft.FSharp.Control.TaskBuilderExtensions.MediumPriority")]
[assembly: AutoOpen("Microsoft.FSharp.Control.TaskBuilderExtensions.HighPriority")]
[assembly: AutoOpen("Microsoft.FSharp.Linq.QueryRunExtensions.LowPriority")]
[assembly: AutoOpen("Microsoft.FSharp.Linq.QueryRunExtensions.HighPriority")]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyVersion("9.0.0.0")]
[assembly: TypeForwardedTo(typeof(AggregateException))]
[assembly: TypeForwardedTo(typeof(IStructuralComparable))]
[assembly: TypeForwardedTo(typeof(IStructuralEquatable))]
[assembly: TypeForwardedTo(typeof(IObservable<>))]
[assembly: TypeForwardedTo(typeof(IObserver<>))]
[assembly: TypeForwardedTo(typeof(Lazy<>))]
[assembly: TypeForwardedTo(typeof(BigInteger))]
[assembly: TypeForwardedTo(typeof(CancellationToken))]
[assembly: TypeForwardedTo(typeof(CancellationTokenRegistration))]
[assembly: TypeForwardedTo(typeof(CancellationTokenSource))]
[assembly: TypeForwardedTo(typeof(Tuple))]
[assembly: TypeForwardedTo(typeof(Tuple<>))]
[assembly: TypeForwardedTo(typeof(Tuple<, >))]
[assembly: TypeForwardedTo(typeof(Tuple<, , >))]
[assembly: TypeForwardedTo(typeof(Tuple<, , , >))]
[assembly: TypeForwardedTo(typeof(Tuple<, , , , >))]
[assembly: TypeForwardedTo(typeof(Tuple<, , , , , >))]
[assembly: TypeForwardedTo(typeof(Tuple<, , , , , , >))]
[assembly: TypeForwardedTo(typeof(Tuple<, , , , , , , >))]
namespace Microsoft.FSharp.Core
{
[Serializable]
[CompilationMapping(SourceConstructFlags.ObjectType)]
public sealed class Unit : IComparable
{
internal Unit()
{
}
public override int GetHashCode()
{
return 0;
}
public override bool Equals(object obj)
{
if (obj != null)
{
if (LanguagePrimitives.IntrinsicFunctions.TypeTestGeneric<Unit>(obj))
{
return true;
}
return false;
}
return true;
}
virtual int IComparable.CompareTo(object _obj)
{
return 0;
}
}
[Serializable]
[CompilationMapping(SourceConstructFlags.ObjectType)]
public enum SourceConstructFlags
{
None = 0,
SumType = 1,
RecordType = 2,
ObjectType = 3,
Field = 4,
Exception = 5,
Closure = 6,
Module = 7,
UnionCase = 8,
Value = 9,
KindMask = 31,
NonPublicRepresentation = 32
}
[Serializable]
[Flags]
[CompilationMapping(SourceConstructFlags.ObjectType)]
public enum CompilationRepresentationFlags
{
None = 0,
Static = 1,
Instance = 2,
ModuleSuffix = 4,
UseNullAsTrueValue = 8,
Event = 0x10
}
[Serializable]
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
[CompilationMapping(SourceConstructFlags.ObjectType)]
public sealed class SealedAttribute : Attribute
{
internal bool value;
public bool Value => value;
public SealedAttribute(bool value)
{
this.value = value;
}
public SealedAttribute()
: this(value: true)
{
}
}
[Serializable]
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
[Sealed]
[CompilationMapping(SourceConstructFlags.ObjectType)]
public sealed class AbstractClassAttribute : Attribute
{
}
[Serializable]
[AttributeUsage(AttributeTargets.GenericParameter, AllowMultiple = false)]
[Sealed]
[CompilationMapping(SourceConstructFlags.ObjectType)]
public sealed class EqualityConditionalOnAttribute : Attribute
{
}
[Serializable]
[AttributeUsage(AttributeTargets.GenericParameter, AllowMultiple = false)]
[Sealed]
[CompilationMapping(SourceConstructFlags.ObjectType)]
public sealed class ComparisonConditionalOnAttribute : Attribute
{
}
[Serializable]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = false)]
[Sealed]
[CompilationMapping(SourceConstructFlags.ObjectType)]
public sealed class AllowNullLiteralAttribute : Attribute
{
internal bool value;
public bool Value => value;
public AllowNullLiteralAttribute(bool value)
{
this.value = value;
}
public AllowNullLiteralAttribute()
: this(value: true)
{
}
}
[Serializable]
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false)]
[Sealed]
[CompilationMapping(SourceConstructFlags.ObjectType)]
public sealed class VolatileFieldAttribute : Attribute
{
}
[Serializable]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false)]
[Sealed]
[CompilationMapping(SourceConstructFlags.ObjectType)]
public sealed class DefaultAugmentationAttribute : Attribute
{
internal bool value;
public bool Value => value;
public DefaultAugmentationAttribute(bool value)
{
this.value = value;
}
}
[Serializable]
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
[Sealed]
[CompilationMapping(SourceConstructFlags.ObjectType)]
public sealed class CLIEventAttribute : Attribute
{
}
[Serializable]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false)]
[Sealed]
[CompilationMapping(SourceConstructFlags.ObjectType)]
public sealed class CLIMutableAttribute : Attribute
{
}
[Serializable]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false)]
[Sealed]
[CompilationMapping(SourceConstructFlags.ObjectType)]
public sealed class AutoSerializableAttribute : Attribute
{
internal bool value;
public bool Value => value;
public AutoSerializableAttribute(bool value)
{
this.value = value;
}
}
[Serializable]
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Field, AllowMultiple = false)]
[Sealed]
[CompilationMapping(SourceConstructFlags.ObjectType)]
public sealed class DefaultValueAttribute : Attribute
{
internal bool check;
public bool Check => check;
public DefaultValueAttribute(bool check)
{
this.check = check;
}
public DefaultValueAttribute()
: this(check: true)
{
}
}
[Serializable]
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
[Sealed]
[CompilationMapping(SourceConstructFlags.ObjectType)]
public sealed class EntryPointAttribute : Attribute
{
}
[Serializable]
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
[Sealed]
[CompilationMapping(SourceConstructFlags.ObjectType)]
public sealed class ReferenceEqualityAttribute : Attribute
{
}
[Serializable]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false)]
[Sealed]
[CompilationMapping(SourceConstructFlags.ObjectType)]
public sealed class StructuralComparisonAttribute : Attribute
{
}
[Serializable]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false)]
[Sealed]
[CompilationMapping(SourceConstructFlags.ObjectType)]
public sealed class StructuralEqualityAttribute : Attribute
{
}
[Serializable]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false)]
[Sealed]
[CompilationMapping(SourceConstructFlags.ObjectType)]
public sealed class NoEqualityAttribute : Attribute
{
}
[Serializable]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false)]
[Sealed]
[CompilationMapping(SourceConstructFlags.ObjectType)]
public sealed class CustomEqualityAttribute : Attribute
{
}
[Serializable]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false)]
[Sealed]
[CompilationMapping(SourceConstructFlags.ObjectType)]
public sealed class CustomComparisonAttribute : Attribute
{
}
[Serializable]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false)]
[Sealed]
[CompilationMapping(SourceConstructFlags.ObjectType)]
public sealed class NoComparisonAttribute : Attribute
{
}
[Serializable]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.Delegate, AllowMultiple = false)]
[Sealed]
[CompilationMapping(SourceConstructFlags.ObjectType)]
public sealed class ReflectedDefinitionAttribute : Attribute
{
internal bool includeValue;
public bool IncludeValue => includeValue;
public ReflectedDefinitionAttribute(bool includeValue)
{
this.includeValue = includeValue;
}
public ReflectedDefinitionAttribute()
: this(includeValue: false)
{
}
}
[Serializable]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false)]
[Sealed]
[CompilationMapping(SourceConstructFlags.ObjectType)]
public sealed class CompiledNameAttribute : Attribute
{
internal string compiledName;
public string CompiledName => compiledName;
public CompiledNameAttribute(string compiledName)
{
this.compiledName = compiledName;
}
}
[Serializable]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.ReturnValue, AllowMultiple = false)]
[Sealed]
[CompilationMapping(SourceConstructFlags.ObjectType)]
public sealed class StructAttribute : Attribute
{
}
[Serializable]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.GenericParameter, AllowMultiple = false)]
[Sealed]
[CompilationMapping(SourceConstructFlags.ObjectType)]
public sealed class MeasureAttribute : Attribute
{
}
[Serializable]
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
[Sealed]
[CompilationMapping(SourceConstructFlags.ObjectType)]
public sealed class MeasureAnnotatedAbbreviationAttribute : Attribute
{
}
[Serializable]
[AttributeUsage(AttributeTargets.Interface, AllowMultiple = false)]
[Sealed]
[CompilationMapping(SourceConstructFlags.ObjectType)]
public sealed class InterfaceAttribute : Attribute
{
}
[Serializable]
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
[Sealed]
[CompilationMapping(SourceConstructFlags.ObjectType)]
public sealed class ClassAttribute : Attribute
{
}
[Serializable]
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false)]
[Sealed]
[CompilationMapping(SourceConstructFlags.ObjectType)]
public sealed class LiteralAttribute : Attribute
{
}
[Serializable]
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)]
[Sealed]
[CompilationMapping(SourceConstructFlags.ObjectType)]
public sealed class FSharpInterfaceDataVersionAttribute : Attribute
{
internal int release;
internal int minor;
internal int major;
public int Major => major;
public int Minor => minor;
public int Release => release;
public FSharpInterfaceDataVersionAttribute(int major, int minor, int release)
{
this.major = major;
this.minor = minor;
this.release = release;
}
}
[Serializable]
[AttributeUsage(AttributeTargets.All, AllowMultiple = false)]
[Sealed]
[CompilationMapping(SourceConstructFlags.ObjectType)]
public sealed class CompilationMappingAttribute : Attribute
{
internal int variantNumber;
internal Type[] typeDefinitions;
internal SourceConstructFlags sourceConstructFlags;
internal int sequenceNumber;
internal string resourceName;
public SourceConstructFlags SourceConstructFlags => sourceConstructFlags;
public int SequenceNumber => sequenceNumber;
public int VariantNumber => variantNumber;
public Type[] TypeDefinitions => typeDefinitions;
public string ResourceName => resourceName;
internal CompilationMappingAttribute(SourceConstructFlags sourceConstructFlags, int variantNumber, int sequenceNumber, string resourceName, Type[] typeDefinitions)
{
this.sourceConstructFlags = sourceConstructFlags;
this.variantNumber = variantNumber;
this.sequenceNumber = sequenceNumber;
this.resourceName = resourceName;
this.typeDefinitions = typeDefinitions;
}
public CompilationMappingAttribute(SourceConstructFlags sourceConstructFlags)
: this(sourceConstructFlags, 0, 0)
{
}
public CompilationMappingAttribute(SourceConstructFlags sourceConstructFlags, int sequenceNumber)
: this(sourceConstructFlags, 0, sequenceNumber)
{
}
public CompilationMappingAttribute(SourceConstructFlags sourceConstructFlags, int variantNumber, int sequenceNumber)
: this(sourceConstructFlags, variantNumber, sequenceNumber, null, null)
{
}
public CompilationMappingAttribute(string resourceName, Type[] typeDefinitions)
: this(SourceConstructFlags.None, 0, 0, resourceName, typeDefinitions)
{
}
}
[Serializable]
[AttributeUsage(AttributeTargets.All, AllowMultiple = false)]
[Sealed]
[CompilationMapping(SourceConstructFlags.ObjectType)]
public sealed class CompilationSourceNameAttribute : Attribute
{
internal string sourceName;
public string SourceName => sourceName;
public CompilationSourceNameAttribute(string sourceName)
{
this.sourceName = sourceName;
}
}
[Serializable]
[AttributeUsage(AttributeTargets.All, AllowMultiple = false)]
[Sealed]
[CompilationMapping(SourceConstructFlags.ObjectType)]
public sealed class CompilationRepresentationAttribute : Attribute
{
internal CompilationRepresentationFlags flags;
public CompilationRepresentationFlags Flags => flags;
public CompilationRepresentationAttribute(CompilationRepresentationFlags flags)
{
this.flags = flags;
}
}
[Serializable]
[AttributeUsage(AttributeTargets.All, AllowMultiple = false)]
[Sealed]
[CompilationMapping(SourceConstructFlags.ObjectType)]
public sealed class ExperimentalAttribute : Attribute
{
internal string message;
public string Message => message;
public ExperimentalAttribute(string message)
{
this.message = message;
}
}
[Serializable]
[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false)]
[Sealed]
[CompilationMapping(SourceConstructFlags.ObjectType)]
public sealed class InlineIfLambdaAttribute : Attribute
{
}
[Serializable]
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
[Sealed]
[CompilationMapping(SourceConstructFlags.ObjectType)]
public sealed class CompilationArgumentCountsAttribute : Attribute
{
internal int[] counts;
public IEnumerable<int> Counts => (IEnumerable<int>)counts.Clone();
public CompilationArgumentCountsAttribute(int[] counts)
{
this.counts = counts;
}
}
[Serializable]
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
[Sealed]
[CompilationMapping(SourceConstructFlags.ObjectType)]
public sealed class CustomOperationAttribute : Attribute
{
internal string name;
internal bool isBinary;
internal bool allowInto;
internal bool isJoin;
internal bool isGroupJoin;
internal bool maintainsVarSpace;
internal bool maintainsVarSpaceWithBind;
internal string joinOnWord;
public string Name => name;
public bool AllowIntoPattern
{
get
{
return allowInto;
}
set
{
allowInto = value;
}
}
public bool IsLikeZip
{
get
{
return isBinary;
}
set
{
isBinary = value;
}
}
public bool IsLikeJoin
{
get
{
return isJoin;
}
set
{
isJoin = value;
}
}
public bool IsLikeGroupJoin
{
get
{
return isGroupJoin;
}
set
{
isGroupJoin = value;
}
}
public string JoinConditionWord
{
get
{
return joinOnWord;
}
set
{
joinOnWord = value;
}
}
public bool MaintainsVariableSpace
{
get
{
return maintainsVarSpace;
}
set
{
maintainsVarSpace = value;
}
}
public bool MaintainsVariableSpaceUsingBind
{
get
{
return maintainsVarSpaceWithBind;
}
set
{
maintainsVarSpaceWithBind = value;
}
}
public CustomOperationAttribute(string name)
{
this.name = name;
isBinary = false;
allowInto = false;
isJoin = false;
isGroupJoin = false;
maintainsVarSpace = false;
maintainsVarSpaceWithBind = false;
joinOnWord = "";
}
public CustomOperationAttribute()
: this("")
{
}
}
[Serializable]
[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false)]
[Sealed]
[CompilationMapping(SourceConstructFlags.ObjectType)]
public sealed class ProjectionParameterAttribute : Attribute
{
}
[Serializable]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false)]
[Sealed]
[CompilationMapping(SourceConstructFlags.ObjectType)]
public sealed class StructuredFormatDisplayAttribute : Attribute
{
internal string value;
public string Value => value;
public StructuredFormatDisplayAttribute(string value)
{
this.value = value;
}
}
[Serializable]
[AttributeUsage(AttributeTargets.All, AllowMultiple = false)]
[Sealed]
[CompilationMapping(SourceConstructFlags.ObjectType)]
public sealed class CompilerMessageAttribute : Attribute
{
internal int messageNumber;
internal string message;
internal bool isError;
internal bool isHidden;
public string Message => message;
public int MessageNumber => messageNumber;
public bool IsError
{
get
{
return isError;
}
set
{
isError = value;
}
}
public bool IsHidden
{
get
{
return isHidden;
}
set
{
isHidden = value;
}
}
public CompilerMessageAttribute(string message, int messageNumber)
{
this.message = message;
this.messageNumber = messageNumber;
isError = false;
isHidden = false;
}
}
[Serializable]
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, AllowMultiple = false)]
[Sealed]
[CompilationMapping(SourceConstructFlags.ObjectType)]
public sealed class UnverifiableAttribute : Attribute
{
}
[Serializable]
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, AllowMultiple = false)]
[Sealed]
[CompilationMapping(SourceConstructFlags.ObjectType)]
public sealed class NoDynamicInvocationAttribute : Attribute
{
internal bool isLegacy;
internal bool IsLegacy => isLegacy;
internal NoDynamicInvocationAttribute(bool isLegacy)
{
this.isLegacy = isLegacy;
}
public NoDynamicInvocationAttribute()
: this(isLegacy: false)
{
}
}
[Serializable]
[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false)]
[Sealed]
[CompilationMapping(SourceConstructFlags.ObjectType)]
public sealed class OptionalArgumentAttribute : Attribute
{
}
[Serializable]
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
[Sealed]
[CompilationMapping(SourceConstructFlags.ObjectType)]
public sealed class GeneralizableValueAttribute : Attribute
{
}
[Serializable]
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
[Sealed]
[CompilationMapping(SourceConstructFlags.ObjectType)]
public sealed class RequiresExplicitTypeArgumentsAttribute : Attribute
{
}
[Serializable]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum, AllowMultiple = false)]
[Sealed]
[CompilationMapping(SourceConstructFlags.ObjectType)]
public sealed class RequireQualifiedAccessAttribute : Attribute
{
}
[Serializable]
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = true)]
[Sealed]
[CompilationMapping(SourceConstructFlags.ObjectType)]
public sealed class AutoOpenAttribute : Attribute
{
internal string path;
public string Path => path;
public AutoOpenAttribute(string path)
{
this.path = path;
}
public AutoOpenAttribute()
: this("")
{
}
}
[Serializable]
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
[Sealed]
[CompilationMapping(SourceConstructFlags.ObjectType)]
internal sealed class ValueAsStaticPropertyAttribute : Attribute
{
}
[Serializable]
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, AllowMultiple = false)]
[Sealed]
[CompilationMapping(SourceConstructFlags.ObjectType)]
public sealed class NoCompilerInliningAttribute : Attribute
{
}
[Serializable]
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
[Sealed]
[CompilationMapping(SourceConstructFlags.ObjectType)]
public sealed class WarnOnWithoutNullArgumentAttribute : Attribute
{
internal string warningMessage;
internal bool Localize@;
public string WarningMessage => warningMessage;
internal bool Localize
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return Localize@;
}
[CompilerGenerated]
[DebuggerNonUserCode]
set
{
Localize@ = value;
}
}
public WarnOnWithoutNullArgumentAttribute(string warningMessage)
{
this.warningMessage = warningMessage;
Localize@ = false;
}
}
[Serializable]
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
[Sealed]
[CompilationMapping(SourceConstructFlags.ObjectType)]
public sealed class TailCallAttribute : Attribute
{
}
}
namespace System.Diagnostics.CodeAnalysis
{
[Serializable]
[Flags]
[RequireQualifiedAccess]
[CompilationMapping(SourceConstructFlags.ObjectType)]
internal enum DynamicallyAccessedMemberTypes
{
None = 0,
PublicParameterlessConstructor = 1,
PublicConstructors = 3,
NonPublicConstructors = 4,
PublicMethods = 8,
NonPublicMethods = 0x10,
PublicFields = 0x20,
NonPublicFields = 0x40,
PublicNestedTypes = 0x80,
NonPublicNestedTypes = 0x100,
PublicProperties = 0x200,
NonPublicProperties = 0x400,
PublicEvents = 0x800,
NonPublicEvents = 0x1000,
Interfaces = 0x2000,
All = -1
}
[Serializable]
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, Inherited = false)]
[CompilationMapping(SourceConstructFlags.ObjectType)]
internal class DynamicallyAccessedMembersAttribute : Attribute
{
internal DynamicallyAccessedMemberTypes MemberTypes@;
internal DynamicallyAccessedMemberTypes MemberTypes
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return MemberTypes@;
}
[CompilerGenerated]
[DebuggerNonUserCode]
set
{
MemberTypes@ = value;
}
}
public DynamicallyAccessedMembersAttribute(DynamicallyAccessedMemberTypes memberTypes)
{
MemberTypes@ = memberTypes;
}
internal void DynamicallyAccessedMembersAttribute(DynamicallyAccessedMemberTypes memberTypes)
{
MemberTypes@ = memberTypes;
}
}
}
namespace Microsoft.FSharp.Core
{
[Serializable]
[StructLayout(LayoutKind.Auto, CharSet = CharSet.Auto)]
[StructuralEquality]
[StructuralComparison]
[CompiledName("FSharpChoice`2")]
[CompilationMapping(SourceConstructFlags.SumType)]
public abstract class FSharpChoice<T1, T2> : IEquatable<FSharpChoice<T1, T2>>, IStructuralEquatable, IComparable<FSharpChoice<T1, T2>>, IComparable, IStructuralComparable
{
public static class Tags
{
public const int Choice1Of2 = 0;
public const int Choice2Of2 = 1;
}
[Serializable]
[SpecialName]
[DebuggerTypeProxy(typeof(FSharpChoice<, >.Choice1Of2@DebugTypeProxy))]
public class Choice1Of2 : FSharpChoice<T1, T2>
{
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
[CompilerGenerated]
[DebuggerNonUserCode]
internal readonly T1 item;
[CompilationMapping(SourceConstructFlags.Field, 0, 0)]
[CompilerGenerated]
[DebuggerNonUserCode]
public T1 Item
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return item;
}
}
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(FSharpChoice<, >))]
[CompilerGenerated]
[DebuggerNonUserCode]
internal Choice1Of2(T1 item)
{
this.item = item;
}
}
[Serializable]
[SpecialName]
[DebuggerTypeProxy(typeof(FSharpChoice<, >.Choice2Of2@DebugTypeProxy))]
public class Choice2Of2 : FSharpChoice<T1, T2>
{
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
[CompilerGenerated]
[DebuggerNonUserCode]
internal readonly T2 item;
[CompilationMapping(SourceConstructFlags.Field, 1, 0)]
[CompilerGenerated]
[DebuggerNonUserCode]
public T2 Item
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return item;
}
}
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(FSharpChoice<, >))]
[CompilerGenerated]
[DebuggerNonUserCode]
internal Choice2Of2(T2 item)
{
this.item = item;
}
}
[SpecialName]
internal class Choice1Of2@DebugTypeProxy
{
[CompilationMapping(SourceConstructFlags.Field, 0, 0)]
[CompilerGenerated]
[DebuggerNonUserCode]
public T1 Item
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return _obj.item;
}
}
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(FSharpChoice<, >))]
[CompilerGenerated]
[DebuggerNonUserCode]
public Choice1Of2@DebugTypeProxy(Choice1Of2 obj)
{
_obj = obj;
}
}
[SpecialName]
internal class Choice2Of2@DebugTypeProxy
{
[CompilationMapping(SourceConstructFlags.Field, 1, 0)]
[CompilerGenerated]
[DebuggerNonUserCode]
public T2 Item
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return _obj.item;
}
}
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(FSharpChoice<, >))]
[CompilerGenerated]
[DebuggerNonUserCode]
public Choice2Of2@DebugTypeProxy(Choice2Of2 obj)
{
_obj = obj;
}
}
[CompilerGenerated]
[DebuggerNonUserCode]
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
public int Tag
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return (this is Choice2Of2) ? 1 : 0;
}
}
[CompilerGenerated]
[DebuggerNonUserCode]
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
public bool IsChoice1Of2
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return this is Choice1Of2;
}
}
[CompilerGenerated]
[DebuggerNonUserCode]
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
public bool IsChoice2Of2
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return this is Choice2Of2;
}
}
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicNestedTypes | DynamicallyAccessedMemberTypes.NonPublicNestedTypes | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(FSharpChoice<, >))]
[CompilerGenerated]
[DebuggerNonUserCode]
internal FSharpChoice()
{
}
[CompilationMapping(SourceConstructFlags.UnionCase, 0)]
public static FSharpChoice<T1, T2> NewChoice1Of2(T1 item)
{
return new Choice1Of2(item);
}
[CompilationMapping(SourceConstructFlags.UnionCase, 1)]
public static FSharpChoice<T1, T2> NewChoice2Of2(T2 item)
{
return new Choice2Of2(item);
}
[CompilerGenerated]
public virtual sealed int CompareTo(FSharpChoice<T1, T2> obj)
{
if (this != null)
{
if (obj != null)
{
int num = ((this is Choice2Of2) ? 1 : 0);
int num2 = ((obj is Choice2Of2) ? 1 : 0);
if (num == num2)
{
IComparer genericComparer;
if (this is Choice1Of2)
{
Choice1Of2 choice1Of = (Choice1Of2)this;
Choice1Of2 choice1Of2 = (Choice1Of2)obj;
genericComparer = LanguagePrimitives.GenericComparer;
T1 item = choice1Of.item;
T1 item2 = choice1Of2.item;
return LanguagePrimitives.HashCompare.GenericComparisonWithComparerIntrinsic(genericComparer, item, item2);
}
Choice2Of2 choice2Of = (Choice2Of2)this;
Choice2Of2 choice2Of2 = (Choice2Of2)obj;
genericComparer = LanguagePrimitives.GenericComparer;
T2 item3 = choice2Of.item;
T2 item4 = choice2Of2.item;
return LanguagePrimitives.HashCompare.GenericComparisonWithComparerIntrinsic(genericComparer, item3, item4);
}
return num - num2;
}
return 1;
}
if (obj != null)
{
return -1;
}
return 0;
}
[CompilerGenerated]
public virtual sealed int CompareTo(object obj)
{
return CompareTo((FSharpChoice<T1, T2>)obj);
}
[CompilerGenerated]
public virtual sealed int CompareTo(object obj, IComparer comp)
{
FSharpChoice<T1, T2> fSharpChoice = (FSharpChoice<T1, T2>)obj;
if (this != null)
{
if ((FSharpChoice<T1, T2>)obj != null)
{
int num = ((this is Choice2Of2) ? 1 : 0);
FSharpChoice<T1, T2> fSharpChoice2 = fSharpChoice;
int num2 = ((fSharpChoice2 is Choice2Of2) ? 1 : 0);
if (num == num2)
{
if (this is Choice1Of2)
{
Choice1Of2 choice1Of = (Choice1Of2)this;
Choice1Of2 choice1Of2 = (Choice1Of2)fSharpChoice;
T1 item = choice1Of.item;
T1 item2 = choice1Of2.item;
return LanguagePrimitives.HashCompare.GenericComparisonWithComparerIntrinsic(comp, item, item2);
}
Choice2Of2 choice2Of = (Choice2Of2)this;
Choice2Of2 choice2Of2 = (Choice2Of2)fSharpChoice;
T2 item3 = choice2Of.item;
T2 item4 = choice2Of2.item;
return LanguagePrimitives.HashCompare.GenericComparisonWithComparerIntrinsic(comp, item3, item4);
}
return num - num2;
}
return 1;
}
if ((FSharpChoice<T1, T2>)obj != null)
{
return -1;
}
return 0;
}
[CompilerGenerated]
public virtual sealed int GetHashCode(IEqualityComparer comp)
{
if (this != null)
{
int num = 0;
if (this is Choice1Of2)
{
Choice1Of2 choice1Of = (Choice1Of2)this;
num = 0;
T1 item = choice1Of.item;
return -1640531527 + (LanguagePrimitives.HashCompare.GenericHashWithComparerIntrinsic(comp, item) + ((num << 6) + (num >> 2)));
}
Choice2Of2 choice2Of = (Choice2Of2)this;
num = 1;
T2 item2 = choice2Of.item;
return -1640531527 + (LanguagePrimitives.HashCompare.GenericHashWithComparerIntrinsic(comp, item2) + ((num << 6) + (num >> 2)));
}
return 0;
}
[CompilerGenerated]
public sealed override int GetHashCode()
{
return GetHashCode(LanguagePrimitives.GenericEqualityComparer);
}
[CompilerGenerated]
public bool Equals(FSharpChoice<T1, T2> obj, IEqualityComparer comp)
{
if (this != null)
{
if (obj != null)
{
int num = ((this is Choice2Of2) ? 1 : 0);
int num2 = ((obj is Choice2Of2) ? 1 : 0);
if (num == num2)
{
if (this is Choice1Of2)
{
Choice1Of2 choice1Of = (Choice1Of2)this;
Choice1Of2 choice1Of2 = (Choice1Of2)obj;
T1 item = choice1Of.item;
T1 item2 = choice1Of2.item;
return LanguagePrimitives.HashCompare.GenericEqualityWithComparerIntrinsic(comp, item, item2);
}
Choice2Of2 choice2Of = (Choice2Of2)this;
Choice2Of2 choice2Of2 = (Choice2Of2)obj;
T2 item3 = choice2Of.item;
T2 item4 = choice2Of2.item;
return LanguagePrimitives.HashCompare.GenericEqualityWithComparerIntrinsic(comp, item3, item4);
}
return false;
}
return false;
}
return obj == null;
}
[CompilerGenerated]
public virtual sealed bool Equals(object obj, IEqualityComparer comp)
{
if (obj is FSharpChoice<T1, T2> obj2)
{
return Equals(obj2, comp);
}
return false;
}
[CompilerGenerated]
public virtual sealed bool Equals(FSharpChoice<T1, T2> obj)
{
if (this != null)
{
if (obj != null)
{
int num = ((this is Choice2Of2) ? 1 : 0);
int num2 = ((obj is Choice2Of2) ? 1 : 0);
if (num == num2)
{
if (this is Choice1Of2)
{
Choice1Of2 choice1Of = (Choice1Of2)this;
Choice1Of2 choice1Of2 = (Choice1Of2)obj;
T1 item = choice1Of.item;
T1 item2 = choice1Of2.item;
return LanguagePrimitives.HashCompare.GenericEqualityERIntrinsic(item, item2);
}
Choice2Of2 choice2Of = (Choice2Of2)this;
Choice2Of2 choice2Of2 = (Choice2Of2)obj;
T2 item3 = choice2Of.item;
T2 item4 = choice2Of2.item;
return LanguagePrimitives.HashCompare.GenericEqualityERIntrinsic(item3, item4);
}
return false;
}
return false;
}
return obj == null;
}
[CompilerGenerated]
public sealed override bool Equals(object obj)
{
if (obj is FSharpChoice<T1, T2> obj2)
{
return Equals(obj2);
}
return false;
}
}
[Serializable]
[StructLayout(LayoutKind.Auto, CharSet = CharSet.Auto)]
[StructuralEquality]
[StructuralComparison]
[CompiledName("FSharpChoice`3")]
[CompilationMapping(SourceConstructFlags.SumType)]
public abstract class FSharpChoice<T1, T2, T3> : IEquatable<FSharpChoice<T1, T2, T3>>, IStructuralEquatable, IComparable<FSharpChoice<T1, T2, T3>>, IComparable, IStructuralComparable
{
public static class Tags
{
public const int Choice1Of3 = 0;
public const int Choice2Of3 = 1;
public const int Choice3Of3 = 2;
}
[Serializable]
[SpecialName]
[DebuggerTypeProxy(typeof(FSharpChoice<, , >.Choice1Of3@DebugTypeProxy))]
public class Choice1Of3 : FSharpChoice<T1, T2, T3>
{
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
[CompilerGenerated]
[DebuggerNonUserCode]
internal readonly T1 item;
[CompilationMapping(SourceConstructFlags.Field, 0, 0)]
[CompilerGenerated]
[DebuggerNonUserCode]
public T1 Item
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return item;
}
}
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(FSharpChoice<, , >))]
[CompilerGenerated]
[DebuggerNonUserCode]
internal Choice1Of3(T1 item)
{
this.item = item;
}
}
[Serializable]
[SpecialName]
[DebuggerTypeProxy(typeof(FSharpChoice<, , >.Choice2Of3@DebugTypeProxy))]
public class Choice2Of3 : FSharpChoice<T1, T2, T3>
{
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
[CompilerGenerated]
[DebuggerNonUserCode]
internal readonly T2 item;
[CompilationMapping(SourceConstructFlags.Field, 1, 0)]
[CompilerGenerated]
[DebuggerNonUserCode]
public T2 Item
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return item;
}
}
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(FSharpChoice<, , >))]
[CompilerGenerated]
[DebuggerNonUserCode]
internal Choice2Of3(T2 item)
{
this.item = item;
}
}
[Serializable]
[SpecialName]
[DebuggerTypeProxy(typeof(FSharpChoice<, , >.Choice3Of3@DebugTypeProxy))]
public class Choice3Of3 : FSharpChoice<T1, T2, T3>
{
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
[CompilerGenerated]
[DebuggerNonUserCode]
internal readonly T3 item;
[CompilationMapping(SourceConstructFlags.Field, 2, 0)]
[CompilerGenerated]
[DebuggerNonUserCode]
public T3 Item
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return item;
}
}
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(FSharpChoice<, , >))]
[CompilerGenerated]
[DebuggerNonUserCode]
internal Choice3Of3(T3 item)
{
this.item = item;
}
}
[SpecialName]
internal class Choice1Of3@DebugTypeProxy
{
[CompilationMapping(SourceConstructFlags.Field, 0, 0)]
[CompilerGenerated]
[DebuggerNonUserCode]
public T1 Item
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return _obj.item;
}
}
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(FSharpChoice<, , >))]
[CompilerGenerated]
[DebuggerNonUserCode]
public Choice1Of3@DebugTypeProxy(Choice1Of3 obj)
{
_obj = obj;
}
}
[SpecialName]
internal class Choice2Of3@DebugTypeProxy
{
[CompilationMapping(SourceConstructFlags.Field, 1, 0)]
[CompilerGenerated]
[DebuggerNonUserCode]
public T2 Item
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return _obj.item;
}
}
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(FSharpChoice<, , >))]
[CompilerGenerated]
[DebuggerNonUserCode]
public Choice2Of3@DebugTypeProxy(Choice2Of3 obj)
{
_obj = obj;
}
}
[SpecialName]
internal class Choice3Of3@DebugTypeProxy
{
[CompilationMapping(SourceConstructFlags.Field, 2, 0)]
[CompilerGenerated]
[DebuggerNonUserCode]
public T3 Item
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return _obj.item;
}
}
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(FSharpChoice<, , >))]
[CompilerGenerated]
[DebuggerNonUserCode]
public Choice3Of3@DebugTypeProxy(Choice3Of3 obj)
{
_obj = obj;
}
}
[CompilerGenerated]
[DebuggerNonUserCode]
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
public int Tag
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return (this is Choice3Of3) ? 2 : ((this is Choice2Of3) ? 1 : 0);
}
}
[CompilerGenerated]
[DebuggerNonUserCode]
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
public bool IsChoice1Of3
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return this is Choice1Of3;
}
}
[CompilerGenerated]
[DebuggerNonUserCode]
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
public bool IsChoice2Of3
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return this is Choice2Of3;
}
}
[CompilerGenerated]
[DebuggerNonUserCode]
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
public bool IsChoice3Of3
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return this is Choice3Of3;
}
}
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicNestedTypes | DynamicallyAccessedMemberTypes.NonPublicNestedTypes | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(FSharpChoice<, , >))]
[CompilerGenerated]
[DebuggerNonUserCode]
internal FSharpChoice()
{
}
[CompilationMapping(SourceConstructFlags.UnionCase, 0)]
public static FSharpChoice<T1, T2, T3> NewChoice1Of3(T1 item)
{
return new Choice1Of3(item);
}
[CompilationMapping(SourceConstructFlags.UnionCase, 1)]
public static FSharpChoice<T1, T2, T3> NewChoice2Of3(T2 item)
{
return new Choice2Of3(item);
}
[CompilationMapping(SourceConstructFlags.UnionCase, 2)]
public static FSharpChoice<T1, T2, T3> NewChoice3Of3(T3 item)
{
return new Choice3Of3(item);
}
[CompilerGenerated]
public virtual sealed int CompareTo(FSharpChoice<T1, T2, T3> obj)
{
if (this != null)
{
if (obj != null)
{
int num = ((this is Choice3Of3) ? 2 : ((this is Choice2Of3) ? 1 : 0));
int num2 = ((obj is Choice3Of3) ? 2 : ((obj is Choice2Of3) ? 1 : 0));
if (num == num2)
{
IComparer genericComparer;
if (!(this is Choice1Of3))
{
if (this is Choice2Of3)
{
Choice2Of3 choice2Of = (Choice2Of3)this;
Choice2Of3 choice2Of2 = (Choice2Of3)obj;
genericComparer = LanguagePrimitives.GenericComparer;
T2 item = choice2Of.item;
T2 item2 = choice2Of2.item;
return LanguagePrimitives.HashCompare.GenericComparisonWithComparerIntrinsic(genericComparer, item, item2);
}
if (this is Choice3Of3)
{
Choice3Of3 choice3Of = (Choice3Of3)this;
Choice3Of3 choice3Of2 = (Choice3Of3)obj;
genericComparer = LanguagePrimitives.GenericComparer;
T3 item3 = choice3Of.item;
T3 item4 = choice3Of2.item;
return LanguagePrimitives.HashCompare.GenericComparisonWithComparerIntrinsic(genericComparer, item3, item4);
}
}
Choice1Of3 choice1Of = (Choice1Of3)this;
Choice1Of3 choice1Of2 = (Choice1Of3)obj;
genericComparer = LanguagePrimitives.GenericComparer;
T1 item5 = choice1Of.item;
T1 item6 = choice1Of2.item;
return LanguagePrimitives.HashCompare.GenericComparisonWithComparerIntrinsic(genericComparer, item5, item6);
}
return num - num2;
}
return 1;
}
if (obj != null)
{
return -1;
}
return 0;
}
[CompilerGenerated]
public virtual sealed int CompareTo(object obj)
{
return CompareTo((FSharpChoice<T1, T2, T3>)obj);
}
[CompilerGenerated]
public virtual sealed int CompareTo(object obj, IComparer comp)
{
FSharpChoice<T1, T2, T3> fSharpChoice = (FSharpChoice<T1, T2, T3>)obj;
if (this != null)
{
if ((FSharpChoice<T1, T2, T3>)obj != null)
{
int num = ((this is Choice3Of3) ? 2 : ((this is Choice2Of3) ? 1 : 0));
FSharpChoice<T1, T2, T3> fSharpChoice2 = fSharpChoice;
int num2 = ((fSharpChoice2 is Choice3Of3) ? 2 : ((fSharpChoice2 is Choice2Of3) ? 1 : 0));
if (num == num2)
{
if (!(this is Choice1Of3))
{
if (this is Choice2Of3)
{
Choice2Of3 choice2Of = (Choice2Of3)this;
Choice2Of3 choice2Of2 = (Choice2Of3)fSharpChoice;
T2 item = choice2Of.item;
T2 item2 = choice2Of2.item;
return LanguagePrimitives.HashCompare.GenericComparisonWithComparerIntrinsic(comp, item, item2);
}
if (this is Choice3Of3)
{
Choice3Of3 choice3Of = (Choice3Of3)this;
Choice3Of3 choice3Of2 = (Choice3Of3)fSharpChoice;
T3 item3 = choice3Of.item;
T3 item4 = choice3Of2.item;
return LanguagePrimitives.HashCompare.GenericComparisonWithComparerIntrinsic(comp, item3, item4);
}
}
Choice1Of3 choice1Of = (Choice1Of3)this;
Choice1Of3 choice1Of2 = (Choice1Of3)fSharpChoice;
T1 item5 = choice1Of.item;
T1 item6 = choice1Of2.item;
return LanguagePrimitives.HashCompare.GenericComparisonWithComparerIntrinsic(comp, item5, item6);
}
return num - num2;
}
return 1;
}
if ((FSharpChoice<T1, T2, T3>)obj != null)
{
return -1;
}
return 0;
}
[CompilerGenerated]
public virtual sealed int GetHashCode(IEqualityComparer comp)
{
if (this != null)
{
int num = 0;
if (!(this is Choice1Of3))
{
if (this is Choice2Of3)
{
Choice2Of3 choice2Of = (Choice2Of3)this;
num = 1;
T2 item = choice2Of.item;
return -1640531527 + (LanguagePrimitives.HashCompare.GenericHashWithComparerIntrinsic(comp, item) + ((num << 6) + (num >> 2)));
}
if (this is Choice3Of3)
{
Choice3Of3 choice3Of = (Choice3Of3)this;
num = 2;
T3 item2 = choice3Of.item;
return -1640531527 + (LanguagePrimitives.HashCompare.GenericHashWithComparerIntrinsic(comp, item2) + ((num << 6) + (num >> 2)));
}
}
Choice1Of3 choice1Of = (Choice1Of3)this;
num = 0;
T1 item3 = choice1Of.item;
return -1640531527 + (LanguagePrimitives.HashCompare.GenericHashWithComparerIntrinsic(comp, item3) + ((num << 6) + (num >> 2)));
}
return 0;
}
[CompilerGenerated]
public sealed override int GetHashCode()
{
return GetHashCode(LanguagePrimitives.GenericEqualityComparer);
}
[CompilerGenerated]
public bool Equals(FSharpChoice<T1, T2, T3> obj, IEqualityComparer comp)
{
if (this != null)
{
if (obj != null)
{
int num = ((this is Choice3Of3) ? 2 : ((this is Choice2Of3) ? 1 : 0));
int num2 = ((obj is Choice3Of3) ? 2 : ((obj is Choice2Of3) ? 1 : 0));
if (num == num2)
{
if (!(this is Choice1Of3))
{
if (this is Choice2Of3)
{
Choice2Of3 choice2Of = (Choice2Of3)this;
Choice2Of3 choice2Of2 = (Choice2Of3)obj;
T2 item = choice2Of.item;
T2 item2 = choice2Of2.item;
return LanguagePrimitives.HashCompare.GenericEqualityWithComparerIntrinsic(comp, item, item2);
}
if (this is Choice3Of3)
{
Choice3Of3 choice3Of = (Choice3Of3)this;
Choice3Of3 choice3Of2 = (Choice3Of3)obj;
T3 item3 = choice3Of.item;
T3 item4 = choice3Of2.item;
return LanguagePrimitives.HashCompare.GenericEqualityWithComparerIntrinsic(comp, item3, item4);
}
}
Choice1Of3 choice1Of = (Choice1Of3)this;
Choice1Of3 choice1Of2 = (Choice1Of3)obj;
T1 item5 = choice1Of.item;
T1 item6 = choice1Of2.item;
return LanguagePrimitives.HashCompare.GenericEqualityWithComparerIntrinsic(comp, item5, item6);
}
return false;
}
return false;
}
return obj == null;
}
[CompilerGenerated]
public virtual sealed bool Equals(object obj, IEqualityComparer comp)
{
if (obj is FSharpChoice<T1, T2, T3> obj2)
{
return Equals(obj2, comp);
}
return false;
}
[CompilerGenerated]
public virtual sealed bool Equals(FSharpChoice<T1, T2, T3> obj)
{
if (this != null)
{
if (obj != null)
{
int num = ((this is Choice3Of3) ? 2 : ((this is Choice2Of3) ? 1 : 0));
int num2 = ((obj is Choice3Of3) ? 2 : ((obj is Choice2Of3) ? 1 : 0));
if (num == num2)
{
if (!(this is Choice1Of3))
{
if (this is Choice2Of3)
{
Choice2Of3 choice2Of = (Choice2Of3)this;
Choice2Of3 choice2Of2 = (Choice2Of3)obj;
T2 item = choice2Of.item;
T2 item2 = choice2Of2.item;
return LanguagePrimitives.HashCompare.GenericEqualityERIntrinsic(item, item2);
}
if (this is Choice3Of3)
{
Choice3Of3 choice3Of = (Choice3Of3)this;
Choice3Of3 choice3Of2 = (Choice3Of3)obj;
T3 item3 = choice3Of.item;
T3 item4 = choice3Of2.item;
return LanguagePrimitives.HashCompare.GenericEqualityERIntrinsic(item3, item4);
}
}
Choice1Of3 choice1Of = (Choice1Of3)this;
Choice1Of3 choice1Of2 = (Choice1Of3)obj;
T1 item5 = choice1Of.item;
T1 item6 = choice1Of2.item;
return LanguagePrimitives.HashCompare.GenericEqualityERIntrinsic(item5, item6);
}
return false;
}
return false;
}
return obj == null;
}
[CompilerGenerated]
public sealed override bool Equals(object obj)
{
if (obj is FSharpChoice<T1, T2, T3> obj2)
{
return Equals(obj2);
}
return false;
}
}
[Serializable]
[StructLayout(LayoutKind.Auto, CharSet = CharSet.Auto)]
[StructuralEquality]
[StructuralComparison]
[CompiledName("FSharpChoice`4")]
[CompilationMapping(SourceConstructFlags.SumType)]
public abstract class FSharpChoice<T1, T2, T3, T4> : IEquatable<FSharpChoice<T1, T2, T3, T4>>, IStructuralEquatable, IComparable<FSharpChoice<T1, T2, T3, T4>>, IComparable, IStructuralComparable
{
public static class Tags
{
public const int Choice1Of4 = 0;
public const int Choice2Of4 = 1;
public const int Choice3Of4 = 2;
public const int Choice4Of4 = 3;
}
[Serializable]
[SpecialName]
[DebuggerTypeProxy(typeof(FSharpChoice<, , , >.Choice1Of4@DebugTypeProxy))]
public class Choice1Of4 : FSharpChoice<T1, T2, T3, T4>
{
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
[CompilerGenerated]
[DebuggerNonUserCode]
internal readonly T1 item;
[CompilationMapping(SourceConstructFlags.Field, 0, 0)]
[CompilerGenerated]
[DebuggerNonUserCode]
public T1 Item
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return item;
}
}
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(FSharpChoice<, , , >))]
[CompilerGenerated]
[DebuggerNonUserCode]
internal Choice1Of4(T1 item)
: base(0)
{
this.item = item;
}
}
[Serializable]
[SpecialName]
[DebuggerTypeProxy(typeof(FSharpChoice<, , , >.Choice2Of4@DebugTypeProxy))]
public class Choice2Of4 : FSharpChoice<T1, T2, T3, T4>
{
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
[CompilerGenerated]
[DebuggerNonUserCode]
internal readonly T2 item;
[CompilationMapping(SourceConstructFlags.Field, 1, 0)]
[CompilerGenerated]
[DebuggerNonUserCode]
public T2 Item
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return item;
}
}
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(FSharpChoice<, , , >))]
[CompilerGenerated]
[DebuggerNonUserCode]
internal Choice2Of4(T2 item)
: base(1)
{
this.item = item;
}
}
[Serializable]
[SpecialName]
[DebuggerTypeProxy(typeof(FSharpChoice<, , , >.Choice3Of4@DebugTypeProxy))]
public class Choice3Of4 : FSharpChoice<T1, T2, T3, T4>
{
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
[CompilerGenerated]
[DebuggerNonUserCode]
internal readonly T3 item;
[CompilationMapping(SourceConstructFlags.Field, 2, 0)]
[CompilerGenerated]
[DebuggerNonUserCode]
public T3 Item
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return item;
}
}
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(FSharpChoice<, , , >))]
[CompilerGenerated]
[DebuggerNonUserCode]
internal Choice3Of4(T3 item)
: base(2)
{
this.item = item;
}
}
[Serializable]
[SpecialName]
[DebuggerTypeProxy(typeof(FSharpChoice<, , , >.Choice4Of4@DebugTypeProxy))]
public class Choice4Of4 : FSharpChoice<T1, T2, T3, T4>
{
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
[CompilerGenerated]
[DebuggerNonUserCode]
internal readonly T4 item;
[CompilationMapping(SourceConstructFlags.Field, 3, 0)]
[CompilerGenerated]
[DebuggerNonUserCode]
public T4 Item
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return item;
}
}
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(FSharpChoice<, , , >))]
[CompilerGenerated]
[DebuggerNonUserCode]
internal Choice4Of4(T4 item)
: base(3)
{
this.item = item;
}
}
[SpecialName]
internal class Choice1Of4@DebugTypeProxy
{
[CompilationMapping(SourceConstructFlags.Field, 0, 0)]
[CompilerGenerated]
[DebuggerNonUserCode]
public T1 Item
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return _obj.item;
}
}
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(FSharpChoice<, , , >))]
[CompilerGenerated]
[DebuggerNonUserCode]
public Choice1Of4@DebugTypeProxy(Choice1Of4 obj)
{
_obj = obj;
}
}
[SpecialName]
internal class Choice2Of4@DebugTypeProxy
{
[CompilationMapping(SourceConstructFlags.Field, 1, 0)]
[CompilerGenerated]
[DebuggerNonUserCode]
public T2 Item
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return _obj.item;
}
}
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(FSharpChoice<, , , >))]
[CompilerGenerated]
[DebuggerNonUserCode]
public Choice2Of4@DebugTypeProxy(Choice2Of4 obj)
{
_obj = obj;
}
}
[SpecialName]
internal class Choice3Of4@DebugTypeProxy
{
[CompilationMapping(SourceConstructFlags.Field, 2, 0)]
[CompilerGenerated]
[DebuggerNonUserCode]
public T3 Item
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return _obj.item;
}
}
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(FSharpChoice<, , , >))]
[CompilerGenerated]
[DebuggerNonUserCode]
public Choice3Of4@DebugTypeProxy(Choice3Of4 obj)
{
_obj = obj;
}
}
[SpecialName]
internal class Choice4Of4@DebugTypeProxy
{
[CompilationMapping(SourceConstructFlags.Field, 3, 0)]
[CompilerGenerated]
[DebuggerNonUserCode]
public T4 Item
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return _obj.item;
}
}
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(FSharpChoice<, , , >))]
[CompilerGenerated]
[DebuggerNonUserCode]
public Choice4Of4@DebugTypeProxy(Choice4Of4 obj)
{
_obj = obj;
}
}
[CompilerGenerated]
[DebuggerNonUserCode]
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
public int Tag
{
[DebuggerNonUserCode]
get;
}
[CompilerGenerated]
[DebuggerNonUserCode]
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
public bool IsChoice1Of4
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return Tag == 0;
}
}
[CompilerGenerated]
[DebuggerNonUserCode]
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
public bool IsChoice2Of4
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return Tag == 1;
}
}
[CompilerGenerated]
[DebuggerNonUserCode]
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
public bool IsChoice3Of4
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return Tag == 2;
}
}
[CompilerGenerated]
[DebuggerNonUserCode]
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
public bool IsChoice4Of4
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return Tag == 3;
}
}
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicNestedTypes | DynamicallyAccessedMemberTypes.NonPublicNestedTypes | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(FSharpChoice<, , , >))]
[CompilerGenerated]
[DebuggerNonUserCode]
internal FSharpChoice(int _tag)
{
this._tag = _tag;
}
[CompilationMapping(SourceConstructFlags.UnionCase, 0)]
public static FSharpChoice<T1, T2, T3, T4> NewChoice1Of4(T1 item)
{
return new Choice1Of4(item);
}
[CompilationMapping(SourceConstructFlags.UnionCase, 1)]
public static FSharpChoice<T1, T2, T3, T4> NewChoice2Of4(T2 item)
{
return new Choice2Of4(item);
}
[CompilationMapping(SourceConstructFlags.UnionCase, 2)]
public static FSharpChoice<T1, T2, T3, T4> NewChoice3Of4(T3 item)
{
return new Choice3Of4(item);
}
[CompilationMapping(SourceConstructFlags.UnionCase, 3)]
public static FSharpChoice<T1, T2, T3, T4> NewChoice4Of4(T4 item)
{
return new Choice4Of4(item);
}
[CompilerGenerated]
public virtual sealed int CompareTo(FSharpChoice<T1, T2, T3, T4> obj)
{
if (this != null)
{
if (obj != null)
{
int tag = _tag;
int tag2 = obj._tag;
if (tag == tag2)
{
switch (Tag)
{
default:
{
Choice1Of4 choice1Of = (Choice1Of4)this;
Choice1Of4 choice1Of2 = (Choice1Of4)obj;
IComparer genericComparer = LanguagePrimitives.GenericComparer;
T1 item7 = choice1Of.item;
T1 item8 = choice1Of2.item;
return LanguagePrimitives.HashCompare.GenericComparisonWithComparerIntrinsic(genericComparer, item7, item8);
}
case 1:
{
Choice2Of4 choice2Of = (Choice2Of4)this;
Choice2Of4 choice2Of2 = (Choice2Of4)obj;
IComparer genericComparer = LanguagePrimitives.GenericComparer;
T2 item5 = choice2Of.item;
T2 item6 = choice2Of2.item;
return LanguagePrimitives.HashCompare.GenericComparisonWithComparerIntrinsic(genericComparer, item5, item6);
}
case 2:
{
Choice3Of4 choice3Of = (Choice3Of4)this;
Choice3Of4 choice3Of2 = (Choice3Of4)obj;
IComparer genericComparer = LanguagePrimitives.GenericComparer;
T3 item3 = choice3Of.item;
T3 item4 = choice3Of2.item;
return LanguagePrimitives.HashCompare.GenericComparisonWithComparerIntrinsic(genericComparer, item3, item4);
}
case 3:
{
Choice4Of4 choice4Of = (Choice4Of4)this;
Choice4Of4 choice4Of2 = (Choice4Of4)obj;
IComparer genericComparer = LanguagePrimitives.GenericComparer;
T4 item = choice4Of.item;
T4 item2 = choice4Of2.item;
return LanguagePrimitives.HashCompare.GenericComparisonWithComparerIntrinsic(genericComparer, item, item2);
}
}
}
return tag - tag2;
}
return 1;
}
if (obj != null)
{
return -1;
}
return 0;
}
[CompilerGenerated]
public virtual sealed int CompareTo(object obj)
{
return CompareTo((FSharpChoice<T1, T2, T3, T4>)obj);
}
[CompilerGenerated]
public virtual sealed int CompareTo(object obj, IComparer comp)
{
FSharpChoice<T1, T2, T3, T4> fSharpChoice = (FSharpChoice<T1, T2, T3, T4>)obj;
if (this != null)
{
if ((FSharpChoice<T1, T2, T3, T4>)obj != null)
{
int tag = _tag;
int tag2 = fSharpChoice._tag;
if (tag == tag2)
{
switch (Tag)
{
default:
{
Choice1Of4 choice1Of = (Choice1Of4)this;
Choice1Of4 choice1Of2 = (Choice1Of4)fSharpChoice;
T1 item7 = choice1Of.item;
T1 item8 = choice1Of2.item;
return LanguagePrimitives.HashCompare.GenericComparisonWithComparerIntrinsic(comp, item7, item8);
}
case 1:
{
Choice2Of4 choice2Of = (Choice2Of4)this;
Choice2Of4 choice2Of2 = (Choice2Of4)fSharpChoice;
T2 item5 = choice2Of.item;
T2 item6 = choice2Of2.item;
return LanguagePrimitives.HashCompare.GenericComparisonWithComparerIntrinsic(comp, item5, item6);
}
case 2:
{
Choice3Of4 choice3Of = (Choice3Of4)this;
Choice3Of4 choice3Of2 = (Choice3Of4)fSharpChoice;
T3 item3 = choice3Of.item;
T3 item4 = choice3Of2.item;
return LanguagePrimitives.HashCompare.GenericComparisonWithComparerIntrinsic(comp, item3, item4);
}
case 3:
{
Choice4Of4 choice4Of = (Choice4Of4)this;
Choice4Of4 choice4Of2 = (Choice4Of4)fSharpChoice;
T4 item = choice4Of.item;
T4 item2 = choice4Of2.item;
return LanguagePrimitives.HashCompare.GenericComparisonWithComparerIntrinsic(comp, item, item2);
}
}
}
return tag - tag2;
}
return 1;
}
if ((FSharpChoice<T1, T2, T3, T4>)obj != null)
{
return -1;
}
return 0;
}
[CompilerGenerated]
public virtual sealed int GetHashCode(IEqualityComparer comp)
{
if (this != null)
{
int num = 0;
switch (Tag)
{
default:
{
Choice1Of4 choice1Of = (Choice1Of4)this;
num = 0;
T1 item4 = choice1Of.item;
return -1640531527 + (LanguagePrimitives.HashCompare.GenericHashWithComparerIntrinsic(comp, item4) + ((num << 6) + (num >> 2)));
}
case 1:
{
Choice2Of4 choice2Of = (Choice2Of4)this;
num = 1;
T2 item3 = choice2Of.item;
return -1640531527 + (LanguagePrimitives.HashCompare.GenericHashWithComparerIntrinsic(comp, item3) + ((num << 6) + (num >> 2)));
}
case 2:
{
Choice3Of4 choice3Of = (Choice3Of4)this;
num = 2;
T3 item2 = choice3Of.item;
return -1640531527 + (LanguagePrimitives.HashCompare.GenericHashWithComparerIntrinsic(comp, item2) + ((num << 6) + (num >> 2)));
}
case 3:
{
Choice4Of4 choice4Of = (Choice4Of4)this;
num = 3;
T4 item = choice4Of.item;
return -1640531527 + (LanguagePrimitives.HashCompare.GenericHashWithComparerIntrinsic(comp, item) + ((num << 6) + (num >> 2)));
}
}
}
return 0;
}
[CompilerGenerated]
public sealed override int GetHashCode()
{
return GetHashCode(LanguagePrimitives.GenericEqualityComparer);
}
[CompilerGenerated]
public bool Equals(FSharpChoice<T1, T2, T3, T4> obj, IEqualityComparer comp)
{
if (this != null)
{
if (obj != null)
{
int tag = _tag;
int tag2 = obj._tag;
if (tag == tag2)
{
switch (Tag)
{
default:
{
Choice1Of4 choice1Of = (Choice1Of4)this;
Choice1Of4 choice1Of2 = (Choice1Of4)obj;
T1 item7 = choice1Of.item;
T1 item8 = choice1Of2.item;
return LanguagePrimitives.HashCompare.GenericEqualityWithComparerIntrinsic(comp, item7, item8);
}
case 1:
{
Choice2Of4 choice2Of = (Choice2Of4)this;
Choice2Of4 choice2Of2 = (Choice2Of4)obj;
T2 item5 = choice2Of.item;
T2 item6 = choice2Of2.item;
return LanguagePrimitives.HashCompare.GenericEqualityWithComparerIntrinsic(comp, item5, item6);
}
case 2:
{
Choice3Of4 choice3Of = (Choice3Of4)this;
Choice3Of4 choice3Of2 = (Choice3Of4)obj;
T3 item3 = choice3Of.item;
T3 item4 = choice3Of2.item;
return LanguagePrimitives.HashCompare.GenericEqualityWithComparerIntrinsic(comp, item3, item4);
}
case 3:
{
Choice4Of4 choice4Of = (Choice4Of4)this;
Choice4Of4 choice4Of2 = (Choice4Of4)obj;
T4 item = choice4Of.item;
T4 item2 = choice4Of2.item;
return LanguagePrimitives.HashCompare.GenericEqualityWithComparerIntrinsic(comp, item, item2);
}
}
}
return false;
}
return false;
}
return obj == null;
}
[CompilerGenerated]
public virtual sealed bool Equals(object obj, IEqualityComparer comp)
{
if (obj is FSharpChoice<T1, T2, T3, T4> obj2)
{
return Equals(obj2, comp);
}
return false;
}
[CompilerGenerated]
public virtual sealed bool Equals(FSharpChoice<T1, T2, T3, T4> obj)
{
if (this != null)
{
if (obj != null)
{
int tag = _tag;
int tag2 = obj._tag;
if (tag == tag2)
{
switch (Tag)
{
default:
{
Choice1Of4 choice1Of = (Choice1Of4)this;
Choice1Of4 choice1Of2 = (Choice1Of4)obj;
T1 item7 = choice1Of.item;
T1 item8 = choice1Of2.item;
return LanguagePrimitives.HashCompare.GenericEqualityERIntrinsic(item7, item8);
}
case 1:
{
Choice2Of4 choice2Of = (Choice2Of4)this;
Choice2Of4 choice2Of2 = (Choice2Of4)obj;
T2 item5 = choice2Of.item;
T2 item6 = choice2Of2.item;
return LanguagePrimitives.HashCompare.GenericEqualityERIntrinsic(item5, item6);
}
case 2:
{
Choice3Of4 choice3Of = (Choice3Of4)this;
Choice3Of4 choice3Of2 = (Choice3Of4)obj;
T3 item3 = choice3Of.item;
T3 item4 = choice3Of2.item;
return LanguagePrimitives.HashCompare.GenericEqualityERIntrinsic(item3, item4);
}
case 3:
{
Choice4Of4 choice4Of = (Choice4Of4)this;
Choice4Of4 choice4Of2 = (Choice4Of4)obj;
T4 item = choice4Of.item;
T4 item2 = choice4Of2.item;
return LanguagePrimitives.HashCompare.GenericEqualityERIntrinsic(item, item2);
}
}
}
return false;
}
return false;
}
return obj == null;
}
[CompilerGenerated]
public sealed override bool Equals(object obj)
{
if (obj is FSharpChoice<T1, T2, T3, T4> obj2)
{
return Equals(obj2);
}
return false;
}
}
[Serializable]
[StructLayout(LayoutKind.Auto, CharSet = CharSet.Auto)]
[StructuralEquality]
[StructuralComparison]
[CompiledName("FSharpChoice`5")]
[CompilationMapping(SourceConstructFlags.SumType)]
public abstract class FSharpChoice<T1, T2, T3, T4, T5> : IEquatable<FSharpChoice<T1, T2, T3, T4, T5>>, IStructuralEquatable, IComparable<FSharpChoice<T1, T2, T3, T4, T5>>, IComparable, IStructuralComparable
{
public static class Tags
{
public const int Choice1Of5 = 0;
public const int Choice2Of5 = 1;
public const int Choice3Of5 = 2;
public const int Choice4Of5 = 3;
public const int Choice5Of5 = 4;
}
[Serializable]
[SpecialName]
[DebuggerTypeProxy(typeof(FSharpChoice<, , , , >.Choice1Of5@DebugTypeProxy))]
public class Choice1Of5 : FSharpChoice<T1, T2, T3, T4, T5>
{
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
[CompilerGenerated]
[DebuggerNonUserCode]
internal readonly T1 item;
[CompilationMapping(SourceConstructFlags.Field, 0, 0)]
[CompilerGenerated]
[DebuggerNonUserCode]
public T1 Item
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return item;
}
}
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(FSharpChoice<, , , , >))]
[CompilerGenerated]
[DebuggerNonUserCode]
internal Choice1Of5(T1 item)
: base(0)
{
this.item = item;
}
}
[Serializable]
[SpecialName]
[DebuggerTypeProxy(typeof(FSharpChoice<, , , , >.Choice2Of5@DebugTypeProxy))]
public class Choice2Of5 : FSharpChoice<T1, T2, T3, T4, T5>
{
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
[CompilerGenerated]
[DebuggerNonUserCode]
internal readonly T2 item;
[CompilationMapping(SourceConstructFlags.Field, 1, 0)]
[CompilerGenerated]
[DebuggerNonUserCode]
public T2 Item
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return item;
}
}
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(FSharpChoice<, , , , >))]
[CompilerGenerated]
[DebuggerNonUserCode]
internal Choice2Of5(T2 item)
: base(1)
{
this.item = item;
}
}
[Serializable]
[SpecialName]
[DebuggerTypeProxy(typeof(FSharpChoice<, , , , >.Choice3Of5@DebugTypeProxy))]
public class Choice3Of5 : FSharpChoice<T1, T2, T3, T4, T5>
{
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
[CompilerGenerated]
[DebuggerNonUserCode]
internal readonly T3 item;
[CompilationMapping(SourceConstructFlags.Field, 2, 0)]
[CompilerGenerated]
[DebuggerNonUserCode]
public T3 Item
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return item;
}
}
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(FSharpChoice<, , , , >))]
[CompilerGenerated]
[DebuggerNonUserCode]
internal Choice3Of5(T3 item)
: base(2)
{
this.item = item;
}
}
[Serializable]
[SpecialName]
[DebuggerTypeProxy(typeof(FSharpChoice<, , , , >.Choice4Of5@DebugTypeProxy))]
public class Choice4Of5 : FSharpChoice<T1, T2, T3, T4, T5>
{
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
[CompilerGenerated]
[DebuggerNonUserCode]
internal readonly T4 item;
[CompilationMapping(SourceConstructFlags.Field, 3, 0)]
[CompilerGenerated]
[DebuggerNonUserCode]
public T4 Item
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return item;
}
}
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(FSharpChoice<, , , , >))]
[CompilerGenerated]
[DebuggerNonUserCode]
internal Choice4Of5(T4 item)
: base(3)
{
this.item = item;
}
}
[Serializable]
[SpecialName]
[DebuggerTypeProxy(typeof(FSharpChoice<, , , , >.Choice5Of5@DebugTypeProxy))]
public class Choice5Of5 : FSharpChoice<T1, T2, T3, T4, T5>
{
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
[CompilerGenerated]
[DebuggerNonUserCode]
internal readonly T5 item;
[CompilationMapping(SourceConstructFlags.Field, 4, 0)]
[CompilerGenerated]
[DebuggerNonUserCode]
public T5 Item
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return item;
}
}
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(FSharpChoice<, , , , >))]
[CompilerGenerated]
[DebuggerNonUserCode]
internal Choice5Of5(T5 item)
: base(4)
{
this.item = item;
}
}
[SpecialName]
internal class Choice1Of5@DebugTypeProxy
{
[CompilationMapping(SourceConstructFlags.Field, 0, 0)]
[CompilerGenerated]
[DebuggerNonUserCode]
public T1 Item
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return _obj.item;
}
}
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(FSharpChoice<, , , , >))]
[CompilerGenerated]
[DebuggerNonUserCode]
public Choice1Of5@DebugTypeProxy(Choice1Of5 obj)
{
_obj = obj;
}
}
[SpecialName]
internal class Choice2Of5@DebugTypeProxy
{
[CompilationMapping(SourceConstructFlags.Field, 1, 0)]
[CompilerGenerated]
[DebuggerNonUserCode]
public T2 Item
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return _obj.item;
}
}
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(FSharpChoice<, , , , >))]
[CompilerGenerated]
[DebuggerNonUserCode]
public Choice2Of5@DebugTypeProxy(Choice2Of5 obj)
{
_obj = obj;
}
}
[SpecialName]
internal class Choice3Of5@DebugTypeProxy
{
[CompilationMapping(SourceConstructFlags.Field, 2, 0)]
[CompilerGenerated]
[DebuggerNonUserCode]
public T3 Item
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return _obj.item;
}
}
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(FSharpChoice<, , , , >))]
[CompilerGenerated]
[DebuggerNonUserCode]
public Choice3Of5@DebugTypeProxy(Choice3Of5 obj)
{
_obj = obj;
}
}
[SpecialName]
internal class Choice4Of5@DebugTypeProxy
{
[CompilationMapping(SourceConstructFlags.Field, 3, 0)]
[CompilerGenerated]
[DebuggerNonUserCode]
public T4 Item
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return _obj.item;
}
}
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(FSharpChoice<, , , , >))]
[CompilerGenerated]
[DebuggerNonUserCode]
public Choice4Of5@DebugTypeProxy(Choice4Of5 obj)
{
_obj = obj;
}
}
[SpecialName]
internal class Choice5Of5@DebugTypeProxy
{
[CompilationMapping(SourceConstructFlags.Field, 4, 0)]
[CompilerGenerated]
[DebuggerNonUserCode]
public T5 Item
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return _obj.item;
}
}
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(FSharpChoice<, , , , >))]
[CompilerGenerated]
[DebuggerNonUserCode]
public Choice5Of5@DebugTypeProxy(Choice5Of5 obj)
{
_obj = obj;
}
}
[CompilerGenerated]
[DebuggerNonUserCode]
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
public int Tag
{
[DebuggerNonUserCode]
get;
}
[CompilerGenerated]
[DebuggerNonUserCode]
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
public bool IsChoice1Of5
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return Tag == 0;
}
}
[CompilerGenerated]
[DebuggerNonUserCode]
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
public bool IsChoice2Of5
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return Tag == 1;
}
}
[CompilerGenerated]
[DebuggerNonUserCode]
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
public bool IsChoice3Of5
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return Tag == 2;
}
}
[CompilerGenerated]
[DebuggerNonUserCode]
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
public bool IsChoice4Of5
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return Tag == 3;
}
}
[CompilerGenerated]
[DebuggerNonUserCode]
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
public bool IsChoice5Of5
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return Tag == 4;
}
}
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicNestedTypes | DynamicallyAccessedMemberTypes.NonPublicNestedTypes | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(FSharpChoice<, , , , >))]
[CompilerGenerated]
[DebuggerNonUserCode]
internal FSharpChoice(int _tag)
{
this._tag = _tag;
}
[CompilationMapping(SourceConstructFlags.UnionCase, 0)]
public static FSharpChoice<T1, T2, T3, T4, T5> NewChoice1Of5(T1 item)
{
return new Choice1Of5(item);
}
[CompilationMapping(SourceConstructFlags.UnionCase, 1)]
public static FSharpChoice<T1, T2, T3, T4, T5> NewChoice2Of5(T2 item)
{
return new Choice2Of5(item);
}
[CompilationMapping(SourceConstructFlags.UnionCase, 2)]
public static FSharpChoice<T1, T2, T3, T4, T5> NewChoice3Of5(T3 item)
{
return new Choice3Of5(item);
}
[CompilationMapping(SourceConstructFlags.UnionCase, 3)]
public static FSharpChoice<T1, T2, T3, T4, T5> NewChoice4Of5(T4 item)
{
return new Choice4Of5(item);
}
[CompilationMapping(SourceConstructFlags.UnionCase, 4)]
public static FSharpChoice<T1, T2, T3, T4, T5> NewChoice5Of5(T5 item)
{
return new Choice5Of5(item);
}
[CompilerGenerated]
public virtual sealed int CompareTo(FSharpChoice<T1, T2, T3, T4, T5> obj)
{
if (this != null)
{
if (obj != null)
{
return $Prim-types.CompareTo$cont@3723(this, obj, null);
}
return 1;
}
if (obj != null)
{
return -1;
}
return 0;
}
[CompilerGenerated]
public virtual sealed int CompareTo(object obj)
{
return CompareTo((FSharpChoice<T1, T2, T3, T4, T5>)obj);
}
[CompilerGenerated]
public virtual sealed int CompareTo(object obj, IComparer comp)
{
FSharpChoice<T1, T2, T3, T4, T5> objTemp = (FSharpChoice<T1, T2, T3, T4, T5>)obj;
if (this != null)
{
return $Prim-types.CompareTo$cont@3723-1(comp, this, obj, objTemp, null);
}
if ((FSharpChoice<T1, T2, T3, T4, T5>)obj != null)
{
return -1;
}
return 0;
}
[CompilerGenerated]
public virtual sealed int GetHashCode(IEqualityComparer comp)
{
if (this != null)
{
int num = 0;
switch (Tag)
{
default:
{
Choice1Of5 choice1Of = (Choice1Of5)this;
num = 0;
T1 item5 = choice1Of.item;
return -1640531527 + (LanguagePrimitives.HashCompare.GenericHashWithComparerIntrinsic(comp, item5) + ((num << 6) + (num >> 2)));
}
case 1:
{
Choice2Of5 choice2Of = (Choice2Of5)this;
num = 1;
T2 item4 = choice2Of.item;
return -1640531527 + (LanguagePrimitives.HashCompare.GenericHashWithComparerIntrinsic(comp, item4) + ((num << 6) + (num >> 2)));
}
case 2:
{
Choice3Of5 choice3Of = (Choice3Of5)this;
num = 2;
T3 item3 = choice3Of.item;
return -1640531527 + (LanguagePrimitives.HashCompare.GenericHashWithComparerIntrinsic(comp, item3) + ((num << 6) + (num >> 2)));
}
case 3:
{
Choice4Of5 choice4Of = (Choice4Of5)this;
num = 3;
T4 item2 = choice4Of.item;
return -1640531527 + (LanguagePrimitives.HashCompare.GenericHashWithComparerIntrinsic(comp, item2) + ((num << 6) + (num >> 2)));
}
case 4:
{
Choice5Of5 choice5Of = (Choice5Of5)this;
num = 4;
T5 item = choice5Of.item;
return -1640531527 + (LanguagePrimitives.HashCompare.GenericHashWithComparerIntrinsic(comp, item) + ((num << 6) + (num >> 2)));
}
}
}
return 0;
}
[CompilerGenerated]
public sealed override int GetHashCode()
{
return GetHashCode(LanguagePrimitives.GenericEqualityComparer);
}
[CompilerGenerated]
public bool Equals(FSharpChoice<T1, T2, T3, T4, T5> obj, IEqualityComparer comp)
{
if (this != null)
{
return $Prim-types.Equals$cont@3723(this, obj, comp, null);
}
return obj == null;
}
[CompilerGenerated]
public virtual sealed bool Equals(object obj, IEqualityComparer comp)
{
if (obj is FSharpChoice<T1, T2, T3, T4, T5> obj2)
{
return Equals(obj2, comp);
}
return false;
}
[CompilerGenerated]
public virtual sealed bool Equals(FSharpChoice<T1, T2, T3, T4, T5> obj)
{
if (this != null)
{
if (obj != null)
{
int tag = _tag;
int tag2 = obj._tag;
if (tag == tag2)
{
switch (Tag)
{
default:
{
Choice1Of5 choice1Of = (Choice1Of5)this;
Choice1Of5 choice1Of2 = (Choice1Of5)obj;
T1 item9 = choice1Of.item;
T1 item10 = choice1Of2.item;
return LanguagePrimitives.HashCompare.GenericEqualityERIntrinsic(item9, item10);
}
case 1:
{
Choice2Of5 choice2Of = (Choice2Of5)this;
Choice2Of5 choice2Of2 = (Choice2Of5)obj;
T2 item7 = choice2Of.item;
T2 item8 = choice2Of2.item;
return LanguagePrimitives.HashCompare.GenericEqualityERIntrinsic(item7, item8);
}
case 2:
{
Choice3Of5 choice3Of = (Choice3Of5)this;
Choice3Of5 choice3Of2 = (Choice3Of5)obj;
T3 item5 = choice3Of.item;
T3 item6 = choice3Of2.item;
return LanguagePrimitives.HashCompare.GenericEqualityERIntrinsic(item5, item6);
}
case 3:
{
Choice4Of5 choice4Of = (Choice4Of5)this;
Choice4Of5 choice4Of2 = (Choice4Of5)obj;
T4 item3 = choice4Of.item;
T4 item4 = choice4Of2.item;
return LanguagePrimitives.HashCompare.GenericEqualityERIntrinsic(item3, item4);
}
case 4:
{
Choice5Of5 choice5Of = (Choice5Of5)this;
Choice5Of5 choice5Of2 = (Choice5Of5)obj;
T5 item = choice5Of.item;
T5 item2 = choice5Of2.item;
return LanguagePrimitives.HashCompare.GenericEqualityERIntrinsic(item, item2);
}
}
}
return false;
}
return false;
}
return obj == null;
}
[CompilerGenerated]
public sealed override bool Equals(object obj)
{
if (obj is FSharpChoice<T1, T2, T3, T4, T5> obj2)
{
return Equals(obj2);
}
return false;
}
}
[Serializable]
[StructLayout(LayoutKind.Auto, CharSet = CharSet.Auto)]
[StructuralEquality]
[StructuralComparison]
[CompiledName("FSharpChoice`6")]
[CompilationMapping(SourceConstructFlags.SumType)]
public abstract class FSharpChoice<T1, T2, T3, T4, T5, T6> : IEquatable<FSharpChoice<T1, T2, T3, T4, T5, T6>>, IStructuralEquatable, IComparable<FSharpChoice<T1, T2, T3, T4, T5, T6>>, IComparable, IStructuralComparable
{
public static class Tags
{
public const int Choice1Of6 = 0;
public const int Choice2Of6 = 1;
public const int Choice3Of6 = 2;
public const int Choice4Of6 = 3;
public const int Choice5Of6 = 4;
public const int Choice6Of6 = 5;
}
[Serializable]
[SpecialName]
[DebuggerTypeProxy(typeof(FSharpChoice<, , , , , >.Choice1Of6@DebugTypeProxy))]
public class Choice1Of6 : FSharpChoice<T1, T2, T3, T4, T5, T6>
{
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
[CompilerGenerated]
[DebuggerNonUserCode]
internal readonly T1 item;
[CompilationMapping(SourceConstructFlags.Field, 0, 0)]
[CompilerGenerated]
[DebuggerNonUserCode]
public T1 Item
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return item;
}
}
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(FSharpChoice<, , , , , >))]
[CompilerGenerated]
[DebuggerNonUserCode]
internal Choice1Of6(T1 item)
: base(0)
{
this.item = item;
}
}
[Serializable]
[SpecialName]
[DebuggerTypeProxy(typeof(FSharpChoice<, , , , , >.Choice2Of6@DebugTypeProxy))]
public class Choice2Of6 : FSharpChoice<T1, T2, T3, T4, T5, T6>
{
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
[CompilerGenerated]
[DebuggerNonUserCode]
internal readonly T2 item;
[CompilationMapping(SourceConstructFlags.Field, 1, 0)]
[CompilerGenerated]
[DebuggerNonUserCode]
public T2 Item
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return item;
}
}
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(FSharpChoice<, , , , , >))]
[CompilerGenerated]
[DebuggerNonUserCode]
internal Choice2Of6(T2 item)
: base(1)
{
this.item = item;
}
}
[Serializable]
[SpecialName]
[DebuggerTypeProxy(typeof(FSharpChoice<, , , , , >.Choice3Of6@DebugTypeProxy))]
public class Choice3Of6 : FSharpChoice<T1, T2, T3, T4, T5, T6>
{
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
[CompilerGenerated]
[DebuggerNonUserCode]
internal readonly T3 item;
[CompilationMapping(SourceConstructFlags.Field, 2, 0)]
[CompilerGenerated]
[DebuggerNonUserCode]
public T3 Item
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return item;
}
}
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(FSharpChoice<, , , , , >))]
[CompilerGenerated]
[DebuggerNonUserCode]
internal Choice3Of6(T3 item)
: base(2)
{
this.item = item;
}
}
[Serializable]
[SpecialName]
[DebuggerTypeProxy(typeof(FSharpChoice<, , , , , >.Choice4Of6@DebugTypeProxy))]
public class Choice4Of6 : FSharpChoice<T1, T2, T3, T4, T5, T6>
{
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
[CompilerGenerated]
[DebuggerNonUserCode]
internal readonly T4 item;
[CompilationMapping(SourceConstructFlags.Field, 3, 0)]
[CompilerGenerated]
[DebuggerNonUserCode]
public T4 Item
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return item;
}
}
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(FSharpChoice<, , , , , >))]
[CompilerGenerated]
[DebuggerNonUserCode]
internal Choice4Of6(T4 item)
: base(3)
{
this.item = item;
}
}
[Serializable]
[SpecialName]
[DebuggerTypeProxy(typeof(FSharpChoice<, , , , , >.Choice5Of6@DebugTypeProxy))]
public class Choice5Of6 : FSharpChoice<T1, T2, T3, T4, T5, T6>
{
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
[CompilerGenerated]
[DebuggerNonUserCode]
internal readonly T5 item;
[CompilationMapping(SourceConstructFlags.Field, 4, 0)]
[CompilerGenerated]
[DebuggerNonUserCode]
public T5 Item
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return item;
}
}
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(FSharpChoice<, , , , , >))]
[CompilerGenerated]
[DebuggerNonUserCode]
internal Choice5Of6(T5 item)
: base(4)
{
this.item = item;
}
}
[Serializable]
[SpecialName]
[DebuggerTypeProxy(typeof(FSharpChoice<, , , , , >.Choice6Of6@DebugTypeProxy))]
public class Choice6Of6 : FSharpChoice<T1, T2, T3, T4, T5, T6>
{
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
[CompilerGenerated]
[DebuggerNonUserCode]
internal readonly T6 item;
[CompilationMapping(SourceConstructFlags.Field, 5, 0)]
[CompilerGenerated]
[DebuggerNonUserCode]
public T6 Item
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return item;
}
}
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(FSharpChoice<, , , , , >))]
[CompilerGenerated]
[DebuggerNonUserCode]
internal Choice6Of6(T6 item)
: base(5)
{
this.item = item;
}
}
[SpecialName]
internal class Choice1Of6@DebugTypeProxy
{
[CompilationMapping(SourceConstructFlags.Field, 0, 0)]
[CompilerGenerated]
[DebuggerNonUserCode]
public T1 Item
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return _obj.item;
}
}
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(FSharpChoice<, , , , , >))]
[CompilerGenerated]
[DebuggerNonUserCode]
public Choice1Of6@DebugTypeProxy(Choice1Of6 obj)
{
_obj = obj;
}
}
[SpecialName]
internal class Choice2Of6@DebugTypeProxy
{
[CompilationMapping(SourceConstructFlags.Field, 1, 0)]
[CompilerGenerated]
[DebuggerNonUserCode]
public T2 Item
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return _obj.item;
}
}
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(FSharpChoice<, , , , , >))]
[CompilerGenerated]
[DebuggerNonUserCode]
public Choice2Of6@DebugTypeProxy(Choice2Of6 obj)
{
_obj = obj;
}
}
[SpecialName]
internal class Choice3Of6@DebugTypeProxy
{
[CompilationMapping(SourceConstructFlags.Field, 2, 0)]
[CompilerGenerated]
[DebuggerNonUserCode]
public T3 Item
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return _obj.item;
}
}
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(FSharpChoice<, , , , , >))]
[CompilerGenerated]
[DebuggerNonUserCode]
public Choice3Of6@DebugTypeProxy(Choice3Of6 obj)
{
_obj = obj;
}
}
[SpecialName]
internal class Choice4Of6@DebugTypeProxy
{
[CompilationMapping(SourceConstructFlags.Field, 3, 0)]
[CompilerGenerated]
[DebuggerNonUserCode]
public T4 Item
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return _obj.item;
}
}
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(FSharpChoice<, , , , , >))]
[CompilerGenerated]
[DebuggerNonUserCode]
public Choice4Of6@DebugTypeProxy(Choice4Of6 obj)
{
_obj = obj;
}
}
[SpecialName]
internal class Choice5Of6@DebugTypeProxy
{
[CompilationMapping(SourceConstructFlags.Field, 4, 0)]
[CompilerGenerated]
[DebuggerNonUserCode]
public T5 Item
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return _obj.item;
}
}
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(FSharpChoice<, , , , , >))]
[CompilerGenerated]
[DebuggerNonUserCode]
public Choice5Of6@DebugTypeProxy(Choice5Of6 obj)
{
_obj = obj;
}
}
[SpecialName]
internal class Choice6Of6@DebugTypeProxy
{
[CompilationMapping(SourceConstructFlags.Field, 5, 0)]
[CompilerGenerated]
[DebuggerNonUserCode]
public T6 Item
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return _obj.item;
}
}
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(FSharpChoice<, , , , , >))]
[CompilerGenerated]
[DebuggerNonUserCode]
public Choice6Of6@DebugTypeProxy(Choice6Of6 obj)
{
_obj = obj;
}
}
[CompilerGenerated]
[DebuggerNonUserCode]
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
public int Tag
{
[DebuggerNonUserCode]
get;
}
[CompilerGenerated]
[DebuggerNonUserCode]
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
public bool IsChoice1Of6
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return Tag == 0;
}
}
[CompilerGenerated]
[DebuggerNonUserCode]
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
public bool IsChoice2Of6
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return Tag == 1;
}
}
[CompilerGenerated]
[DebuggerNonUserCode]
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
public bool IsChoice3Of6
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return Tag == 2;
}
}
[CompilerGenerated]
[DebuggerNonUserCode]
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
public bool IsChoice4Of6
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return Tag == 3;
}
}
[CompilerGenerated]
[DebuggerNonUserCode]
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
public bool IsChoice5Of6
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return Tag == 4;
}
}
[CompilerGenerated]
[DebuggerNonUserCode]
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
public bool IsChoice6Of6
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return Tag == 5;
}
}
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicNestedTypes | DynamicallyAccessedMemberTypes.NonPublicNestedTypes | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(FSharpChoice<, , , , , >))]
[CompilerGenerated]
[DebuggerNonUserCode]
internal FSharpChoice(int _tag)
{
this._tag = _tag;
}
[CompilationMapping(SourceConstructFlags.UnionCase, 0)]
public static FSharpChoice<T1, T2, T3, T4, T5, T6> NewChoice1Of6(T1 item)
{
return new Choice1Of6(item);
}
[CompilationMapping(SourceConstructFlags.UnionCase, 1)]
public static FSharpChoice<T1, T2, T3, T4, T5, T6> NewChoice2Of6(T2 item)
{
return new Choice2Of6(item);
}
[CompilationMapping(SourceConstructFlags.UnionCase, 2)]
public static FSharpChoice<T1, T2, T3, T4, T5, T6> NewChoice3Of6(T3 item)
{
return new Choice3Of6(item);
}
[CompilationMapping(SourceConstructFlags.UnionCase, 3)]
public static FSharpChoice<T1, T2, T3, T4, T5, T6> NewChoice4Of6(T4 item)
{
return new Choice4Of6(item);
}
[CompilationMapping(SourceConstructFlags.UnionCase, 4)]
public static FSharpChoice<T1, T2, T3, T4, T5, T6> NewChoice5Of6(T5 item)
{
return new Choice5Of6(item);
}
[CompilationMapping(SourceConstructFlags.UnionCase, 5)]
public static FSharpChoice<T1, T2, T3, T4, T5, T6> NewChoice6Of6(T6 item)
{
return new Choice6Of6(item);
}
[CompilerGenerated]
public virtual sealed int CompareTo(FSharpChoice<T1, T2, T3, T4, T5, T6> obj)
{
if (this != null)
{
if (obj != null)
{
int tag = _tag;
int tag2 = obj._tag;
if (tag == tag2)
{
return $Prim-types.CompareTo$cont@3732-2(this, obj, null);
}
return tag - tag2;
}
return 1;
}
if (obj != null)
{
return -1;
}
return 0;
}
[CompilerGenerated]
public virtual sealed int CompareTo(object obj)
{
return CompareTo((FSharpChoice<T1, T2, T3, T4, T5, T6>)obj);
}
[CompilerGenerated]
public virtual sealed int CompareTo(object obj, IComparer comp)
{
FSharpChoice<T1, T2, T3, T4, T5, T6> objTemp = (FSharpChoice<T1, T2, T3, T4, T5, T6>)obj;
if (this != null)
{
if ((FSharpChoice<T1, T2, T3, T4, T5, T6>)obj != null)
{
return $Prim-types.CompareTo$cont@3732-3(comp, this, objTemp, null);
}
return 1;
}
if ((FSharpChoice<T1, T2, T3, T4, T5, T6>)obj != null)
{
return -1;
}
return 0;
}
[CompilerGenerated]
public virtual sealed int GetHashCode(IEqualityComparer comp)
{
if (this != null)
{
return $Prim-types.GetHashCode$cont@3732(comp, this, null);
}
return 0;
}
[CompilerGenerated]
public sealed override int GetHashCode()
{
return GetHashCode(LanguagePrimitives.GenericEqualityComparer);
}
[CompilerGenerated]
public bool Equals(FSharpChoice<T1, T2, T3, T4, T5, T6> obj, IEqualityComparer comp)
{
if (this != null)
{
if (obj != null)
{
return $Prim-types.Equals$cont@3732-1(this, obj, comp, null);
}
return false;
}
return obj == null;
}
[CompilerGenerated]
public virtual sealed bool Equals(object obj, IEqualityComparer comp)
{
if (obj is FSharpChoice<T1, T2, T3, T4, T5, T6> obj2)
{
return Equals(obj2, comp);
}
return false;
}
[CompilerGenerated]
public virtual sealed bool Equals(FSharpChoice<T1, T2, T3, T4, T5, T6> obj)
{
if (this != null)
{
if (obj != null)
{
return $Prim-types.Equals$cont@3732-2(this, obj, null);
}
return false;
}
return obj == null;
}
[CompilerGenerated]
public sealed override bool Equals(object obj)
{
if (obj is FSharpChoice<T1, T2, T3, T4, T5, T6> obj2)
{
return Equals(obj2);
}
return false;
}
}
[Serializable]
[StructLayout(LayoutKind.Auto, CharSet = CharSet.Auto)]
[StructuralEquality]
[StructuralComparison]
[CompiledName("FSharpChoice`7")]
[CompilationMapping(SourceConstructFlags.SumType)]
public abstract class FSharpChoice<T1, T2, T3, T4, T5, T6, T7> : IEquatable<FSharpChoice<T1, T2, T3, T4, T5, T6, T7>>, IStructuralEquatable, IComparable<FSharpChoice<T1, T2, T3, T4, T5, T6, T7>>, IComparable, IStructuralComparable
{
public static class Tags
{
public const int Choice1Of7 = 0;
public const int Choice2Of7 = 1;
public const int Choice3Of7 = 2;
public const int Choice4Of7 = 3;
public const int Choice5Of7 = 4;
public const int Choice6Of7 = 5;
public const int Choice7Of7 = 6;
}
[Serializable]
[SpecialName]
[DebuggerTypeProxy(typeof(FSharpChoice<, , , , , , >.Choice1Of7@DebugTypeProxy))]
public class Choice1Of7 : FSharpChoice<T1, T2, T3, T4, T5, T6, T7>
{
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
[CompilerGenerated]
[DebuggerNonUserCode]
internal readonly T1 item;
[CompilationMapping(SourceConstructFlags.Field, 0, 0)]
[CompilerGenerated]
[DebuggerNonUserCode]
public T1 Item
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return item;
}
}
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(FSharpChoice<, , , , , , >))]
[CompilerGenerated]
[DebuggerNonUserCode]
internal Choice1Of7(T1 item)
: base(0)
{
this.item = item;
}
}
[Serializable]
[SpecialName]
[DebuggerTypeProxy(typeof(FSharpChoice<, , , , , , >.Choice2Of7@DebugTypeProxy))]
public class Choice2Of7 : FSharpChoice<T1, T2, T3, T4, T5, T6, T7>
{
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
[CompilerGenerated]
[DebuggerNonUserCode]
internal readonly T2 item;
[CompilationMapping(SourceConstructFlags.Field, 1, 0)]
[CompilerGenerated]
[DebuggerNonUserCode]
public T2 Item
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return item;
}
}
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(FSharpChoice<, , , , , , >))]
[CompilerGenerated]
[DebuggerNonUserCode]
internal Choice2Of7(T2 item)
: base(1)
{
this.item = item;
}
}
[Serializable]
[SpecialName]
[DebuggerTypeProxy(typeof(FSharpChoice<, , , , , , >.Choice3Of7@DebugTypeProxy))]
public class Choice3Of7 : FSharpChoice<T1, T2, T3, T4, T5, T6, T7>
{
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
[CompilerGenerated]
[DebuggerNonUserCode]
internal readonly T3 item;
[CompilationMapping(SourceConstructFlags.Field, 2, 0)]
[CompilerGenerated]
[DebuggerNonUserCode]
public T3 Item
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return item;
}
}
[DynamicDependency(DynamicallyAccessedMemberTusing System;
using System.Buffers;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Threading;
using Microsoft.CodeAnalysis;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: InternalsVisibleTo("Collections.Pooled.Tests")]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("Joel Mueller")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("Copyright (c) 2018, 2019 Joel Mueller, Dzmitry Lahoda, based on code from the .NET Foundation")]
[assembly: AssemblyDescription("Includes PooledList, PooledDictionary, PooledSet, PooledStack, and PooledQueue: based on the corresponding collections in System.Collections.Generic, but using ArrayPool internally to reduce allocations, and with some API changes that allow for better compatibility with Span.")]
[assembly: AssemblyFileVersion("1.0.82")]
[assembly: AssemblyInformationalVersion("1.0.82")]
[assembly: AssemblyProduct("Collections.Pooled")]
[assembly: AssemblyTitle("Collections.Pooled")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.82.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class IsReadOnlyAttribute : Attribute
{
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class IsByRefLikeAttribute : Attribute
{
}
}
namespace Collections.Pooled
{
internal ref struct BitHelper
{
private const int IntSize = 32;
private readonly Span<int> _span;
internal BitHelper(Span<int> span, bool clear)
{
if (clear)
{
span.Clear();
}
_span = span;
}
internal void MarkBit(int bitPosition)
{
int num = bitPosition / 32;
if ((uint)num < (uint)_span.Length)
{
_span[num] |= 1 << bitPosition % 32;
}
}
internal bool IsMarked(int bitPosition)
{
int num = bitPosition / 32;
if ((uint)num < (uint)_span.Length)
{
return (_span[num] & (1 << bitPosition % 32)) != 0;
}
return false;
}
internal int FindFirstUnmarked(int startPosition = 0)
{
int num = startPosition;
int num2 = num / 32;
while ((uint)num2 < (uint)_span.Length)
{
if ((_span[num2] & (1 << num % 32)) == 0)
{
return num;
}
num2 = ++num / 32;
}
return -1;
}
internal int FindFirstMarked(int startPosition = 0)
{
int num = startPosition;
int num2 = num / 32;
while ((uint)num2 < (uint)_span.Length)
{
if ((_span[num2] & (1 << num % 32)) != 0)
{
return num;
}
num2 = ++num / 32;
}
return -1;
}
internal static int ToIntArrayLength(int n)
{
if (n <= 0)
{
return 0;
}
return (n - 1) / 32 + 1;
}
}
public enum ClearMode
{
Auto,
Always,
Never
}
internal static class HashHelpers
{
public const int HashCollisionThreshold = 100;
public const int MaxPrimeArrayLength = 2146435069;
public const int HashPrime = 101;
public static readonly int[] primes = new int[72]
{
3, 7, 11, 17, 23, 29, 37, 47, 59, 71,
89, 107, 131, 163, 197, 239, 293, 353, 431, 521,
631, 761, 919, 1103, 1327, 1597, 1931, 2333, 2801, 3371,
4049, 4861, 5839, 7013, 8419, 10103, 12143, 14591, 17519, 21023,
25229, 30293, 36353, 43627, 52361, 62851, 75431, 90523, 108631, 130363,
156437, 187751, 225307, 270371, 324449, 389357, 467237, 560689, 672827, 807403,
968897, 1162687, 1395263, 1674319, 2009191, 2411033, 2893249, 3471899, 4166287, 4999559,
5999471, 7199369
};
private static ConditionalWeakTable<object, SerializationInfo> s_serializationInfoTable;
public static ConditionalWeakTable<object, SerializationInfo> SerializationInfoTable
{
get
{
if (s_serializationInfoTable == null)
{
Interlocked.CompareExchange(ref s_serializationInfoTable, new ConditionalWeakTable<object, SerializationInfo>(), null);
}
return s_serializationInfoTable;
}
}
public static bool IsPrime(int candidate)
{
if (((uint)candidate & (true ? 1u : 0u)) != 0)
{
int num = (int)Math.Sqrt(candidate);
for (int i = 3; i <= num; i += 2)
{
if (candidate % i == 0)
{
return false;
}
}
return true;
}
return candidate == 2;
}
public static int GetPrime(int min)
{
if (min < 0)
{
throw new ArgumentException("Cannot get the next prime from a negative number.");
}
for (int i = 0; i < primes.Length; i++)
{
int num = primes[i];
if (num >= min)
{
return num;
}
}
for (int j = min | 1; j < int.MaxValue; j += 2)
{
if (IsPrime(j) && (j - 1) % 101 != 0)
{
return j;
}
}
return min;
}
public static int ExpandPrime(int oldSize)
{
int num = 2 * oldSize;
if ((uint)num > 2146435069u && 2146435069 > oldSize)
{
return 2146435069;
}
return GetPrime(num);
}
}
internal sealed class ICollectionDebugView<T>
{
private readonly ICollection<T> _collection;
[DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
public T[] Items
{
get
{
T[] array = new T[_collection.Count];
_collection.CopyTo(array, 0);
return array;
}
}
public ICollectionDebugView(ICollection<T> collection)
{
_collection = collection ?? throw new ArgumentNullException("collection");
}
}
internal sealed class IDictionaryDebugView<K, V>
{
private readonly IDictionary<K, V> _dict;
[DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
public KeyValuePair<K, V>[] Items
{
get
{
KeyValuePair<K, V>[] array = new KeyValuePair<K, V>[_dict.Count];
_dict.CopyTo(array, 0);
return array;
}
}
public IDictionaryDebugView(IDictionary<K, V> dictionary)
{
_dict = dictionary ?? throw new ArgumentNullException("dictionary");
}
}
internal sealed class DictionaryKeyCollectionDebugView<TKey, TValue>
{
private readonly ICollection<TKey> _collection;
[DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
public TKey[] Items
{
get
{
TKey[] array = new TKey[_collection.Count];
_collection.CopyTo(array, 0);
return array;
}
}
public DictionaryKeyCollectionDebugView(ICollection<TKey> collection)
{
_collection = collection ?? throw new ArgumentNullException("collection");
}
}
internal sealed class DictionaryValueCollectionDebugView<TKey, TValue>
{
private readonly ICollection<TValue> _collection;
[DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
public TValue[] Items
{
get
{
TValue[] array = new TValue[_collection.Count];
_collection.CopyTo(array, 0);
return array;
}
}
public DictionaryValueCollectionDebugView(ICollection<TValue> collection)
{
_collection = collection ?? throw new ArgumentNullException("collection");
}
}
public interface IReadOnlyPooledList<T> : IReadOnlyList<T>, IEnumerable<T>, IEnumerable, IReadOnlyCollection<T>
{
ReadOnlySpan<T> Span { get; }
}
[Serializable]
public sealed class NonRandomizedStringEqualityComparer : EqualityComparer<string>, ISerializable
{
private static readonly int s_empyStringHashCode = string.Empty.GetHashCode();
internal new static IEqualityComparer<string> Default { get; } = new NonRandomizedStringEqualityComparer();
private NonRandomizedStringEqualityComparer()
{
}
private NonRandomizedStringEqualityComparer(SerializationInfo information, StreamingContext context)
{
}
public sealed override bool Equals(string x, string y)
{
return string.Equals(x, y);
}
public sealed override int GetHashCode(string str)
{
if (str != null)
{
if (str.Length != 0)
{
return GetNonRandomizedHashCode(str);
}
return s_empyStringHashCode;
}
return 0;
}
void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
{
info.SetType(typeof(NonRandomizedStringEqualityComparer));
}
private unsafe static int GetNonRandomizedHashCode(string str)
{
ReadOnlySpan<char> readOnlySpan = str.AsSpan();
fixed (char* ptr = readOnlySpan)
{
uint num = 352654597u;
uint num2 = num;
uint* ptr2 = (uint*)ptr;
int num3 = readOnlySpan.Length;
while (num3 > 2)
{
num3 -= 4;
num = (((num << 5) | (num >> 27)) + num) ^ *ptr2;
num2 = (((num2 << 5) | (num2 >> 27)) + num2) ^ ptr2[1];
ptr2 += 2;
}
if (num3 > 0)
{
num2 = (((num2 << 5) | (num2 >> 27)) + num2) ^ *ptr2;
}
return (int)(num + num2 * 1566083941);
}
}
}
internal enum InsertionBehavior : byte
{
None,
OverwriteExisting,
ThrowOnExisting
}
[Serializable]
[DebuggerTypeProxy(typeof(IDictionaryDebugView<, >))]
[DebuggerDisplay("Count = {Count}")]
public class PooledDictionary<TKey, TValue> : IDictionary<TKey, TValue>, ICollection<KeyValuePair<TKey, TValue>>, IEnumerable<KeyValuePair<TKey, TValue>>, IEnumerable, IDictionary, ICollection, IReadOnlyDictionary<TKey, TValue>, IReadOnlyCollection<KeyValuePair<TKey, TValue>>, ISerializable, IDeserializationCallback, IDisposable
{
private struct Entry
{
public int hashCode;
public int next;
public TKey key;
public TValue value;
}
public struct Enumerator : IEnumerator<KeyValuePair<TKey, TValue>>, IEnumerator, IDisposable, IDictionaryEnumerator
{
private readonly PooledDictionary<TKey, TValue> _dictionary;
private readonly int _version;
private int _index;
private KeyValuePair<TKey, TValue> _current;
private readonly int _getEnumeratorRetType;
internal const int DictEntry = 1;
internal const int KeyValuePair = 2;
public KeyValuePair<TKey, TValue> Current => _current;
object IEnumerator.Current
{
get
{
if (_index == 0 || _index == _dictionary._count + 1)
{
ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumOpCantHappen();
}
if (_getEnumeratorRetType == 1)
{
return new DictionaryEntry(_current.Key, _current.Value);
}
return new KeyValuePair<TKey, TValue>(_current.Key, _current.Value);
}
}
DictionaryEntry IDictionaryEnumerator.Entry
{
get
{
if (_index == 0 || _index == _dictionary._count + 1)
{
ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumOpCantHappen();
}
return new DictionaryEntry(_current.Key, _current.Value);
}
}
object IDictionaryEnumerator.Key
{
get
{
if (_index == 0 || _index == _dictionary._count + 1)
{
ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumOpCantHappen();
}
return _current.Key;
}
}
object IDictionaryEnumerator.Value
{
get
{
if (_index == 0 || _index == _dictionary._count + 1)
{
ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumOpCantHappen();
}
return _current.Value;
}
}
internal Enumerator(PooledDictionary<TKey, TValue> dictionary, int getEnumeratorRetType)
{
_dictionary = dictionary;
_version = dictionary._version;
_index = 0;
_getEnumeratorRetType = getEnumeratorRetType;
_current = default(KeyValuePair<TKey, TValue>);
}
public bool MoveNext()
{
if (_version != _dictionary._version)
{
ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumFailedVersion();
}
while ((uint)_index < (uint)_dictionary._count)
{
ref Entry reference = ref _dictionary._entries[_index++];
if (reference.hashCode >= 0)
{
_current = new KeyValuePair<TKey, TValue>(reference.key, reference.value);
return true;
}
}
_index = _dictionary._count + 1;
_current = default(KeyValuePair<TKey, TValue>);
return false;
}
public void Dispose()
{
}
void IEnumerator.Reset()
{
if (_version != _dictionary._version)
{
ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumFailedVersion();
}
_index = 0;
_current = default(KeyValuePair<TKey, TValue>);
}
}
[DebuggerTypeProxy(typeof(DictionaryKeyCollectionDebugView<, >))]
[DebuggerDisplay("Count = {Count}")]
public sealed class KeyCollection : ICollection<TKey>, IEnumerable<TKey>, IEnumerable, ICollection, IReadOnlyCollection<TKey>
{
public struct Enumerator : IEnumerator<TKey>, IEnumerator, IDisposable
{
private readonly PooledDictionary<TKey, TValue> _dictionary;
private int _index;
private readonly int _version;
private TKey _currentKey;
public TKey Current => _currentKey;
object IEnumerator.Current
{
get
{
if (_index == 0 || _index == _dictionary._count + 1)
{
ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumOpCantHappen();
}
return _currentKey;
}
}
internal Enumerator(PooledDictionary<TKey, TValue> dictionary)
{
_dictionary = dictionary;
_version = dictionary._version;
_index = 0;
_currentKey = default(TKey);
}
public void Dispose()
{
}
public bool MoveNext()
{
if (_version != _dictionary._version)
{
ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumFailedVersion();
}
while ((uint)_index < (uint)_dictionary._count)
{
ref Entry reference = ref _dictionary._entries[_index++];
if (reference.hashCode >= 0)
{
_currentKey = reference.key;
return true;
}
}
_index = _dictionary._count + 1;
_currentKey = default(TKey);
return false;
}
void IEnumerator.Reset()
{
if (_version != _dictionary._version)
{
ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumFailedVersion();
}
_index = 0;
_currentKey = default(TKey);
}
}
private readonly PooledDictionary<TKey, TValue> _dictionary;
public int Count => _dictionary.Count;
bool ICollection<TKey>.IsReadOnly => true;
bool ICollection.IsSynchronized => false;
object ICollection.SyncRoot => ((ICollection)_dictionary).SyncRoot;
public KeyCollection(PooledDictionary<TKey, TValue> dictionary)
{
_dictionary = dictionary ?? throw new ArgumentNullException("dictionary");
}
public Enumerator GetEnumerator()
{
return new Enumerator(_dictionary);
}
public void CopyTo(TKey[] array, int index)
{
if (array == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array);
}
if (index < 0 || index > array.Length)
{
ThrowHelper.ThrowIndexArgumentOutOfRange_NeedNonNegNumException();
}
if (array.Length - index < _dictionary.Count)
{
ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_ArrayPlusOffTooSmall);
}
int count = _dictionary._count;
Entry[] entries = _dictionary._entries;
for (int i = 0; i < count; i++)
{
if (entries[i].hashCode >= 0)
{
array[index++] = entries[i].key;
}
}
}
void ICollection<TKey>.Add(TKey item)
{
ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_KeyCollectionSet);
}
void ICollection<TKey>.Clear()
{
ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_KeyCollectionSet);
}
bool ICollection<TKey>.Contains(TKey item)
{
return _dictionary.ContainsKey(item);
}
bool ICollection<TKey>.Remove(TKey item)
{
ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_KeyCollectionSet);
return false;
}
IEnumerator<TKey> IEnumerable<TKey>.GetEnumerator()
{
return new Enumerator(_dictionary);
}
IEnumerator IEnumerable.GetEnumerator()
{
return new Enumerator(_dictionary);
}
void ICollection.CopyTo(Array array, int index)
{
if (array == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array);
}
if (array.Rank != 1)
{
ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_RankMultiDimNotSupported);
}
if (array.GetLowerBound(0) != 0)
{
ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_NonZeroLowerBound);
}
if ((uint)index > (uint)array.Length)
{
ThrowHelper.ThrowIndexArgumentOutOfRange_NeedNonNegNumException();
}
if (array.Length - index < _dictionary.Count)
{
ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_ArrayPlusOffTooSmall);
}
if (array is TKey[] array2)
{
CopyTo(array2, index);
return;
}
object[] array3 = array as object[];
if (array3 == null)
{
ThrowHelper.ThrowArgumentException_Argument_InvalidArrayType();
}
int count = _dictionary._count;
Entry[] entries = _dictionary._entries;
try
{
for (int i = 0; i < count; i++)
{
if (entries[i].hashCode >= 0)
{
array3[index++] = entries[i].key;
}
}
}
catch (ArrayTypeMismatchException)
{
ThrowHelper.ThrowArgumentException_Argument_InvalidArrayType();
}
}
}
[DebuggerTypeProxy(typeof(DictionaryValueCollectionDebugView<, >))]
[DebuggerDisplay("Count = {Count}")]
public sealed class ValueCollection : ICollection<TValue>, IEnumerable<TValue>, IEnumerable, ICollection, IReadOnlyCollection<TValue>
{
public struct Enumerator : IEnumerator<TValue>, IEnumerator, IDisposable
{
private readonly PooledDictionary<TKey, TValue> _dictionary;
private int _index;
private readonly int _version;
private TValue _currentValue;
public TValue Current => _currentValue;
object IEnumerator.Current
{
get
{
if (_index == 0 || _index == _dictionary._count + 1)
{
ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumOpCantHappen();
}
return _currentValue;
}
}
internal Enumerator(PooledDictionary<TKey, TValue> dictionary)
{
_dictionary = dictionary;
_version = dictionary._version;
_index = 0;
_currentValue = default(TValue);
}
public void Dispose()
{
}
public bool MoveNext()
{
if (_version != _dictionary._version)
{
ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumFailedVersion();
}
while ((uint)_index < (uint)_dictionary._count)
{
ref Entry reference = ref _dictionary._entries[_index++];
if (reference.hashCode >= 0)
{
_currentValue = reference.value;
return true;
}
}
_index = _dictionary._count + 1;
_currentValue = default(TValue);
return false;
}
void IEnumerator.Reset()
{
if (_version != _dictionary._version)
{
ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumFailedVersion();
}
_index = 0;
_currentValue = default(TValue);
}
}
private readonly PooledDictionary<TKey, TValue> _dictionary;
public int Count => _dictionary.Count;
bool ICollection<TValue>.IsReadOnly => true;
bool ICollection.IsSynchronized => false;
object ICollection.SyncRoot => ((ICollection)_dictionary).SyncRoot;
public ValueCollection(PooledDictionary<TKey, TValue> dictionary)
{
if (dictionary == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.dictionary);
}
_dictionary = dictionary;
}
public Enumerator GetEnumerator()
{
return new Enumerator(_dictionary);
}
public void CopyTo(TValue[] array, int index)
{
if (array == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array);
}
if (index < 0 || index > array.Length)
{
ThrowHelper.ThrowIndexArgumentOutOfRange_NeedNonNegNumException();
}
if (array.Length - index < _dictionary.Count)
{
ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_ArrayPlusOffTooSmall);
}
int count = _dictionary._count;
Entry[] entries = _dictionary._entries;
for (int i = 0; i < count; i++)
{
if (entries[i].hashCode >= 0)
{
array[index++] = entries[i].value;
}
}
}
void ICollection<TValue>.Add(TValue item)
{
ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_ValueCollectionSet);
}
bool ICollection<TValue>.Remove(TValue item)
{
ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_ValueCollectionSet);
return false;
}
void ICollection<TValue>.Clear()
{
ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_ValueCollectionSet);
}
bool ICollection<TValue>.Contains(TValue item)
{
return _dictionary.ContainsValue(item);
}
IEnumerator<TValue> IEnumerable<TValue>.GetEnumerator()
{
return new Enumerator(_dictionary);
}
IEnumerator IEnumerable.GetEnumerator()
{
return new Enumerator(_dictionary);
}
void ICollection.CopyTo(Array array, int index)
{
if (array == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array);
}
if (array.Rank != 1)
{
ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_RankMultiDimNotSupported);
}
if (array.GetLowerBound(0) != 0)
{
ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_NonZeroLowerBound);
}
if ((uint)index > (uint)array.Length)
{
ThrowHelper.ThrowIndexArgumentOutOfRange_NeedNonNegNumException();
}
if (array.Length - index < _dictionary.Count)
{
ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_ArrayPlusOffTooSmall);
}
if (array is TValue[] array2)
{
CopyTo(array2, index);
return;
}
if (array is object[] array3)
{
int count = _dictionary._count;
Entry[] entries = _dictionary._entries;
try
{
for (int i = 0; i < count; i++)
{
if (entries[i].hashCode >= 0)
{
array3[index++] = entries[i].value;
}
}
return;
}
catch (ArrayTypeMismatchException)
{
ThrowHelper.ThrowArgumentException_Argument_InvalidArrayType();
return;
}
}
ThrowHelper.ThrowArgumentException_Argument_InvalidArrayType();
}
}
private const int Lower31BitMask = int.MaxValue;
private const string VersionName = "Version";
private const string HashSizeName = "HashSize";
private const string KeyValuePairsName = "KeyValuePairs";
private const string ComparerName = "Comparer";
private const string ClearKeyName = "CK";
private const string ClearValueName = "CV";
private static readonly ArrayPool<int> s_bucketPool = ArrayPool<int>.Shared;
private static readonly ArrayPool<Entry> s_entryPool = ArrayPool<Entry>.Shared;
private int[] _buckets;
private Entry[] _entries;
private int _size;
private int _count;
private int _freeList;
private int _freeCount;
private int _version;
private IEqualityComparer<TKey> _comparer;
private KeyCollection _keys;
private ValueCollection _values;
private object _syncRoot;
private readonly bool _clearKeyOnFree;
private readonly bool _clearValueOnFree;
public IEqualityComparer<TKey> Comparer
{
get
{
if (_comparer != null && !(_comparer is NonRandomizedStringEqualityComparer))
{
return _comparer;
}
return EqualityComparer<TKey>.Default;
}
}
public int Count => _count - _freeCount;
public ClearMode KeyClearMode
{
get
{
if (!_clearKeyOnFree)
{
return ClearMode.Never;
}
return ClearMode.Always;
}
}
public ClearMode ValueClearMode
{
get
{
if (!_clearValueOnFree)
{
return ClearMode.Never;
}
return ClearMode.Always;
}
}
public KeyCollection Keys
{
get
{
if (_keys == null)
{
_keys = new KeyCollection(this);
}
return _keys;
}
}
ICollection<TKey> IDictionary<TKey, TValue>.Keys
{
get
{
if (_keys == null)
{
_keys = new KeyCollection(this);
}
return _keys;
}
}
IEnumerable<TKey> IReadOnlyDictionary<TKey, TValue>.Keys
{
get
{
if (_keys == null)
{
_keys = new KeyCollection(this);
}
return _keys;
}
}
public ValueCollection Values
{
get
{
if (_values == null)
{
_values = new ValueCollection(this);
}
return _values;
}
}
ICollection<TValue> IDictionary<TKey, TValue>.Values
{
get
{
if (_values == null)
{
_values = new ValueCollection(this);
}
return _values;
}
}
IEnumerable<TValue> IReadOnlyDictionary<TKey, TValue>.Values
{
get
{
if (_values == null)
{
_values = new ValueCollection(this);
}
return _values;
}
}
public TValue this[TKey key]
{
get
{
int num = FindEntry(key);
if (num >= 0)
{
return _entries[num].value;
}
ThrowHelper.ThrowKeyNotFoundException(key);
return default(TValue);
}
set
{
TryInsert(key, value, InsertionBehavior.OverwriteExisting);
}
}
bool ICollection<KeyValuePair<TKey, TValue>>.IsReadOnly => false;
bool ICollection.IsSynchronized => false;
object ICollection.SyncRoot
{
get
{
if (_syncRoot == null)
{
Interlocked.CompareExchange<object>(ref _syncRoot, new object(), (object)null);
}
return _syncRoot;
}
}
bool IDictionary.IsFixedSize => false;
bool IDictionary.IsReadOnly => false;
ICollection IDictionary.Keys => Keys;
ICollection IDictionary.Values => Values;
object IDictionary.this[object key]
{
get
{
if (IsCompatibleKey(key))
{
int num = FindEntry((TKey)key);
if (num >= 0)
{
return _entries[num].value;
}
}
return null;
}
set
{
if (key == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.key);
}
ThrowHelper.IfNullAndNullsAreIllegalThenThrow<TValue>(value, ExceptionArgument.value);
try
{
TKey key2 = (TKey)key;
try
{
this[key2] = (TValue)value;
}
catch (InvalidCastException)
{
ThrowHelper.ThrowWrongValueTypeArgumentException(value, typeof(TValue));
}
}
catch (InvalidCastException)
{
ThrowHelper.ThrowWrongKeyTypeArgumentException(key, typeof(TKey));
}
}
}
public PooledDictionary()
: this(0, ClearMode.Auto, (IEqualityComparer<TKey>)null)
{
}
public PooledDictionary(ClearMode clearMode)
: this(0, clearMode, (IEqualityComparer<TKey>)null)
{
}
public PooledDictionary(int capacity)
: this(capacity, ClearMode.Auto, (IEqualityComparer<TKey>)null)
{
}
public PooledDictionary(int capacity, ClearMode clearMode)
: this(capacity, clearMode, (IEqualityComparer<TKey>)null)
{
}
public PooledDictionary(IEqualityComparer<TKey> comparer)
: this(0, ClearMode.Auto, comparer)
{
}
public PooledDictionary(int capacity, IEqualityComparer<TKey> comparer)
: this(capacity, ClearMode.Auto, comparer)
{
}
public PooledDictionary(ClearMode clearMode, IEqualityComparer<TKey> comparer)
: this(0, clearMode, comparer)
{
}
public PooledDictionary(int capacity, ClearMode clearMode, IEqualityComparer<TKey> comparer)
{
if (capacity < 0)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.capacity);
}
if (capacity > 0)
{
Initialize(capacity);
}
if (comparer != EqualityComparer<TKey>.Default)
{
_comparer = comparer;
}
_clearKeyOnFree = ShouldClearKey(clearMode);
_clearValueOnFree = ShouldClearValue(clearMode);
if (typeof(TKey) == typeof(string) && _comparer == null)
{
_comparer = (IEqualityComparer<TKey>)NonRandomizedStringEqualityComparer.Default;
}
}
public PooledDictionary(IDictionary<TKey, TValue> dictionary)
: this(dictionary, ClearMode.Auto, (IEqualityComparer<TKey>)null)
{
}
public PooledDictionary(IDictionary<TKey, TValue> dictionary, ClearMode clearMode)
: this(dictionary, clearMode, (IEqualityComparer<TKey>)null)
{
}
public PooledDictionary(IDictionary<TKey, TValue> dictionary, IEqualityComparer<TKey> comparer)
: this(dictionary, ClearMode.Auto, comparer)
{
}
public PooledDictionary(IDictionary<TKey, TValue> dictionary, ClearMode clearMode, IEqualityComparer<TKey> comparer)
: this(dictionary?.Count ?? 0, clearMode, comparer)
{
if (dictionary == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.dictionary);
}
if (dictionary is PooledDictionary<TKey, TValue> pooledDictionary)
{
int count = pooledDictionary._count;
Entry[] entries = pooledDictionary._entries;
for (int i = 0; i < count; i++)
{
if (entries[i].hashCode >= 0)
{
TryInsert(entries[i].key, entries[i].value, InsertionBehavior.ThrowOnExisting);
}
}
return;
}
foreach (KeyValuePair<TKey, TValue> item in dictionary)
{
TryInsert(item.Key, item.Value, InsertionBehavior.ThrowOnExisting);
}
}
public PooledDictionary(IEnumerable<KeyValuePair<TKey, TValue>> collection)
: this(collection, ClearMode.Auto, (IEqualityComparer<TKey>)null)
{
}
public PooledDictionary(IEnumerable<KeyValuePair<TKey, TValue>> collection, ClearMode clearMode)
: this(collection, clearMode, (IEqualityComparer<TKey>)null)
{
}
public PooledDictionary(IEnumerable<KeyValuePair<TKey, TValue>> collection, IEqualityComparer<TKey> comparer)
: this(collection, ClearMode.Auto, comparer)
{
}
public PooledDictionary(IEnumerable<KeyValuePair<TKey, TValue>> collection, ClearMode clearMode, IEqualityComparer<TKey> comparer)
: this((collection as ICollection<KeyValuePair<TKey, TValue>>)?.Count ?? 0, clearMode, comparer)
{
if (collection == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.collection);
}
foreach (KeyValuePair<TKey, TValue> item in collection)
{
TryInsert(item.Key, item.Value, InsertionBehavior.ThrowOnExisting);
}
}
public PooledDictionary(IEnumerable<(TKey key, TValue value)> collection)
: this(collection, ClearMode.Auto, (IEqualityComparer<TKey>)null)
{
}
public PooledDictionary(IEnumerable<(TKey key, TValue value)> collection, ClearMode clearMode)
: this(collection, clearMode, (IEqualityComparer<TKey>)null)
{
}
public PooledDictionary(IEnumerable<(TKey key, TValue value)> collection, IEqualityComparer<TKey> comparer)
: this(collection, ClearMode.Auto, comparer)
{
}
public PooledDictionary(IEnumerable<(TKey key, TValue value)> collection, ClearMode clearMode, IEqualityComparer<TKey> comparer)
: this((collection as ICollection<(TKey, TValue)>)?.Count ?? 0, clearMode, comparer)
{
if (collection == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.collection);
}
foreach (var (key, value) in collection)
{
TryInsert(key, value, InsertionBehavior.ThrowOnExisting);
}
}
public PooledDictionary((TKey key, TValue value)[] array)
: this((ReadOnlySpan<(TKey, TValue)>)array.AsSpan(), ClearMode.Auto, (IEqualityComparer<TKey>)null)
{
}
public PooledDictionary((TKey key, TValue value)[] array, ClearMode clearMode)
: this((ReadOnlySpan<(TKey, TValue)>)array.AsSpan(), clearMode, (IEqualityComparer<TKey>)null)
{
}
public PooledDictionary((TKey key, TValue value)[] array, IEqualityComparer<TKey> comparer)
: this((ReadOnlySpan<(TKey, TValue)>)array.AsSpan(), ClearMode.Auto, comparer)
{
}
public PooledDictionary((TKey key, TValue value)[] array, ClearMode clearMode, IEqualityComparer<TKey> comparer)
: this((ReadOnlySpan<(TKey, TValue)>)array.AsSpan(), clearMode, comparer)
{
}
public PooledDictionary(ReadOnlySpan<(TKey key, TValue value)> span)
: this(span, ClearMode.Auto, (IEqualityComparer<TKey>)null)
{
}
public PooledDictionary(ReadOnlySpan<(TKey key, TValue value)> span, ClearMode clearMode)
: this(span, clearMode, (IEqualityComparer<TKey>)null)
{
}
public PooledDictionary(ReadOnlySpan<(TKey key, TValue value)> span, IEqualityComparer<TKey> comparer)
: this(span, ClearMode.Auto, comparer)
{
}
public PooledDictionary(ReadOnlySpan<(TKey key, TValue value)> span, ClearMode clearMode, IEqualityComparer<TKey> comparer)
: this(span.Length, clearMode, comparer)
{
ReadOnlySpan<(TKey, TValue)> readOnlySpan = span;
for (int i = 0; i < readOnlySpan.Length; i++)
{
var (key, value) = readOnlySpan[i];
TryInsert(key, value, InsertionBehavior.ThrowOnExisting);
}
}
protected PooledDictionary(SerializationInfo info, StreamingContext context)
{
_clearKeyOnFree = ((bool?)info.GetValue("CK", typeof(bool))) ?? ShouldClearKey(ClearMode.Auto);
_clearValueOnFree = ((bool?)info.GetValue("CV", typeof(bool))) ?? ShouldClearValue(ClearMode.Auto);
HashHelpers.SerializationInfoTable.Add(this, info);
}
public void Add(TKey key, TValue value)
{
TryInsert(key, value, InsertionBehavior.ThrowOnExisting);
}
public void AddRange(IEnumerable<KeyValuePair<TKey, TValue>> enumerable)
{
if (enumerable == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.enumerable);
}
if (enumerable is ICollection<KeyValuePair<TKey, TValue>> collection)
{
EnsureCapacity(_count + collection.Count);
}
foreach (KeyValuePair<TKey, TValue> item in enumerable)
{
TryInsert(item.Key, item.Value, InsertionBehavior.ThrowOnExisting);
}
}
public void AddRange(IEnumerable<(TKey key, TValue value)> enumerable)
{
if (enumerable == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.enumerable);
}
if (enumerable is ICollection<KeyValuePair<TKey, TValue>> collection)
{
EnsureCapacity(_count + collection.Count);
}
foreach (var (key, value) in enumerable)
{
TryInsert(key, value, InsertionBehavior.ThrowOnExisting);
}
}
public void AddRange(ReadOnlySpan<(TKey key, TValue value)> span)
{
EnsureCapacity(_count + span.Length);
ReadOnlySpan<(TKey, TValue)> readOnlySpan = span;
for (int i = 0; i < readOnlySpan.Length; i++)
{
var (key, value) = readOnlySpan[i];
TryInsert(key, value, InsertionBehavior.ThrowOnExisting);
}
}
public void AddRange((TKey key, TValue value)[] array)
{
AddRange(array.AsSpan());
}
public void AddOrUpdate(TKey key, TValue addValue, Func<TKey, TValue, TValue> updater)
{
if (TryGetValue(key, out var value))
{
TValue value2 = updater(key, value);
TryInsert(key, value2, InsertionBehavior.OverwriteExisting);
}
else
{
TryInsert(key, addValue, InsertionBehavior.ThrowOnExisting);
}
}
public void AddOrUpdate(TKey key, Func<TKey, TValue> addValueFactory, Func<TKey, TValue, TValue> updater)
{
if (TryGetValue(key, out var value))
{
TValue value2 = updater(key, value);
TryInsert(key, value2, InsertionBehavior.OverwriteExisting);
}
else
{
TValue value3 = addValueFactory(key);
TryInsert(key, value3, InsertionBehavior.ThrowOnExisting);
}
}
void ICollection<KeyValuePair<TKey, TValue>>.Add(KeyValuePair<TKey, TValue> keyValuePair)
{
Add(keyValuePair.Key, keyValuePair.Value);
}
bool ICollection<KeyValuePair<TKey, TValue>>.Contains(KeyValuePair<TKey, TValue> keyValuePair)
{
int num = FindEntry(keyValuePair.Key);
if (num >= 0 && EqualityComparer<TValue>.Default.Equals(_entries[num].value, keyValuePair.Value))
{
return true;
}
return false;
}
bool ICollection<KeyValuePair<TKey, TValue>>.Remove(KeyValuePair<TKey, TValue> keyValuePair)
{
int num = FindEntry(keyValuePair.Key);
if (num >= 0 && EqualityComparer<TValue>.Default.Equals(_entries[num].value, keyValuePair.Value))
{
Remove(keyValuePair.Key);
return true;
}
return false;
}
public void Clear()
{
int count = _count;
if (count > 0)
{
Array.Clear(_buckets, 0, _size);
_count = 0;
_freeList = -1;
_freeCount = 0;
_size = 0;
Array.Clear(_entries, 0, count);
_version++;
}
}
public bool ContainsKey(TKey key)
{
return FindEntry(key) >= 0;
}
public bool ContainsValue(TValue value)
{
Entry[] entries = _entries;
if (value == null)
{
for (int i = 0; i < _count; i++)
{
if (entries[i].hashCode >= 0 && entries[i].value == null)
{
return true;
}
}
}
else if (default(TValue) != null)
{
for (int j = 0; j < _count; j++)
{
if (entries[j].hashCode >= 0 && EqualityComparer<TValue>.Default.Equals(entries[j].value, value))
{
return true;
}
}
}
else
{
EqualityComparer<TValue> @default = EqualityComparer<TValue>.Default;
for (int k = 0; k < _count; k++)
{
if (entries[k].hashCode >= 0 && @default.Equals(entries[k].value, value))
{
return true;
}
}
}
return false;
}
private void CopyTo(KeyValuePair<TKey, TValue>[] array, int index)
{
if (array == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array);
}
if ((uint)index > (uint)array.Length)
{
ThrowHelper.ThrowIndexArgumentOutOfRange_NeedNonNegNumException();
}
if (array.Length - index < Count)
{
ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_ArrayPlusOffTooSmall);
}
int count = _count;
Entry[] entries = _entries;
for (int i = 0; i < count; i++)
{
if (entries[i].hashCode >= 0)
{
array[index++] = new KeyValuePair<TKey, TValue>(entries[i].key, entries[i].value);
}
}
}
public Enumerator GetEnumerator()
{
return new Enumerator(this, 2);
}
IEnumerator<KeyValuePair<TKey, TValue>> IEnumerable<KeyValuePair<TKey, TValue>>.GetEnumerator()
{
return new Enumerator(this, 2);
}
void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
{
GetObjectData(info, context);
}
protected virtual void GetObjectData(SerializationInfo info, StreamingContext context)
{
if (info == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.info);
}
info.AddValue("Version", _version);
info.AddValue("Comparer", _comparer ?? EqualityComparer<TKey>.Default, typeof(IEqualityComparer<TKey>));
info.AddValue("HashSize", _size);
info.AddValue("CK", _clearKeyOnFree);
info.AddValue("CV", _clearValueOnFree);
if (_buckets != null)
{
KeyValuePair<TKey, TValue>[] array = new KeyValuePair<TKey, TValue>[Count];
CopyTo(array, 0);
info.AddValue("KeyValuePairs", array, typeof(KeyValuePair<TKey, TValue>[]));
}
}
private int FindEntry(TKey key)
{
if (key == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.key);
}
int result = -1;
int size = _size;
if (size <= 0)
{
return result;
}
int[] buckets = _buckets;
Entry[] entries = _entries;
int num = 0;
IEqualityComparer<TKey> comparer = _comparer;
if (comparer == null)
{
int num2 = key.GetHashCode() & 0x7FFFFFFF;
result = buckets[num2 % size] - 1;
if (default(TKey) != null)
{
while ((uint)result < (uint)size && (entries[result].hashCode != num2 || !EqualityComparer<TKey>.Default.Equals(entries[result].key, key)))
{
result = entries[result].next;
if (num >= size)
{
ThrowHelper.ThrowInvalidOperationException_ConcurrentOperationsNotSupported();
}
num++;
}
}
else
{
EqualityComparer<TKey> @default = EqualityComparer<TKey>.Default;
while ((uint)result < (uint)size && (entries[result].hashCode != num2 || [email protected](entries[result].key, key)))
{
result = entries[result].next;
if (num >= size)
{
ThrowHelper.ThrowInvalidOperationException_ConcurrentOperationsNotSupported();
}
num++;
}
}
}
else
{
int num3 = comparer.GetHashCode(key) & 0x7FFFFFFF;
result = buckets[num3 % size] - 1;
while ((uint)result < (uint)size && (entries[result].hashCode != num3 || !comparer.Equals(entries[result].key, key)))
{
result = entries[result].next;
if (num >= size)
{
ThrowHelper.ThrowInvalidOperationException_ConcurrentOperationsNotSupported();
}
num++;
}
}
return result;
}
private int Initialize(int capacity)
{
_size = HashHelpers.GetPrime(capacity);
_freeList = -1;
_buckets = s_bucketPool.Rent(_size);
Array.Clear(_buckets, 0, _buckets.Length);
_entries = s_entryPool.Rent(_size);
return _size;
}
private bool TryInsert(TKey key, TValue value, InsertionBehavior behavior)
{
if (key == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.key);
}
if (_buckets == null || _size == 0)
{
Initialize(0);
}
Entry[] entries = _entries;
IEqualityComparer<TKey> comparer = _comparer;
int size = _size;
int num = (comparer?.GetHashCode(key) ?? key.GetHashCode()) & 0x7FFFFFFF;
int num2 = 0;
ref int reference = ref _buckets[num % size];
int num3 = reference - 1;
if (comparer == null)
{
if (default(TKey) != null)
{
while ((uint)num3 < (uint)size)
{
if (entries[num3].hashCode == num && EqualityComparer<TKey>.Default.Equals(entries[num3].key, key))
{
switch (behavior)
{
case InsertionBehavior.OverwriteExisting:
entries[num3].value = value;
_version++;
return true;
case InsertionBehavior.ThrowOnExisting:
ThrowHelper.ThrowAddingDuplicateWithKeyArgumentException(key);
break;
}
return false;
}
num3 = entries[num3].next;
if (num2 >= size)
{
ThrowHelper.ThrowInvalidOperationException_ConcurrentOperationsNotSupported();
}
num2++;
}
}
else
{
EqualityComparer<TKey> @default = EqualityComparer<TKey>.Default;
while ((uint)num3 < (uint)size)
{
if (entries[num3].hashCode == num && @default.Equals(entries[num3].key, key))
{
switch (behavior)
{
case InsertionBehavior.OverwriteExisting:
entries[num3].value = value;
_version++;
return true;
case InsertionBehavior.ThrowOnExisting:
ThrowHelper.ThrowAddingDuplicateWithKeyArgumentException(key);
break;
}
return false;
}
num3 = entries[num3].next;
if (num2 >= size)
{
ThrowHelper.ThrowInvalidOperationException_ConcurrentOperationsNotSupported();
}
num2++;
}
}
}
else
{
while ((uint)num3 < (uint)size)
{
if (entries[num3].hashCode == num && comparer.Equals(entries[num3].key, key))
{
switch (behavior)
{
case InsertionBehavior.OverwriteExisting:
entries[num3].value = value;
_version++;
return true;
case InsertionBehavior.ThrowOnExisting:
ThrowHelper.ThrowAddingDuplicateWithKeyArgumentException(key);
break;
}
return false;
}
num3 = entries[num3].next;
if (num2 >= size)
{
ThrowHelper.ThrowInvalidOperationException_ConcurrentOperationsNotSupported();
}
num2++;
}
}
bool flag = false;
int num4;
if (_freeCount > 0)
{
num4 = _freeList;
flag = true;
_freeCount--;
}
else
{
int count = _count;
if (count == size)
{
Resize();
size = _size;
reference = ref _buckets[num % size];
}
num4 = count;
_count = count + 1;
entries = _entries;
}
ref Entry reference2 = ref entries[num4];
if (flag)
{
_freeList = reference2.next;
}
reference2.hashCode = num;
reference2.next = reference - 1;
reference2.key = key;
reference2.value = value;
reference = num4 + 1;
_version++;
if (default(TKey) == null && num2 > 100 && comparer is NonRandomizedStringEqualityComparer)
{
_comparer = null;
Resize(size, forceNewHashCodes: true);
}
return true;
}
public virtual void OnDeserialization(object sender)
{
HashHelpers.SerializationInfoTable.TryGetValue(this, out var value);
if (value == null)
{
return;
}
int @int = value.GetInt32("Version");
int int2 = value.GetInt32("HashSize");
_comparer = (IEqualityComparer<TKey>)value.GetValue("Comparer", typeof(IEqualityComparer<TKey>));
if (int2 != 0)
{
Initialize(int2);
KeyValuePair<TKey, TValue>[] array = (KeyValuePair<TKey, TValue>[])value.GetValue("KeyValuePairs", typeof(KeyValuePair<TKey, TValue>[]));
if (array == null)
{
throw new SerializationException("Serialized PooledDictionary missing data.");
}
for (int i = 0; i < array.Length; i++)
{
if (array[i].Key == null)
{
throw new SerializationException("Serialized PooledDictionary had null key.");
}
Add(array[i].Key, array[i].Value);
}
}
else
{
_buckets = null;
}
_version = @int;
HashHelpers.SerializationInfoTable.Remove(this);
}
private void Resize()
{
Resize(HashHelpers.ExpandPrime(_count), forceNewHashCodes: false);
}
private void Resize(int newSize, bool forceNewHashCodes)
{
int count = _count;
int[] array;
Entry[] array2;
bool flag;
if (_buckets.Length >= newSize && _entries.Length >= newSize)
{
Array.Clear(_buckets, 0, _buckets.Length);
Array.Clear(_entries, _size, newSize - _size);
array = _buckets;
array2 = _entries;
flag = false;
}
else
{
array = s_bucketPool.Rent(newSize);
array2 = s_entryPool.Rent(newSize);
Array.Clear(array, 0, array.Length);
Array.Copy(_entries, 0, array2, 0, count);
flag = true;
}
if (default(TKey) == null && forceNewHashCodes)
{
for (int i = 0; i < count; i++)
{
if (array2[i].hashCode >= 0)
{
array2[i].hashCode = array2[i].key.GetHashCode() & 0x7FFFFFFF;
}
}
}
for (int j = 0; j < count; j++)
{
if (array2[j].hashCode >= 0)
{
int num = array2[j].hashCode % newSize;
array2[j].next = array[num] - 1;
array[num] = j + 1;
}
}
if (flag)
{
ReturnArrays();
_buckets = array;
_entries = array2;
}
_size = newSize;
}
public bool Remove(TKey key)
{
if (key == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.key);
}
int[] buckets = _buckets;
Entry[] entries = _entries;
int num = 0;
if (_size > 0)
{
int num2 = (_comparer?.GetHashCode(key) ?? key.GetHashCode()) & 0x7FFFFFFF;
int num3 = num2 % _size;
int num4 = -1;
int num5 = buckets[num3] - 1;
while (num5 >= 0)
{
ref Entry reference = ref entries[num5];
if (reference.hashCode == num2 && (_comparer?.Equals(reference.key, key) ?? EqualityComparer<TKey>.Default.Equals(reference.key, key)))
{
if (num4 < 0)
{
buckets[num3] = reference.next + 1;
}
else
{
entries[num4].next = reference.next;
}
reference.hashCode = -1;
reference.next = _freeList;
if (_clearKeyOnFree)
{
reference.key = default(TKey);
}
if (_clearValueOnFree)
{
reference.value = default(TValue);
}
_freeList = num5;
_freeCount++;
_version++;
return true;
}
num4 = num5;
num5 = reference.next;
if (num >= _size)
{
ThrowHelper.ThrowInvalidOperationException_ConcurrentOperationsNotSupported();
}
num++;
}
}
return false;
}
public bool Remove(TKey key, out TValue value)
{
if (key == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.key);
}
int[] buckets = _buckets;
Entry[] entries = _entries;
int num = 0;
int num2 = (_comparer?.GetHashCode(key) ?? key.GetHashCode()) & 0x7FFFFFFF;
int num3 = num2 % _size;
int num4 = -1;
int num5 = buckets[num3] - 1;
while (num5 >= 0)
{
ref Entry reference = ref entries[num5];
if (reference.hashCode == num2 && (_comparer?.Equals(reference.key, key) ?? EqualityComparer<TKey>.Default.Equals(reference.key, key)))
{
if (num4 < 0)
{
buckets[num3] = reference.next + 1;
}
else
{
entries[num4].next = reference.next;
}
value = reference.value;
reference.hashCode = -1;
reference.next = _freeList;
if (_clearKeyOnFree)
{
reference.key = default(TKey);
}
if (_clearValueOnFree)
{
reference.value = default(TValue);
}
_freeList = num5;
_freeCount++;
return true;
}
num4 = num5;
num5 = reference.next;
if (num >= _size)
{
ThrowHelper.ThrowInvalidOperationException_ConcurrentOperationsNotSupported();
}
num++;
}
value = default(TValue);
return false;
}
public bool TryGetValue(TKey key, out TValue value)
{
int num = FindEntry(key);
if (num >= 0)
{
value = _entries[num].value;
return true;
}
value = default(TValue);
return false;
}
public bool TryAdd(TKey key, TValue value)
{
return TryInsert(key, value, InsertionBehavior.None);
}
public TValue GetOrAdd(TKey key, TValue addValue)
{
if (TryGetValue(key, out var value))
{
return value;
}
Add(key, addValue);
return addValue;
}
public TValue GetOrAdd(TKey key, Func<TKey, TValue> valueFactory)
{
if (TryGetValue(key, out var value))
{
return value;
}
TValue val = valueFactory(key);
Add(key, val);
return val;
}
void ICollection<KeyValuePair<TKey, TValue>>.CopyTo(KeyValuePair<TKey, TValue>[] array, int index)
{
CopyTo(array, index);
}
void ICollection.CopyTo(Array array, int index)
{
if (array == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array);
}
if (array.Rank != 1)
{
ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_RankMultiDimNotSupported);
}
if (array.GetLowerBound(0) != 0)
{
ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_NonZeroLowerBound);
}
if ((uint)index > (uint)array.Length)
{
ThrowHelper.ThrowIndexArgumentOutOfRange_NeedNonNegNumException();
}
if (array.Length - index < Count)
{
ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_ArrayPlusOffTooSmall);
}
if (array is KeyValuePair<TKey, TValue>[] array2)
{
CopyTo(array2, index);
return;
}
if (array is DictionaryEntry[] array3)
{
Entry[] entries = _entries;
for (int i = 0; i < _count; i++)
{
if (entries[i].hashCode >= 0)
{
array3[index++] = new DictionaryEntry(entries[i].key, entries[i].value);
}
}
return;
}
if (array is object[] array4)
{
try
{
int count = _count;
Entry[] entries2 = _entries;
for (int j = 0; j < count; j++)
{
if (entries2[j].hashCode >= 0)
{
array4[index++] = new KeyValuePair<TKey, TValue>(entries2[j].key, entries2[j].value);
}
}
return;
}
catch (ArrayTypeMismatchException)
{
ThrowHelper.ThrowArgumentException_Argument_InvalidArrayType();
return;
}
}
ThrowHelper.ThrowArgumentException_Argument_InvalidArrayType();
}
IEnumerator IEnumerable.GetEnumerator()
{
return new Enumerator(this, 2);
}
public int EnsureCapacity(int capacity)
{
if (capacity < 0)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.capacity);
}
int size = _size;
if (size >= capacity)
{
return size;
}
_version++;
if (_buckets == null || _size == 0)
{
return Initialize(capacity);
}
int prime = HashHelpers.GetPrime(capacity);
Resize(prime, forceNewHashCodes: false);
return prime;
}
public void TrimExcess()
{
TrimExcess(Count);
}
public void TrimExcess(int capacity)
{
if (capacity < Count)
{
throw new ArgumentOutOfRangeException("capacity");
}
int prime = HashHelpers.GetPrime(capacity);
Entry[] entries = _entries;
int[] buckets = _buckets;
int num = ((entries != null) ? entries.Length : 0);
if (prime >= num)
{
return;
}
int count = _count;
_version++;
Initialize(prime);
Entry[] entries2 = _entries;
int[] buckets2 = _buckets;
int num2 = 0;
for (int i = 0; i < count; i++)
{
int hashCode = entries[i].hashCode;
if (hashCode >= 0)
{
ref Entry reference = ref entries2[num2];
reference = entries[i];
int num3 = hashCode % prime;
reference.next = buckets2[num3] - 1;
buckets2[num3] = num2 + 1;
num2++;
}
}
_count = num2;
_size = prime;
_freeCount = 0;
s_bucketPool.Return(buckets);
s_entryPool.Return(entries2, _clearKeyOnFree || _clearValueOnFree);
}
private void ReturnArrays()
{
Entry[] entries = _entries;
if (entries != null && entries.Length != 0)
{
try
{
s_entryPool.Return(_entries, _clearKeyOnFree || _clearValueOnFree);
}
catch (ArgumentException)
{
}
}
int[] buckets = _buckets;
if (buckets != null && buckets.Length != 0)
{
try
{
s_bucketPool.Return(_buckets);
}
catch (ArgumentException)
{
}
}
_entries = null;
_buckets = null;
}
private static bool ShouldClearKey(ClearMode mode)
{
return mode != ClearMode.Never;
}
private static bool ShouldClearValue(ClearMode mode)
{
return mode != ClearMode.Never;
}
private static bool IsCompatibleKey(object key)
{
if (key == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.key);
}
return key is TKey;
}
void IDictionary.Add(object key, object value)
{
if (key == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.key);
}
ThrowHelper.IfNullAndNullsAreIllegalThenThrow<TValue>(value, ExceptionArgument.value);
try
{
TKey key2 = (TKey)key;
try
{
Add(key2, (TValue)value);
}
catch (InvalidCastException)
{
ThrowHelper.ThrowWrongValueTypeArgumentException(value, typeof(TValue));
}
}
catch (InvalidCastException)
{
ThrowHelper.ThrowWrongKeyTypeArgumentException(key, typeof(TKey));
}
}
bool IDictionary.Contains(object key)
{
if (IsCompatibleKey(key))
{
return ContainsKey((TKey)key);
}
return false;
}
IDictionaryEnumerator IDictionary.GetEnumerator()
{
return new Enumerator(this, 1);
}
void IDictionary.Remove(object key)
{
if (IsCompatibleKey(key))
{
Remove((TKey)key);
}
}
public void Dispose()
{
ReturnArrays();
_count = 0;
_size = 0;
_freeList = -1;
_freeCount = 0;
}
}
public static class PooledExtensions
{
public static PooledList<T> ToPooledList<T>(this IEnumerable<T> items)
{
return new PooledList<T>(items);
}
public static PooledList<T> ToPooledList<T>(this T[] array)
{
return new PooledList<T>(array.AsSpan());
}
public static PooledList<T> ToPooledList<T>(this ReadOnlySpan<T> span)
{
return new PooledList<T>(span);
}
public static PooledList<T> ToPooledList<T>(this Span<T> span)
{
return new PooledList<T>(span);
}
public static PooledList<T> ToPooledList<T>(this ReadOnlyMemory<T> memory)
{
return new PooledList<T>(memory.Span);
}
public static PooledList<T> ToPooledList<T>(this Memory<T> memory)
{
return new PooledList<T>(memory.Span);
}
public static PooledDictionary<TKey, TValue> ToPooledDictionary<TSource, TKey, TValue>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TValue> valueSelector, IEqualityComparer<TKey> comparer = null)
{
if (source == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.source);
}
PooledDictionary<TKey, TValue> pooledDictionary = new PooledDictionary<TKey, TValue>((source as ICollection<TSource>)?.Count ?? 0, comparer);
foreach (TSource item in source)
{
pooledDictionary.Add(keySelector(item), valueSelector(item));
}
return pooledDictionary;
}
public static PooledDictionary<TKey, TValue> ToPooledDictionary<TSource, TKey, TValue>(this ReadOnlySpan<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TValue> valueSelector, IEqualityComparer<TKey> comparer = null)
{
PooledDictionary<TKey, TValue> pooledDictionary = new PooledDictionary<TKey, TValue>(source.Length, comparer);
ReadOnlySpan<TSource> readOnlySpan = source;
for (int i = 0; i < readOnlySpan.Length; i++)
{
TSource arg = readOnlySpan[i];
pooledDictionary.Add(keySelector(arg), valueSelector(arg));
}
return pooledDictionary;
}
public static PooledDictionary<TKey, TValue> ToPooledDictionary<TSource, TKey, TValue>(this Span<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TValue> valueSelector, IEqualityComparer<TKey> comparer)
{
return ((ReadOnlySpan<TSource>)source).ToPooledDictionary(keySelector, valueSelector, comparer);
}
public static PooledDictionary<TKey, TValue> ToPooledDictionary<TSource, TKey, TValue>(this ReadOnlyMemory<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TValue> valueSelector, IEqualityComparer<TKey> comparer)
{
return source.Span.ToPooledDictionary(keySelector, valueSelector, comparer);
}
public static PooledDictionary<TKey, TValue> ToPooledDictionary<TSource, TKey, TValue>(this Memory<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TValue> valueSelector, IEqualityComparer<TKey> comparer)
{
return source.Span.ToPooledDictionary(keySelector, valueSelector, comparer);
}
public static PooledDictionary<TKey, TSource> ToPooledDictionary<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer = null)
{
if (source == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.source);
}
PooledDictionary<TKey, TSource> pooledDictionary = new PooledDictionary<TKey, TSource>((source as ICollection<TSource>)?.Count ?? 0, comparer);
foreach (TSource item in source)
{
pooledDictionary.Add(keySelector(item), item);
}
return pooledDictionary;
}
public static PooledDictionary<TKey, TSource> ToPooledDictionary<TSource, TKey>(this ReadOnlySpan<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer = null)
{
PooledDictionary<TKey, TSource> pooledDictionary = new PooledDictionary<TKey, TSource>(source.Length, comparer);
ReadOnlySpan<TSource> readOnlySpan = source;
for (int i = 0; i < readOnlySpan.Length; i++)
{
TSource val = readOnlySpan[i];
pooledDictionary.Add(keySelector(val), val);
}
return pooledDictionary;
}
public static PooledDictionary<TKey, TSource> ToPooledDictionary<TSource, TKey>(this Span<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer = null)
{
return ((ReadOnlySpan<TSource>)source).ToPooledDictionary(keySelector, comparer);
}
public static PooledDictionary<TKey, TSource> ToPooledDictionary<TSource, TKey>(this ReadOnlyMemory<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer = null)
{
return source.Span.ToPooledDictionary(keySelector, comparer);
}
public static PooledDictionary<TKey, TSource> ToPooledDictionary<TSource, TKey>(this Memory<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer = null)
{
return source.Span.ToPooledDictionary(keySelector, comparer);
}
public static PooledDictionary<TKey, TValue> ToPooledDictionary<TKey, TValue>(this IEnumerable<(TKey, TValue)> source, IEqualityComparer<TKey> comparer = null)
{
return new PooledDictionary<TKey, TValue>(source, comparer);
}
public static PooledDictionary<TKey, TValue> ToPooledDictionary<TKey, TValue>(this IEnumerable<KeyValuePair<TKey, TValue>> source, IEqualityComparer<TKey> comparer = null)
{
return new PooledDictionary<TKey, TValue>(source, comparer);
}
public static PooledDictionary<TKey, TValue> ToPooledDictionary<TKey, TValue>(this IEnumerable<Tuple<TKey, TValue>> source, IEqualityComparer<TKey> comparer = null)
{
if (source == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.source);
}
PooledDictionary<TKey, TValue> pooledDictionary = new PooledDictionary<TKey, TValue>((source as ICollection<Tuple<TKey, TValue>>)?.Count ?? 0, comparer);
foreach (Tuple<TKey, TValue> item in source)
{
pooledDictionary.Add(item.Item1, item.Item2);
}
return pooledDictionary;
}
public static PooledDictionary<TKey, TValue> ToPooledDictionary<TKey, TValue>(this ReadOnlySpan<(TKey, TValue)> source, IEqualityComparer<TKey> comparer = null)
{
return new PooledDictionary<TKey, TValue>(source, comparer);
}
public static PooledDictionary<TKey, TValue> ToPooledDictionary<TKey, TValue>(this Span<(TKey, TValue)> source, IEqualityComparer<TKey> comparer = null)
{
return new PooledDictionary<TKey, TValue>(source, comparer);
}
public static PooledSet<T> ToPooledSet<T>(this IEnumerable<T> source, IEqualityComparer<T> comparer = null)
{
return new PooledSet<T>(source, comparer);
}
public static PooledSet<T> ToPooledSet<T>(this Span<T> source, IEqualityComparer<T> comparer = null)
{
return new PooledSet<T>(source, comparer);
}
public static PooledSet<T> ToPooledSet<T>(this ReadOnlySpan<T> source, IEqualityComparer<T> comparer = null)
{
return new PooledSet<T>(source, comparer);
}
public static PooledSet<T> ToPooledSet<T>(this Memory<T> source, IEqualityComparer<T> comparer = null)
{
return new PooledSet<T>(source.Span, comparer);
}
public static PooledSet<T> ToPooledSet<T>(this ReadOnlyMemory<T> source, IEqualityComparer<T> comparer = null)
{
return new PooledSet<T>(source.Span, comparer);
}
public static PooledStack<T> ToPooledStack<T>(this IEnumerable<T> items)
{
return new PooledStack<T>(items);
}
public static PooledStack<T> ToPooledStack<T>(this T[] array)
{
return new PooledStack<T>(array.AsSpan());
}
public static PooledStack<T> ToPooledStack<T>(this ReadOnlySpan<T> span)
{
return new PooledStack<T>(span);
}
public static PooledStack<T> ToPooledStack<T>(this Span<T> span)
{
return new PooledStack<T>(span);
}
public static PooledStack<T> ToPooledStack<T>(this ReadOnlyMemory<T> memory)
{
return new PooledStack<T>(memory.Span);
}
public static PooledStack<T> ToPooledStack<T>(this Memory<T> memory)
{
return new PooledStack<T>(memory.Span);
}
public static PooledQueue<T> ToPooledQueue<T>(this IEnumerable<T> items)
{
return new PooledQueue<T>(items);
}
public static PooledQueue<T> ToPooledQueue<T>(this ReadOnlySpan<T> span)
{
return new PooledQueue<T>(span);
}
public static PooledQueue<T> ToPooledQueue<T>(this Span<T> span)
{
return new PooledQueue<T>(span);
}
public static PooledQueue<T> ToPooledQueue<T>(this ReadOnlyMemory<T> memory)
{
return new PooledQueue<T>(memory.Span);
}
public static PooledQueue<T> ToPooledQueue<T>(this Memory<T> memory)
{
return new PooledQueue<T>(memory.Span);
}
public static PooledQueue<T> ToPooledQueue<T>(this T[] array)
{
return new PooledQueue<T>(array.AsSpan());
}
}
[Serializable]
[DebuggerDisplay("Count = {Count}")]
[DebuggerTypeProxy(typeof(ICollectionDebugView<>))]
public class PooledList<T> : IList<T>, ICollection<T>, IEnumerable<T>, IEnumerable, IReadOnlyPooledList<T>, IReadOnlyList<T>, IReadOnlyCollection<T>, IList, ICollection, IDisposable, IDeserializationCallback
{
public struct Enumerator : IEnumerator<T>, IEnumerator, IDisposable
{
private readonly PooledList<T> _list;
private int _index;
private readonly int _version;
private T _current;
public T Current => _current;
object IEnumerator.Current
{
get
{
if (_index == 0 || _index == _list._size + 1)
{
ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumOpCantHappen();
}
return Current;
}
}
internal Enumerator(PooledList<T> list)
{
_list = list;
_index = 0;
_version = list._version;
_current = default(T);
}
public void Dispose()
{
}
public bool MoveNext()
{
PooledList<T> list = _list;
if (_version == list._version && (uint)_index < (uint)list._size)
{
_current = list._items[_index];
_index++;
return true;
}
return MoveNextRare();
}
private bool MoveNextRare()
{
if (_version != _list._version)
{
ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumFailedVersion();
}
_index = _list._size + 1;
_current = default(T);
return false;
}
void IEnumerator.Reset()
{
if (_version != _list._version)
{
ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumFailedVersion();
}
_index = 0;
_current = default(T);
}
}
private readonly struct Comparer : IComparer<T>
{
private readonly Func<T, T, int> _comparison;
public Comparer(Func<T, T, int> comparison)
{
_comparison = comparison;
}
public int Compare(T x, T y)
{
return _comparison(x, y);
}
}
private const int MaxArrayLength = 2146435071;
private const int DefaultCapacity = 4;
private static readonly T[] s_emptyArray = Array.Empty<T>();
[NonSerialized]
private ArrayPool<T> _pool;
[NonSerialized]
private object _syncRoot;
private T[] _items;
private int _size;
private int _version;
private readonly bool _clearOnFree;
public Span<T> Span => _items.AsSpan(0, _size);
ReadOnlySpan<T> IReadOnlyPooledList<T>.Span => Span;
public int Capacity
{
get
{
return _items.Length;
}
set
{
if (value < _size)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.value, ExceptionResource.ArgumentOutOfRange_SmallCapacity);
}
if (value == _items.Length)
{
return;
}
if (value > 0)
{
T[] array = _pool.Rent(value);
if (_size > 0)
{
Array.Copy(_items, array, _size);
}
ReturnArray();
_items = array;
}
else
{
ReturnArray();
_size = 0;
}
}
}
public int Count => _size;
public ClearMode ClearMode
{
get
{
if (!_clearOnFree)
{
return ClearMode.Never;
}
return ClearMode.Always;
}
}
bool IList.IsFixedSize => false;
bool ICollection<T>.IsReadOnly => false;
bool IList.IsReadOnly => false;
int ICollection.Count => _size;
bool ICollection.IsSynchronized => false;
object ICollection.SyncRoot
{
get
{
if (_syncRoot == null)
{
Interlocked.CompareExchange<object>(ref _syncRoot, new object(), (object)null);
}
return _syncRoot;
}
}
public T this[int index]
{
get
{
if ((uint)index >= (uint)_size)
{
ThrowHelper.ThrowArgumentOutOfRange_IndexException();
}
return _items[index];
}
set
{
if ((uint)index >= (uint)_size)
{
ThrowHelper.ThrowArgumentOutOfRange_IndexException();
}
_items[index] = value;
_version++;
}
}
object IList.this[int index]
{
get
{
return this[index];
}
set
{
ThrowHelper.IfNullAndNullsAreIllegalThenThrow<T>(value, ExceptionArgument.value);
try
{
this[index] = (T)value;
}
catch (InvalidCastException)
{
ThrowHelper.ThrowWrongValueTypeArgumentException(value, typeof(T));
}
}
}
public PooledList()
: this(ClearMode.Auto, ArrayPool<T>.Shared)
{
}
public PooledList(ClearMode clearMode)
: this(clearMode, ArrayPool<T>.Shared)
{
}
public PooledList(ArrayPool<T> customPool)
: this(ClearMode.Auto, customPool)
{
}
public PooledList(ClearMode clearMode, ArrayPool<T> customPool)
{
_items = s_emptyArray;
_pool = customPool ?? ArrayPool<T>.Shared;
_clearOnFree = ShouldClear(clearMode);
}
public PooledList(int capacity)
: this(capacity, ClearMode.Auto, ArrayPool<T>.Shared)
{
}
public PooledList(int capacity, bool sizeToCapacity)
: this(capacity, ClearMode.Auto, ArrayPool<T>.Shared, sizeToCapacity)
{
}
public PooledList(int capacity, ClearMode clearMode)
: this(capacity, clearMode, ArrayPool<T>.Shared)
{
}
public PooledList(int capacity, ClearMode clearMode, bool sizeToCapacity)
: this(capacity, clearMode, ArrayPool<T>.Shared, sizeToCapacity)
{
}
public PooledList(int capacity, ArrayPool<T> customPool)
: this(capacity, ClearMode.Auto, customPool)
{
}
public PooledList(int capacity, ArrayPool<T> customPool, bool sizeToCapacity)
: this(capacity, ClearMode.Auto, customPool, sizeToCapacity)
{
}
public PooledList(int capacity, ClearMode clearMode, ArrayPool<T> customPool)
: this(capacity, clearMode, customPool, sizeToCapacity: false)
{
}
public PooledList(int capacity, ClearMode clearMode, ArrayPool<T> customPool, bool sizeToCapacity)
{
if (capacity < 0)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.capacity, ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
}
_pool = customPool ?? ArrayPool<T>.Shared;
_clearOnFree = ShouldClear(clearMode);
if (capacity == 0)
{
_items = s_emptyArray;
}
else
{
_items = _pool.Rent(capacity);
}
if (sizeToCapacity)
{
_size = capacity;
if (clearMode != ClearMode.Never)
{
Array.Clear(_items, 0, _size);
}
}
}
public PooledList(T[] array)
: this((ReadOnlySpan<T>)array.AsSpan(), ClearMode.Auto, ArrayPool<T>.Shared)
{
}
public PooledList(T[] array, ClearMode clearMode)
: this((ReadOnlySpan<T>)array.AsSpan(), clearMode, ArrayPool<T>.Shared)
{
}
public PooledList(T[] array, ArrayPool<T> customPool)
: this((ReadOnlySpan<T>)array.AsSpan(), ClearMode.Auto, customPool)
{
}
public PooledList(T[] array, ClearMode clearMode, ArrayPool<T> customPool)
: this((ReadOnlySpan<T>)array.AsSpan(), clearMode, customPool)
{
}
public PooledList(ReadOnlySpan<T> span)
: this(span, ClearMode.Auto, ArrayPool<T>.Shared)
{
}
public PooledList(ReadOnlySpan<T> span, ClearMode clearMode)
: this(span, clearMode, ArrayPool<T>.Shared)
{
}
public PooledList(ReadOnlySpan<T> span, ArrayPool<T> customPool)
: this(span, ClearMode.Auto, customPool)
{
}
public PooledList(ReadOnlySpan<T> span, ClearMode clearMode, ArrayPool<T> customPool)
{
_pool = customPool ?? ArrayPool<T>.Shared;
_clearOnFree = ShouldClear(clearMode);
int length = span.Length;
if (length == 0)
{
_items = s_emptyArray;
return;
}
_items = _pool.Rent(length);
span.CopyTo(_items);
_size = length;
}
public PooledList(IEnumerable<T> collection)
: this(collection, ClearMode.Auto, ArrayPool<T>.Shared)
{
}
public PooledList(IEnumerable<T> collection, ClearMode clearMode)
: this(collection, clearMode, ArrayPool<T>.Shared)
{
}
public PooledList(IEnumerable<T> collection, ArrayPool<T> customPool)
: this(collection, ClearMode.Auto, customPool)
{
}
public PooledList(IEnumerable<T> collection, ClearMode clearMode, ArrayPool<T> customPool)
{
_pool = customPool ?? ArrayPool<T>.Shared;
_clearOnFree = ShouldClear(clearMode);
if (collection != null)
{
if (!(collection is ICollection<T> collection2))
{
_size = 0;
_items = s_emptyArray;
{
foreach (T item in collection)
{
Add(item);
}
return;
}
}
ICollection<T> collection3 = collection2;
int count = collection3.Count;
if (count == 0)
{
_items = s_emptyArray;
return;
}
_items = _pool.Rent(count);
collection3.CopyTo(_items, 0);
_size = count;
}
else
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.collection);
}
}
private static bool IsCompatibleObject(object value)
{
if (!(value is T))
{
if (value == null)
{
return default(T) == null;
}
return false;
}
return true;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Add(T item)
{
_version++;
int size = _size;
if ((uint)size < (uint)_items.Length)
{
_size = size + 1;
_items[size] = item;
}
else
{
AddWithResize(item);
}
}
[MethodImpl(MethodImplOptions.NoInlining)]
private void AddWithResize(T item)
{
int size = _size;
EnsureCapacity(size + 1);
_size = size + 1;
_items[size] = item;
}
int IList.Add(object item)
{
ThrowHelper.IfNullAndNullsAreIllegalThenThrow<T>(item, ExceptionArgument.item);
try
{
Add((T)item);
}
catch (InvalidCastException)
{
ThrowHelper.ThrowWrongValueTypeArgumentException(item, typeof(T));
}
return Count - 1;
}
public void AddRange(IEnumerable<T> collection)
{
InsertRange(_size, collection);
}
public void AddRange(T[] array)
{
AddRange(array.AsSpan());
}
public void AddRange(ReadOnlySpan<T> span)
{
Span<T> destination = InsertSpan(_size, span.Length, clearOutput: false);
span.CopyTo(destination);
}
public Span<T> AddSpan(int count)
{
return InsertSpan(_size, count);
}
public ReadOnlyCollection<T> AsReadOnly()
{
return new ReadOnlyCollection<T>(this);
}
public int BinarySearch(int index, int count, T item, IComparer<T> comparer)
{
if (index < 0)
{
ThrowHelper.ThrowIndexArgumentOutOfRange_NeedNonNegNumException();
}
if (count < 0)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.count, ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
}
if (_size - index < count)
{
ThrowHelper.ThrowArgumentException(ExceptionResource.Argument_InvalidOffLen);
}
return Array.BinarySearch(_items, index, count, item, comparer);
}
public int BinarySearch(T item)
{
return BinarySearch(0, Count, item, null);
}
public int BinarySearch(T item, IComparer<T> comparer)
{
return BinarySearch(0, Count, item, comparer);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Clear()
{
_version++;
int size = _size;
_size = 0;
if (size > 0 && _clearOnFree)
{
Array.Clear(_items, 0, _size);
}
}
public bool Contains(T item)
{
if (_size != 0)
{
return IndexOf(item) != -1;
}
return false;
}
bool IList.Contains(object item)
{
if (IsCompatibleObject(item))
{
return Contains((T)item);
}
return false;
}
public PooledList<TOutput> ConvertAll<TOutput>(Func<T, TOutput> converter)
{
if (converter == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.converter);
}
PooledList<TOutput> pooledList = new PooledList<TOutput>(_size);
for (int i = 0; i < _size; i++)
{
pooledList._items[i] = converter(_items[i]);
}
pooledList._size = _size;
return pooledList;
}
public void CopyTo(Span<T> span)
{
if (span.Length < Count)
{
throw new ArgumentException("Destination span is shorter than the list to be copied.");
}
Span.CopyTo(span);
}
void ICollection<T>.CopyTo(T[] array, int arrayIndex)
{
Array.Copy(_items, 0, array, arrayIndex, _size);
}
void ICollection.CopyTo(Array array, int arrayIndex)
{
if (array != null && array.Rank != 1)
{
ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_RankMultiDimNotSupported);
}
try
{
Array.Copy(_items, 0, array, arrayIndex, _size);
}
catch (ArrayTypeMismatchException)
{
ThrowHelper.ThrowArgumentException_Argument_InvalidArrayType();
}
}
private void EnsureCapacity(int min)
{
if (_items.Length < min)
{
int num = ((_items.Length == 0) ? 4 : (_items.Length * 2));
if ((uint)num > 2146435071u)
{
num = 2146435071;
}
if (num < min)
{
num = min;
}
Capacity = num;
}
}
public bool Exists(Func<T, bool> match)
{
return FindIndex(match) != -1;
}
public bool TryFind(Func<T, bool> match, out T result)
{
if (match == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.match);
}
for (int i = 0; i < _size; i++)
{
if (match(_items[i]))
{
result = _items[i];
return true;
}
}
result = default(T);
return false;
}
public PooledList<T> FindAll(Func<T, bool> match)
{
if (match == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.match);
}
PooledList<T> pooledList = new PooledList<T>();
for (int i = 0; i < _size; i++)
{
if (match(_items[i]))
{
pooledList.Add(_items[i]);
}
}
return pooledList;
}
public int FindIndex(Func<T, bool> match)
{
return FindIndex(0, _size, match);
}
public int FindIndex(int startIndex, Func<T, bool> match)
{
return FindIndex(startIndex, _size - startIndex, match);
}
public int FindIndex(int startIndex, int count, Func<T, bool> match)
{
if ((uint)startIndex > (uint)_size)
{
ThrowHelper.ThrowStartIndexArgumentOutOfRange_ArgumentOutOfRange_Index();
}
if (count < 0 || startIndex > _size - count)
{
ThrowHelper.ThrowCountArgumentOutOfRange_ArgumentOutOfRange_Count();
}
if (match == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.match);
}
int num = startIndex + count;
for (int i = startIndex; i < num; i++)
{
if (match(_items[i]))
{
return i;
}
}
return -1;
}
public bool TryFindLast(Func<T, bool> match, out T result)
{
if (match == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.match);
}
for (int num = _size - 1; num >= 0; num--)
{
if (match(_items[num]))
{
result = _items[num];
return true;
}
}
result = default(T);
return false;
}
public int FindLastIndex(Func<T, bool> match)
{
return FindLastIndex(_size - 1, _size, match);
}
public int FindLastIndex(int startIndex, Func<T, bool> match)
{
return FindLastIndex(startIndex, startIndex + 1, match);
}
public int FindLastIndex(int startIndex, int count, Func<T, bool> match)
{
if (match == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.match);
}
if (_size == 0)
{
if (startIndex != -1)
{
ThrowHelper.ThrowStartIndexArgumentOutOfRange_ArgumentOutOfRange_Index();
}
}
else if ((uint)startIndex >= (uint)_size)
{
ThrowHelper.ThrowStartIndexArgumentOutOfRange_ArgumentOutOfRange_Index();
}
if (count < 0 || startIndex - count + 1 < 0)
{
ThrowHelper.ThrowCountArgumentOutOfRange_ArgumentOutOfRange_Count();
}
int num = startIndex - count;
for (int num2 = startIndex; num2 > num; num2--)
{
if (match(_items[num2]))
{
return num2;
}
}
return -1;
}
public void ForEach(Action<T> action)
{
if (action == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.action);
}
int version = _version;
for (int i = 0; i < _size; i++)
{
if (version != _version)
{
break;
}
action(_items[i]);
}
if (version != _version)
{
ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumFailedVersion();
}
}
public Enumerator GetEnumerator()
{
return new Enumerator(this);
}
IEnumerator<T> IEnumerable<T>.GetEnumerator()
{
return new Enumerator(this);
}
IEnumerator IEnumerable.GetEnumerator()
{
return new Enumerator(this);
}
public Span<T> GetRange(int index, int count)
{
if (index < 0)
{
ThrowHelper.ThrowIndexArgumentOutOfRange_NeedNonNegNumException();
}
if (count < 0)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.count, ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
}
if (_size - index < count)
{
ThrowHelper.ThrowArgumentException(ExceptionResource.Argument_InvalidOffLen);
}
return Span.Slice(index, count);
}
public int IndexOf(T item)
{
return Array.IndexOf(_items, item, 0, _size);
}
int IList.IndexOf(object item)
{
if (IsCompatibleObject(item))
{
return IndexOf((T)item);
}
return -1;
}
public int IndexOf(T item, int index)
{
if (index > _size)
{
ThrowHelper.ThrowArgumentOutOfRange_IndexException();
}
return Array.IndexOf(_items, item, index, _size - index);
}
public int IndexOf(T item, int index, int count)
{
if (index > _size)
{
ThrowHelper.ThrowArgumentOutOfRange_IndexException();
}
if (count < 0 || index > _size - count)
{
ThrowHelper.ThrowCountArgumentOutOfRange_ArgumentOutOfRange_Count();
}
return Array.IndexOf(_items, item, index, count);
}
public void Insert(int index, T item)
{
if ((uint)index > (uint)_size)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.index, ExceptionResource.ArgumentOutOfRange_ListInsert);
}
if (_size == _items.Length)
{
EnsureCapacity(_size + 1);
}
if (index < _size)
{
Array.Copy(_items, index, _items, index + 1, _size - index);
}
_items[index] = item;
_size++;
_version++;
}
void IList.Insert(int index, object item)
{
ThrowHelper.IfNullAndNullsAreIllegalThenThrow<T>(item, ExceptionArgument.item);
try
{
Insert(index, (T)item);
}
catch (InvalidCastException)
{
ThrowHelper.ThrowWrongValueTypeArgumentException(item, typeof(T));
}
}
public void InsertRange(int index, IEnumerable<T> collection)
{
if ((uint)index > (uint)_size)
{
ThrowHelper.ThrowArgumentOutOfRange_IndexException();
}
if (collection != null)
{
if (collection is ICollection<T> collection2)
{
ICollection<T> collection3 = collection2;
int count = collection3.Count;
if (count > 0)
{
EnsureCapacity(_size + count);
if (index < _size)
{
Array.Copy(_items, index, _items, index + count, _size - index);
}
if (this == collection3)
{
Array.Copy(_items, 0, _items, index, index);
Array.Copy(_items, index + count, _items, index * 2, _size - index);
}
else
{
collection3.CopyTo(_items, index);
}
_size += count;
}
}
else
{
using IEnumerator<T> enumerator = collection.GetEnumerator();
while (enumerator.MoveNext())
{
Insert(index++, enumerator.Current);
}
}
}
else
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.collection);
}
_version++;
}
public void InsertRange(int index, ReadOnlySpan<T> span)
{
Span<T> destination = InsertSpan(index, span.Length, clearOutput: false);
span.CopyTo(destination);
}
public void InsertRange(int index, T[] array)
{
if (array == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array);
}
InsertRange(index, array.AsSpan());
}
public Span<T> InsertSpan(int index, int count)
{
return InsertSpan(index, count, clearOutput: true);
}
private Span<T> InsertSpan(int index, int count, bool clearOutput)
{
EnsureCapacity(_size + count);
if (index < _size)
{
Array.Copy(_items, index, _items, index + count, _size - index);
}
_size += count;
_version++;
Span<T> result = _items.AsSpan(index, count);
if (clearOutput && _clearOnFree)
{
result.Clear();
}
return result;
}
public int LastIndexOf(T item)
{
if (_size == 0)
{
return -1;
}
return LastIndexOf(item, _size - 1, _size);
}
public int LastIndexOf(T item, int index)
{
if (index >= _size)
{
ThrowHelper.ThrowArgumentOutOfRange_IndexException();
}
return LastIndexOf(item, index, index + 1);
}
public int LastIndexOf(T item, int index, int count)
{
if (Count != 0 && index < 0)
{
ThrowHelper.ThrowIndexArgumentOutOfRange_NeedNonNegNumException();
}
if (Count != 0 && count < 0)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.count, ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
}
if (_size == 0)
{
return -1;
}
if (index >= _size)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.index, ExceptionResource.ArgumentOutOfRange_BiggerThanCollection);
}
if (count > index + 1)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.count, ExceptionResource.ArgumentOutOfRange_BiggerThanCollection);
}
return Array.LastIndexOf(_items, item, index, count);
}
public bool Remove(T item)
{
int num = IndexOf(item);
if (num >= 0)
{
RemoveAt(num);
return true;
}
return false;
}
void IList.Remove(object item)
{
if (IsCompatibleObject(item))
{
Remove((T)item);
}
}
public int RemoveAll(Func<T, bool> match)
{
if (match == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.match);
}
int i;
for (i = 0; i < _size && !match(_items[i]); i++)
{
}
if (i >= _size)
{
return 0;
}
int j = i + 1;
while (j < _size)
{
for (; j < _size && match(_items[j]); j++)
{
}
if (j < _size)
{
_items[i++] = _items[j++];
}
}
if (_clearOnFree)
{
Array.Clear(_items, i, _size - i);
}
int result = _size - i;
_size = i;
_version++;
return result;
}
public void RemoveAt(int index)
{
if ((uint)index >= (uint)_size)
{
ThrowHelper.ThrowArgumentOutOfRange_IndexException();
}
_size--;
if (index < _size)
{
Array.Copy(_items, index + 1, _items, index, _size - index);
}
_version++;
if (_clearOnFree)
{
_items[_size] = default(T);
}
}
public void RemoveRange(int index, int count)
{
if (index < 0)
{
ThrowHelper.ThrowIndexArgumentOutOfRange_NeedNonNegNumException();
}
if (count < 0)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.count, ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
}
if (_size - index < count)
{
ThrowHelper.ThrowArgumentException(ExceptionResource.Argument_InvalidOffLen);
}
if (count > 0)
{
_size -= count;
if (index < _size)
{
Array.Copy(_items, index + count, _items, index, _size - index);
}
_version++;
if (_clearOnFree)
{
Array.Clear(_items, _size, count);
}
}
}
public void Reverse()
{
Reverse(0, _size);
}
public void Reverse(int index, int count)
{
if (index < 0)
{
ThrowHelper.ThrowIndexArgumentOutOfRange_NeedNonNegNumException();
}
if (count < 0)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.count, ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
}
if (_size - index < count)
{
ThrowHelper.ThrowArgumentException(ExceptionResource.Argument_InvalidOffLen);
}
if (count > 1)
{
Array.Reverse((Array)_items, index, count);
}
_version++;
}
public void Sort()
{
Sort(0, Count, null);
}
public void Sort(IComparer<T> comparer)
{
Sort(0, Count, comparer);
}
public void Sort(int index, int count, IComparer<T> comparer)
{
if (index < 0)
{
ThrowHelper.ThrowIndexArgumentOutOfRange_NeedNonNegNumException();
}
if (count < 0)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.count, ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
}
if (_size - index < count)
{
ThrowHelper.ThrowArgumentException(ExceptionResource.Argument_InvalidOffLen);
}
if (count > 1)
{
Array.Sort(_items, index, count, comparer);
}
_version++;
}
public void Sort(Func<T, T, int> comparison)
{
if (comparison == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.comparison);
}
if (_size > 1)
{
Array.Sort(_items, 0, _size, new Comparer(comparison));
}
_version++;
}
public T[] ToArray()
{
if (_size == 0)
{
return s_emptyArray;
}
return Span.ToArray();
}
public void TrimExcess()
{
int num = (int)((double)_items.Length * 0.9);
if (_size < num)
{
Capacity = _size;
}
}
public bool TrueForAll(Func<T, bool> match)
{
if (match == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.match);
}
for (int i = 0; i < _size; i++)
{
if (!match(_items[i]))
{
return false;
}
}
return true;
}
private void ReturnArray()
{
if (_items.Length != 0)
{
try
{
_pool.Return(_items, _clearOnFree);
}
catch (ArgumentException)
{
}
_items = s_emptyArray;
}
}
private static bool ShouldClear(ClearMode mode)
{
return mode != ClearMode.Never;
}
public void Dispose()
{
ReturnArray();
_size = 0;
_version++;
}
void IDeserializationCallback.OnDeserialization(object sender)
{
_pool = ArrayPool<T>.Shared;
}
}
[Serializable]
[DebuggerTypeProxy(typeof(QueueDebugView<>))]
[DebuggerDisplay("Count = {Count}")]
public class PooledQueue<T> : IEnumerable<T>, IEnumerable, ICollection, IReadOnlyCollection<T>, IDisposable, IDeserializationCallback
{
public struct Enumerator : IEnumerator<T>, IEnumerator, IDisposable
{
private readonly PooledQueue<T> _q;
private readonly int _version;
private int _index;
private T _currentElement;
public T Current
{
get
{
if (_index < 0)
{
ThrowEnumerationNotStartedOrEnded();
}
return _currentElement;
}
}
object IEnumerator.Current => Current;
internal Enumerator(PooledQueue<T> q)
{
_q = q;
_version = q._version;
_index = -1;
_currentElement = default(T);
}
public void Dispose()
{
_index = -2;
_currentElement = default(T);
}
public bool MoveNext()
{
if (_version != _q._version)
{
ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumFailedVersion();
}
if (_index == -2)
{
return false;
}
_index++;
if (_index == _q._size)
{
_index = -2;
_currentElement = default(T);
return false;
}
T[] array = _q._array;
int num = array.Length;
int num2 = _q._head + _index;
if (num2 >= num)
{
num2 -= num;
}
_currentElement = array[num2];
return true;
}
private void ThrowEnumerationNotStartedOrEnded()
{
if (_index == -1)
{
ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumNotStarted();
}
else
{
ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumEnded();
}
}
void IEnumerator.Reset()
{
if (_version != _q._version)
{
ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumFailedVersion();
}
_index = -1;
_currentElement = default(T);
}
}
private const int MinimumGrow = 4;
private const int GrowFactor = 200;
[NonSerialized]
private ArrayPool<T> _pool;
[NonSerialized]
private object _syncRoot;
private T[] _array;
private int _head;
private int _tail;
private int _size;
private int _version;
private readonly bool _clearOnFree;
public int Count => _size;
public ClearMode ClearMode
{
get
{
if (!_clearOnFree)
{
return ClearMode.Never;
}
return ClearMode.Always;
}
}
bool ICollection.IsSynchronized => false;
object ICollection.SyncRoot
{
get
{
if (_syncRoot == null)
{
Interlocked.CompareExchange<object>(ref _syncRoot, new object(), (object)null);
}
return _syncRoot;
}
}
public PooledQueue()
: this(ClearMode.Auto, ArrayPool<T>.Shared)
{
}
public PooledQueue(ClearMode clearMode)
: this(clearMode, ArrayPool<T>.Shared)
{
}
public PooledQueue(ArrayPool<T> customPool)
: this(ClearMode.Auto, customPool)
{
}
public PooledQueue(ClearMode clearMode, ArrayPool<T> customPool)
{
_pool = customPool ?? ArrayPool<T>.Shared;
_array = Array.Empty<T>();
_clearOnFree = ShouldClear(clearMode);
}
public PooledQueue(int capacity)
: this(capacity, ClearMode.Auto, ArrayPool<T>.Shared)
{
}
public PooledQueue(int capacity, ClearMode clearMode)
: this(capacity, clearMode, ArrayPool<T>.Shared)
{
}
public PooledQueue(int capacity, ArrayPool<T> customPool)
: this(capacity, ClearMode.Auto, customPool)
{
}
public PooledQueue(int capacity, ClearMode clearMode, ArrayPool<T> customPool)
{
if (capacity < 0)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.capacity, ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
}
_pool = customPool ?? ArrayPool<T>.Shared;
_array = _pool.Rent(capacity);
_clearOnFree = ShouldClear(clearMode);
}
public PooledQueue(IEnumerable<T> enumerable)
: this(enumerable, ClearMode.Auto, ArrayPool<T>.Shared)
{
}
public PooledQueue(IEnumerable<T> enumerable, ClearMode clearMode)
: this(enumerable, clearMode, ArrayPool<T>.Shared)
{
}
public PooledQueue(IEnumerable<T> enumerable, ArrayPool<T> customPool)
: this(enumerable, ClearMode.Auto, customPool)
{
}
public PooledQueue(IEnumerable<T> enumerable, ClearMode clearMode, ArrayPool<T> customPool)
{
_pool = customPool ?? ArrayPool<T>.Shared;
_clearOnFree = ShouldClear(clearMode);
if (enumerable != null)
{
if (!(enumerable is ICollection<T> collection))
{
using (PooledList<T> pooledList = new PooledList<T>(enumerable))
{
_array = _pool.Rent(pooledList.Count);
pooledList.Span.CopyTo(_array);
_size = pooledList.Count;
if (_size != _array.Length)
{
_tail = _size;
}
return;
}
}
ICollection<T> collection2 = collection;
if (collection2.Count == 0)
{
_array = Array.Empty<T>();
return;
}
_array = _pool.Rent(collection2.Count);
collection2.CopyTo(_array, 0);
_size = collection2.Count;
if (_size != _array.Length)
{
_tail = _size;
}
}
else
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.enumerable);
}
}
public PooledQueue(T[] array)
: this((ReadOnlySpan<T>)array.AsSpan(), ClearMode.Auto, ArrayPool<T>.Shared)
{
}
public PooledQueue(T[] array, ClearMode clearMode)
: this((ReadOnlySpan<T>)array.AsSpan(), clearMode, ArrayPool<T>.Shared)
{
}
public PooledQueue(T[] array, ArrayPool<T> customPool)
: this((ReadOnlySpan<T>)array.AsSpan(), ClearMode.Auto, customPool)
{
}
public PooledQueue(T[] array, ClearMode clearMode, ArrayPool<T> customPool)
: this((ReadOnlySpan<T>)array.AsSpan(), clearMode, customPool)
{
}
public PooledQueue(ReadOnlySpan<T> span)
: this(span, ClearMode.Auto, ArrayPool<T>.Shared)
{
}
public PooledQueue(ReadOnlySpan<T> span, ClearMode clearMode)
: this(span, clearMode, ArrayPool<T>.Shared)
{
}
public PooledQueue(ReadOnlySpan<T> span, ArrayPool<T> customPool)
: this(span, ClearMode.Auto, customPool)
{
}
public PooledQueue(ReadOnlySpan<T> span, ClearMode clearMode, ArrayPool<T> customPool)
{
_pool = customPool ?? ArrayPool<T>.Shared;
_clearOnFree = ShouldClear(clearMode);
_array = _pool.Rent(span.Length);
span.CopyTo(_array);
_size = span.Length;
if (_size != _array.Length)
{
_tail = _size;
}
}
public void Clear()
{
if (_size != 0)
{
if (_clearOnFree)
{
if (_head < _tail)
{
Array.Clear(_array, _head, _size);
}
else
{
Array.Clear(_array, _head, _array.Length - _head);
Array.Clear(_array, 0, _tail);
}
}
_size = 0;
}
_head = 0;
_tail = 0;
_version++;
}
public void CopyTo(T[] array, int arrayIndex)
{
if (array == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array);
}
if ((uint)arrayIndex > (uint)array.Length)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.arrayIndex, ExceptionResource.ArgumentOutOfRange_Index);
}
if (array.Length - arrayIndex < _size)
{
ThrowHelper.ThrowArgumentException(ExceptionResource.Argument_InvalidOffLen);
}
int size = _size;
if (size != 0)
{
int num = Math.Min(_array.Length - _head, size);
Array.Copy(_array, _head, array, arrayIndex, num);
size -= num;
if (size > 0)
{
Array.Copy(_array, 0, array, arrayIndex + _array.Length - _head, size);
}
}
}
void ICollection.CopyTo(Array array, int index)
{
if (array == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array);
}
if (array.Rank != 1)
{
ThrowHelper.ThrowArgumentException(ExceptionResource.Rank_MultiDimNotSupported, ExceptionArgument.array);
}
if (array.GetLowerBound(0) != 0)
{
ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_NonZeroLowerBound, ExceptionArgument.array);
}
int length = array.Length;
if ((uint)index > (uint)length)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.index, ExceptionResource.ArgumentOutOfRange_Index);
}
if (length - index < _size)
{
ThrowHelper.ThrowArgumentException(ExceptionResource.Argument_InvalidOffLen);
}
int size = _size;
if (size == 0)
{
return;
}
try
{
int num = ((_array.Length - _head < size) ? (_array.Length - _head) : size);
Array.Copy(_array, _head, array, index, num);
size -= num;
if (size > 0)
{
Array.Copy(_array, 0, array, index + _array.Length - _head, size);
}
}
catch (ArrayTypeMismatchException)
{
ThrowHelper.ThrowArgumentException_Argument_InvalidArrayType();
}
}
public void Enqueue(T item)
{
if (_size == _array.Length)
{
int num = (int)((long)_array.Length * 200L / 100);
if (num < _array.Length + 4)
{
num = _array.Length + 4;
}
SetCapacity(num);
}
_array[_tail] = item;
MoveNext(ref _tail);
_size++;
_version++;
}
public Enumerator GetEnumerator()
{
return new Enumerator(this);
}
IEnumerator<T> IEnumerable<T>.GetEnumerator()
{
return new Enumerator(this);
}
IEnumerator IEnumerable.GetEnumerator()
{
return new Enumerator(this);
}
public T Dequeue()
{
int head = _head;
T[] array = _array;
if (_size == 0)
{
ThrowForEmptyQueue();
}
T result = array[head];
if (_clearOnFree)
{
array[head] = default(T);
}
MoveNext(ref _head);
_size--;
_version++;
return result;
}
public bool TryDequeue(out T result)
{
int head = _head;
T[] array = _array;
if (_size == 0)
{
result = default(T);
return false;
}
result = array[head];
if (_clearOnFree)
{
array[head] = default(T);
}
MoveNext(ref _head);
_size--;
_version++;
return true;
}
public T Peek()
{
if (_size == 0)
{
ThrowForEmptyQueue();
}
return _array[_head];
}
public bool TryPeek(out T result)
{
if (_size == 0)
{
result = default(T);
return false;
}
result = _array[_head];
return true;
}
public bool Contains(T item)
{
if (_size == 0)
{
return false;
}
if (_head < _tail)
{
return Array.IndexOf(_array, item, _head, _size) >= 0;
}
if (Array.IndexOf(_array, item, _head, _array.Length - _head) < 0)
{
return Array.IndexOf(_array, item, 0, _tail) >= 0;
}
return true;
}
public int RemoveWhere(Func<T, bool> match)
{
if (match == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.match);
}
if (_size == 0)
{
return 0;
}
T[] array = _pool.Rent(_size);
int num = 0;
if (_head < _tail)
{
int num2 = 0;
for (int i = _head; i < _size; i++)
{
if (match(_array[i]))
{
num++;
}
else
{
array[num2++] = _array[i];
}
}
}
else
{
int num3 = 0;
for (int j = _head; j < _array.Length - _head; j++)
{
if (match(_array[j]))
{
num++;
}
else
{
array[num3++] = _array[j];
}
}
for (int k = 0; k < _tail; k++)
{
if (match(_array[k]))
{
num++;
}
else
{
array[num3++] = _array[k];
}
}
}
ReturnArray(array);
_size -= num;
_head = (_tail = 0);
if (_size != _array.Length)
{
_tail = _size;
}
_version++;
return num;
}
public T[] ToArray()
{
if (_size == 0)
{
return Array.Empty<T>();
}
T[] array = new T[_size];
if (_head < _tail)
{
Array.Copy(_array, _head, array, 0, _size);
}
else
{
Array.Copy(_array, _head, array, 0, _array.Length - _head);
Array.Copy(_array, 0, array, _array.Length - _head, _tail);
}
return array;
}
private void SetCapacity(int capacity)
{
T[] array = _pool.Rent(capacity);
if (_size > 0)
{
if (_head < _tail)
{
Array.Copy(_array, _head, array, 0, _size);
}
else
{
Array.Copy(_array, _head, array, 0, _array.Length - _head);
Array.Copy(_array, 0, array, _array.Length - _head, _tail);
}
}
ReturnArray(array);
_head = 0;
_tail = ((_size != array.Length) ? _size : 0);
_version++;
}
private void MoveNext(ref int index)
{
int num = index + 1;
if (num == _array.Length)
{
num = 0;
}
index = num;
}
private void ThrowForEmptyQueue()
{
throw new InvalidOperationException("Queue is empty.");
}
public void TrimExcess()
{
int num = (int)((double)_array.Length * 0.9);
if (_size < num)
{
SetCapacity(_size);
}
}
private void ReturnArray(T[] replaceWith)
{
if (_array.Length != 0)
{
try
{
_pool.Return(_array, _clearOnFree);
}
catch (ArgumentException)
{
}
}
_array = replaceWith;
}
private static bool ShouldClear(Cusing System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Threading;
using System.Threading.Tasks;
using <StartupCode$IcedTasks>;
using IcedTasks;
using IcedTasks.Polyfill.Task;
using Microsoft.FSharp.Collections;
using Microsoft.FSharp.Control;
using Microsoft.FSharp.Control.TaskBuilderExtensions;
using Microsoft.FSharp.Core;
using Microsoft.FSharp.Core.CompilerServices;
[assembly: FSharpInterfaceDataVersion(2, 0, 0)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyTitle("IcedTasks")]
[assembly: AssemblyProduct("IcedTasks")]
[assembly: AssemblyMetadata("ReleaseDate", "2024-07-10T00:00:00.0000000")]
[assembly: AssemblyFileVersion("0.11.7")]
[assembly: AssemblyInformationalVersion("0.11.7")]
[assembly: AssemblyMetadata("ReleaseChannel", "release")]
[assembly: AssemblyMetadata("GitHash", "db0b55bd89f769e17744319bfc510486a5b1fc5f")]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyVersion("0.11.7.0")]
namespace IcedTasks
{
[Serializable]
[CompilationMapping(/*Could not decode attribute arguments.*/)]
public class Awaiter
{
public static bool IsCompleted<Awaiter, TResult>(Awaiter awaiter) where Awaiter : ICriticalNotifyCompletion
{
throw new NotSupportedException("Dynamic invocation of get_IsCompleted is not supported");
}
public static bool IsCompleted$W<Awaiter, TResult>(FSharpFunc<Awaiter, TResult> getResult, FSharpFunc<Awaiter, bool> get_IsCompleted, Awaiter awaiter) where Awaiter : ICriticalNotifyCompletion
{
return get_IsCompleted.Invoke(awaiter);
}
public static TResult GetResult<Awaiter, TResult>(Awaiter awaiter) where Awaiter : ICriticalNotifyCompletion
{
throw new NotSupportedException("Dynamic invocation of GetResult is not supported");
}
public static TResult GetResult$W<Awaiter, TResult>(FSharpFunc<Awaiter, TResult> getResult, FSharpFunc<Awaiter, bool> get_IsCompleted, Awaiter awaiter) where Awaiter : ICriticalNotifyCompletion
{
return getResult.Invoke(awaiter);
}
public static void OnCompleted<Awaiter, TResult, Continuation>(Awaiter awaiter, Action continuation) where Awaiter : ICriticalNotifyCompletion
{
Awaiter val = awaiter;
val.OnCompleted(continuation);
}
public static void OnCompleted$W<Awaiter, TResult, Continuation>(FSharpFunc<Awaiter, TResult> getResult, FSharpFunc<Awaiter, bool> get_IsCompleted, Awaiter awaiter, Action continuation) where Awaiter : ICriticalNotifyCompletion
{
Awaiter val = awaiter;
val.OnCompleted(continuation);
}
public static void UnsafeOnCompleted<Awaiter, TResult, Continuation>(Awaiter awaiter, Action continuation) where Awaiter : ICriticalNotifyCompletion
{
Awaiter val = awaiter;
val.UnsafeOnCompleted(continuation);
}
public static void UnsafeOnCompleted$W<Awaiter, TResult, Continuation>(FSharpFunc<Awaiter, TResult> getResult, FSharpFunc<Awaiter, bool> get_IsCompleted, Awaiter awaiter, Action continuation) where Awaiter : ICriticalNotifyCompletion
{
Awaiter val = awaiter;
val.UnsafeOnCompleted(continuation);
}
}
[Serializable]
[CompilationMapping(/*Could not decode attribute arguments.*/)]
public class Awaitable
{
public static Awaiter GetAwaiter<Awaitable, Awaiter, TResult>(Awaitable awaitable) where Awaiter : ICriticalNotifyCompletion
{
throw new NotSupportedException("Dynamic invocation of GetAwaiter is not supported");
}
public static Awaiter GetAwaiter$W<Awaitable, Awaiter, TResult>(FSharpFunc<Awaitable, Awaiter> getAwaiter, FSharpFunc<Awaiter, TResult> getResult, FSharpFunc<Awaiter, bool> get_IsCompleted, Awaitable awaitable) where Awaiter : ICriticalNotifyCompletion
{
return getAwaiter.Invoke(awaitable);
}
public static TaskAwaiter<T> GetTaskAwaiter<T>(Task<T> t)
{
return t.GetAwaiter();
}
}
[Serializable]
[CompilationMapping(/*Could not decode attribute arguments.*/)]
public class MethodBuilder
{
public static void SetResult<Builder, TResult>(ref Builder builder)
{
throw new NotSupportedException("Dynamic invocation of SetResult is not supported");
}
public static void SetResult$W<Builder, TResult>(FSharpFunc<Builder, Unit> setResult, ref Builder builder)
{
setResult.Invoke(builder);
}
public static void SetResult<Builder, TResult>(ref Builder builder, TResult result)
{
throw new NotSupportedException("Dynamic invocation of SetResult is not supported");
}
public static void SetResult$W<Builder, TResult>(FSharpFunc<Builder, FSharpFunc<TResult, Unit>> setResult, ref Builder builder, TResult result)
{
FSharpFunc<Unit, ?>.InvokeFast<Unit>((FSharpFunc<Unit, FSharpFunc<?, Unit>>)(object)setResult, (Unit)builder, result);
}
public static void SetException<Builder>(ref Builder builder, Exception ex)
{
throw new NotSupportedException("Dynamic invocation of SetException is not supported");
}
public static void SetException$W<Builder>(FSharpFunc<Builder, FSharpFunc<Exception, Unit>> setException, ref Builder builder, Exception ex)
{
FSharpFunc<Unit, Exception>.InvokeFast<Unit>((FSharpFunc<Unit, FSharpFunc<Exception, Unit>>)(object)setException, (Unit)builder, ex);
}
public static void SetStateMachine<Builder, TStateMachine>(ref Builder builder, TStateMachine stateMachine)
{
throw new NotSupportedException("Dynamic invocation of SetStateMachine is not supported");
}
public static void SetStateMachine$W<Builder, TStateMachine>(FSharpFunc<Builder, FSharpFunc<TStateMachine, Unit>> setStateMachine, ref Builder builder, TStateMachine stateMachine)
{
FSharpFunc<Unit, ?>.InvokeFast<Unit>((FSharpFunc<Unit, FSharpFunc<?, Unit>>)(object)setStateMachine, (Unit)builder, stateMachine);
}
public static void Start<Builder, TStateMachine>(ref Builder builder, ref TStateMachine stateMachine)
{
throw new NotSupportedException("Dynamic invocation of Start is not supported");
}
public static void Start$W<Builder, TStateMachine>(FSharpFunc<Builder, FSharpFunc<ref TStateMachine, Unit>> start, ref Builder builder, ref TStateMachine stateMachine)
{
FSharpFunc<Unit, ref ?>.InvokeFast<Unit>((FSharpFunc<Unit, FSharpFunc<ref ?, Unit>>)(object)start, (Unit)builder, ref Unsafe.As<TStateMachine, ?>(ref stateMachine));
}
public static TResult get_Task<Builder, TResult>(ref Builder builder)
{
throw new NotSupportedException("Dynamic invocation of get_Task is not supported");
}
public static TResult get_Task$W<Builder, TResult>(FSharpFunc<Builder, TResult> get_Task, ref Builder builder)
{
return get_Task.Invoke(builder);
}
public static void AwaitUnsafeOnCompleted<Builder, TAwaiter, TStateMachine>(ref Builder builder, ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : ICriticalNotifyCompletion where TStateMachine : IAsyncStateMachine
{
throw new NotSupportedException("Dynamic invocation of AwaitUnsafeOnCompleted is not supported");
}
public unsafe static void AwaitUnsafeOnCompleted$W<Builder, TAwaiter, TStateMachine>(FSharpFunc<Builder, FSharpFunc<ref TAwaiter, FSharpFunc<ref TStateMachine, Unit>>> awaitUnsafeOnCompleted, ref Builder builder, ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : ICriticalNotifyCompletion where TStateMachine : IAsyncStateMachine
{
FSharpFunc<ref TStateMachine, ref Unit>.InvokeFast<ref TStateMachine, Unit>((FSharpFunc<ref TStateMachine, FSharpFunc<ref Unit, FSharpFunc<ref TStateMachine, Unit>>>)(object)awaitUnsafeOnCompleted, ref *(TStateMachine*)builder, ref Unsafe.As<TAwaiter, Unit>(ref awaiter), ref stateMachine);
}
public static void AwaitOnCompleted<Builder, TAwaiter, TStateMachine>(ref Builder builder, ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : INotifyCompletion where TStateMachine : IAsyncStateMachine
{
throw new NotSupportedException("Dynamic invocation of AwaitOnCompleted is not supported");
}
public unsafe static void AwaitOnCompleted$W<Builder, TAwaiter, TStateMachine>(FSharpFunc<Builder, FSharpFunc<ref TAwaiter, FSharpFunc<ref TStateMachine, Unit>>> awaitOnCompleted, ref Builder builder, ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : INotifyCompletion where TStateMachine : IAsyncStateMachine
{
FSharpFunc<ref TStateMachine, ref Unit>.InvokeFast<ref TStateMachine, Unit>((FSharpFunc<ref TStateMachine, FSharpFunc<ref Unit, FSharpFunc<ref TStateMachine, Unit>>>)(object)awaitOnCompleted, ref *(TStateMachine*)builder, ref Unsafe.As<TAwaiter, Unit>(ref awaiter), ref stateMachine);
}
}
[Serializable]
[CompilationMapping(/*Could not decode attribute arguments.*/)]
internal class Async
{
[CompilationArgumentCounts(new int[] { 1, 1 })]
internal static FSharpAsync<b> map<a, b>(FSharpFunc<a, b> f, FSharpAsync<a> x)
{
FSharpFunc<a, FSharpAsync<b>> binder = new $AsyncEx.map@11-1<a, b>(f);
return AsyncPrimitives.MakeAsync<b>((FSharpFunc<AsyncActivation<b>, AsyncReturn>)new $AsyncEx.map@11-3<a, b>(x, binder));
}
}
[Serializable]
[CompilationMapping(/*Could not decode attribute arguments.*/)]
public class AsyncEx
{
public static FSharpAsync<a> AwaitAwaiter<Awaiter, a>(Awaiter awaiter) where Awaiter : ICriticalNotifyCompletion
{
return FSharpAsync.FromContinuations<a>((FSharpFunc<Tuple<FSharpFunc<a, Unit>, FSharpFunc<Exception, Unit>, FSharpFunc<OperationCanceledException, Unit>>, Unit>)new $AsyncEx.AwaitAwaiter@42<Awaiter, a>(awaiter));
}
public static FSharpAsync<a> AwaitAwaiter$W<Awaiter, a>(FSharpFunc<Awaiter, a> getResult, FSharpFunc<Awaiter, bool> get_IsCompleted, Awaiter awaiter) where Awaiter : ICriticalNotifyCompletion
{
return FSharpAsync.FromContinuations<a>((FSharpFunc<Tuple<FSharpFunc<a, Unit>, FSharpFunc<Exception, Unit>, FSharpFunc<OperationCanceledException, Unit>>, Unit>)new $AsyncEx.AwaitAwaiter@42-2<Awaiter, a>(getResult, get_IsCompleted, awaiter));
}
public static FSharpAsync<b> AwaitAwaitable<Awaitable, a, b>(Awaitable awaitable) where a : ICriticalNotifyCompletion
{
if (0 == 0)
{
throw new NotSupportedException("Dynamic invocation of GetAwaiter is not supported");
}
a awaiter = (a)(object)null;
return FSharpAsync.FromContinuations<b>((FSharpFunc<Tuple<FSharpFunc<b, Unit>, FSharpFunc<Exception, Unit>, FSharpFunc<OperationCanceledException, Unit>>, Unit>)new $AsyncEx.AwaitAwaitable@62<a, b>(awaiter));
}
public static FSharpAsync<b> AwaitAwaitable$W<Awaitable, a, b>(FSharpFunc<Awaitable, a> getAwaiter, FSharpFunc<a, b> getResult, FSharpFunc<a, bool> get_IsCompleted, Awaitable awaitable) where a : ICriticalNotifyCompletion
{
a awaiter = getAwaiter.Invoke(awaitable);
return FSharpAsync.FromContinuations<b>((FSharpFunc<Tuple<FSharpFunc<b, Unit>, FSharpFunc<Exception, Unit>, FSharpFunc<OperationCanceledException, Unit>>, Unit>)new $AsyncEx.AwaitAwaitable@62-2<a, b>(getResult, get_IsCompleted, awaiter));
}
public static FSharpAsync<Unit> AwaitTask(Task task)
{
TaskAwaiter awaiter = task.GetAwaiter();
return FSharpAsync.FromContinuations<Unit>((FSharpFunc<Tuple<FSharpFunc<Unit, Unit>, FSharpFunc<Exception, Unit>, FSharpFunc<OperationCanceledException, Unit>>, Unit>)new $AsyncEx.AwaitTask@73(awaiter));
}
public static FSharpAsync<T> AwaitTask<T>(Task<T> task)
{
TaskAwaiter<T> awaiter = task.GetAwaiter();
return FSharpAsync.FromContinuations<T>((FSharpFunc<Tuple<FSharpFunc<T, Unit>, FSharpFunc<Exception, Unit>, FSharpFunc<OperationCanceledException, Unit>>, Unit>)new $AsyncEx.AwaitTask@85-2<T>(awaiter));
}
public static FSharpAsync<a> AwaitValueTask<a>(ValueTask<a> vTask)
{
if (vTask.IsCompletedSuccessfully)
{
a result = vTask.Result;
return AsyncPrimitives.MakeAsync<a>((FSharpFunc<AsyncActivation<a>, AsyncReturn>)new $AsyncEx.AwaitValueTask@100<a>(result));
}
return AwaitTask(vTask.AsTask());
}
public static FSharpAsync<Unit> AwaitValueTask(ValueTask vTask)
{
if (vTask.IsCompletedSuccessfully)
{
return AsyncPrimitives.MakeAsync<Unit>((FSharpFunc<AsyncActivation<Unit>, AsyncReturn>)$AsyncEx.AwaitValueTask@117-1.@_instance);
}
return AwaitTask(vTask.AsTask());
}
}
[Serializable]
[CompilationMapping(/*Could not decode attribute arguments.*/)]
public class AsyncExBuilder
{
public FSharpAsync<Unit> Zero()
{
return ExtraTopLevelOperators.DefaultAsyncBuilder.Zero();
}
public FSharpAsync<j> Delay<j>([InlineIfLambda] FSharpFunc<Unit, FSharpAsync<j>> generator)
{
return ExtraTopLevelOperators.DefaultAsyncBuilder.Delay<j>(generator);
}
public FSharpAsync<i> Return<i>(i value)
{
return AsyncPrimitives.MakeAsync<i>((FSharpFunc<AsyncActivation<i>, AsyncReturn>)new $AsyncEx.Return@196-1<i>(value));
}
public FSharpAsync<c> ReturnFrom<c>(FSharpAsync<c> computation)
{
return computation;
}
public FSharpAsync<f0> Bind<f, f0>(FSharpAsync<f> computation, [InlineIfLambda] FSharpFunc<f, FSharpAsync<f0>> binder)
{
return AsyncPrimitives.MakeAsync<f0>((FSharpFunc<AsyncActivation<f0>, AsyncReturn>)new $AsyncEx.Bind@201-4<f, f0>(computation, binder));
}
public FSharpAsync<ok> TryFinallyAsync<ok>(FSharpAsync<ok> computation, [InlineIfLambda] FSharpFunc<Unit, ValueTask> compensation)
{
FSharpAsync<Unit> compensation2 = ExtraTopLevelOperators.DefaultAsyncBuilder.Delay<Unit>((FSharpFunc<Unit, FSharpAsync<Unit>>)new $AsyncEx.compensation@209(compensation));
object @_instance;
@_instance = $AsyncEx.finish@142-2.@_instance;
object startDeferred@156- = new $AsyncEx.startDeferred@156-5(compensation2, @_instance);
FSharpFunc<CancellationToken, FSharpFunc<Tuple<FSharpFunc<ok, Unit>, FSharpFunc<Exception, Unit>, FSharpFunc<OperationCanceledException, Unit>>, Unit>> startComp = (FSharpFunc<CancellationToken, FSharpFunc<Tuple<FSharpFunc<ok, Unit>, FSharpFunc<Exception, Unit>, FSharpFunc<OperationCanceledException, Unit>>, Unit>>)(object)new $AsyncEx.TryFinallyAsync@211-12<ok>(computation, startDeferred@156-);
return ExtraTopLevelOperators.DefaultAsyncBuilder.Delay<ok>((FSharpFunc<Unit, FSharpAsync<ok>>)new $AsyncEx.TryFinallyAsync@211-16<ok>(startComp));
}
public FSharpAsync<ok> Using<b, ok>(b resource, [InlineIfLambda] FSharpFunc<b, FSharpAsync<ok>> binder) where b : IAsyncDisposable
{
FSharpAsync<ok> computation = binder.Invoke(resource);
FSharpAsync<Unit> compensation = ExtraTopLevelOperators.DefaultAsyncBuilder.Delay<Unit>((FSharpFunc<Unit, FSharpAsync<Unit>>)new $AsyncEx.Using@218-14<b>(resource));
object @_instance;
@_instance = $AsyncEx.finish@142-4.@_instance;
object startDeferred@156- = new $AsyncEx.startDeferred@156-10(compensation, @_instance);
FSharpFunc<CancellationToken, FSharpFunc<Tuple<FSharpFunc<ok, Unit>, FSharpFunc<Exception, Unit>, FSharpFunc<OperationCanceledException, Unit>>, Unit>> startComp = (FSharpFunc<CancellationToken, FSharpFunc<Tuple<FSharpFunc<ok, Unit>, FSharpFunc<Exception, Unit>, FSharpFunc<OperationCanceledException, Unit>>, Unit>>)(object)new $AsyncEx.Using@218-16<ok>(computation, startDeferred@156-);
return ExtraTopLevelOperators.DefaultAsyncBuilder.Delay<ok>((FSharpFunc<Unit, FSharpAsync<ok>>)new $AsyncEx.Using@218-20<ok>(startComp));
}
internal FSharpAsync<Unit> WhileAsync(FSharpAsync<bool> guard, FSharpAsync<Unit> computation)
{
return ExtraTopLevelOperators.DefaultAsyncBuilder.Delay<Unit>((FSharpFunc<Unit, FSharpAsync<Unit>>)new $AsyncEx.WhileAsync@231-14(guard, computation));
}
public FSharpAsync<Unit> For<e>(IAsyncEnumerable<e> sequence, [InlineIfLambda] FSharpFunc<e, FSharpAsync<Unit>> body)
{
FSharpAsync<CancellationToken> cancellationToken = FSharpAsync.CancellationToken;
return AsyncPrimitives.MakeAsync<Unit>((FSharpFunc<AsyncActivation<Unit>, AsyncReturn>)new $AsyncEx.For@243-40<e>(sequence, body, cancellationToken));
}
public FSharpAsync<Unit> While([InlineIfLambda] FSharpFunc<Unit, bool> guard, FSharpAsync<Unit> computation)
{
return ExtraTopLevelOperators.DefaultAsyncBuilder.While(guard, computation);
}
public FSharpAsync<Unit> For<e>(IEnumerable<e> sequence, [InlineIfLambda] FSharpFunc<e, FSharpAsync<Unit>> body)
{
return ExtraTopLevelOperators.DefaultAsyncBuilder.For<e>(sequence, body);
}
public FSharpAsync<a> Combine<a>(FSharpAsync<Unit> computation1, FSharpAsync<a> computation2)
{
FSharpFunc<Unit, FSharpAsync<a>> part = new $AsyncEx.Combine@269-1<a>(computation2);
return AsyncPrimitives.MakeAsync<a>((FSharpFunc<AsyncActivation<a>, AsyncReturn>)new $AsyncEx.Combine@269-2<a>(computation1, part));
}
public FSharpAsync<a> TryFinally<a>(FSharpAsync<a> computation, [InlineIfLambda] FSharpFunc<Unit, Unit> compensation)
{
return AsyncPrimitives.MakeAsync<a>((FSharpFunc<AsyncActivation<a>, AsyncReturn>)new $AsyncEx.TryFinally@276-3<a>(computation, compensation));
}
public FSharpAsync<a> TryWith<a>(FSharpAsync<a> computation, [InlineIfLambda] FSharpFunc<Exception, FSharpAsync<a>> catchHandler)
{
return AsyncPrimitives.MakeAsync<a>((FSharpFunc<AsyncActivation<a>, AsyncReturn>)new $AsyncEx.TryWith@283-1<a>(computation, catchHandler));
}
public FSharpAsync<a> Source<a>(FSharpAsync<a> async)
{
return async;
}
}
[Serializable]
[CompilationMapping(/*Could not decode attribute arguments.*/)]
public class ParallelAsync
{
[CompilationArgumentCounts(new int[] { 1, 1 })]
public static FSharpAsync<Tuple<left, right>> zipWithStartChild<left, right>(FSharpAsync<left> a1, FSharpAsync<right> a2)
{
FSharpAsync<FSharpAsync<left>> computation = FSharpAsync.StartChild<left>(a1, (FSharpOption<int>)null);
FSharpFunc<FSharpAsync<left>, FSharpAsync<Tuple<left, right>>> binder = new $ParallelAsync.zipWithStartChild@26<left, right>(a2);
return AsyncPrimitives.MakeAsync<Tuple<left, right>>((FSharpFunc<AsyncActivation<Tuple<left, right>>, AsyncReturn>)new $ParallelAsync.zipWithStartChild@24-8<left, right>(computation, binder));
}
[CompilationArgumentCounts(new int[] { 1, 1 })]
public static FSharpAsync<Tuple<left, right>> zipUsingStartImmediateAsTask<left, right>(FSharpAsync<left> a1, FSharpAsync<right> a2)
{
FSharpAsync<CancellationToken> cancellationToken = FSharpAsync.CancellationToken;
FSharpFunc<CancellationToken, FSharpAsync<Tuple<left, right>>> binder = new $ParallelAsync.zipUsingStartImmediateAsTask@56<left, right>(a1, a2);
return AsyncPrimitives.MakeAsync<Tuple<left, right>>((FSharpFunc<AsyncActivation<Tuple<left, right>>, AsyncReturn>)new $ParallelAsync.zipUsingStartImmediateAsTask@54-6<left, right>(cancellationToken, binder));
}
}
[Serializable]
[CompilationMapping(/*Could not decode attribute arguments.*/)]
public class ParallelAsyncBuilderBase
{
public FSharpAsync<Unit> Zero()
{
return ExtraTopLevelOperators.DefaultAsyncBuilder.Zero();
}
public FSharpAsync<l> Delay<l>(FSharpFunc<Unit, FSharpAsync<l>> generator)
{
return ExtraTopLevelOperators.DefaultAsyncBuilder.Delay<l>(generator);
}
public FSharpAsync<k> Return<k>(k value)
{
return AsyncPrimitives.MakeAsync<k>((FSharpFunc<AsyncActivation<k>, AsyncReturn>)new $ParallelAsync.Return@73-2<k>(value));
}
public FSharpAsync<j> ReturnFrom<j>(FSharpAsync<j> computation)
{
return computation;
}
public FSharpAsync<i> Bind<h, i>(FSharpAsync<h> computation, FSharpFunc<h, FSharpAsync<i>> binder)
{
return AsyncPrimitives.MakeAsync<i>((FSharpFunc<AsyncActivation<i>, AsyncReturn>)new $ParallelAsync.Bind@77-5<h, i>(computation, binder));
}
public FSharpAsync<g> Using<f, g>(f resource, FSharpFunc<f, FSharpAsync<g>> binder) where f : IDisposable
{
return ExtraTopLevelOperators.DefaultAsyncBuilder.Using<f, g>(resource, binder);
}
public FSharpAsync<Unit> While(FSharpFunc<Unit, bool> guard, FSharpAsync<Unit> computation)
{
return ExtraTopLevelOperators.DefaultAsyncBuilder.While(guard, computation);
}
public FSharpAsync<Unit> For<e>(IEnumerable<e> sequence, FSharpFunc<e, FSharpAsync<Unit>> body)
{
return ExtraTopLevelOperators.DefaultAsyncBuilder.For<e>(sequence, body);
}
public FSharpAsync<d> Combine<d>(FSharpAsync<Unit> computation1, FSharpAsync<d> computation2)
{
FSharpFunc<Unit, FSharpAsync<d>> part = new $ParallelAsync.Combine@86-3<d>(computation2);
return AsyncPrimitives.MakeAsync<d>((FSharpFunc<AsyncActivation<d>, AsyncReturn>)new $ParallelAsync.Combine@86-4<d>(computation1, part));
}
public FSharpAsync<c> TryFinally<c>(FSharpAsync<c> computation, FSharpFunc<Unit, Unit> compensation)
{
return AsyncPrimitives.MakeAsync<c>((FSharpFunc<AsyncActivation<c>, AsyncReturn>)new $ParallelAsync.TryFinally@89-4<c>(computation, compensation));
}
public FSharpAsync<b> TryWith<b>(FSharpAsync<b> computation, FSharpFunc<Exception, FSharpAsync<b>> catchHandler)
{
return AsyncPrimitives.MakeAsync<b>((FSharpFunc<AsyncActivation<b>, AsyncReturn>)new $ParallelAsync.TryWith@92-3<b>(computation, catchHandler));
}
public FSharpAsync<a> BindReturn<T, a>(FSharpAsync<T> x, FSharpFunc<T, a> f)
{
FSharpFunc<T, FSharpAsync<a>> binder = new $ParallelAsync.BindReturn@94-8<T, a>(f);
return AsyncPrimitives.MakeAsync<a>((FSharpFunc<AsyncActivation<a>, AsyncReturn>)new $ParallelAsync.BindReturn@94-10<T, a>(x, binder));
}
}
[Serializable]
[CompilationMapping(/*Could not decode attribute arguments.*/)]
public class ParallelAsyncBuilderUsingStartChild : ParallelAsyncBuilderBase
{
public FSharpAsync<Tuple<T, T1>> MergeSources<T, T1>(FSharpAsync<T> t1, FSharpAsync<T1> t2)
{
return ParallelAsync.zipWithStartChild<T, T1>(t1, t2);
}
}
[Serializable]
[CompilationMapping(/*Could not decode attribute arguments.*/)]
public class ParallelAsyncBuilderUsingStartImmediateAsTask : ParallelAsyncBuilderBase
{
public FSharpAsync<Tuple<T, T1>> MergeSources<T, T1>(FSharpAsync<T> t1, FSharpAsync<T1> t2)
{
FSharpAsync<CancellationToken> cancellationToken = FSharpAsync.CancellationToken;
FSharpFunc<CancellationToken, FSharpAsync<Tuple<T, T1>>> binder = new $ParallelAsync.MergeSources@114-16<T, T1>(t1, t2);
return AsyncPrimitives.MakeAsync<Tuple<T, T1>>((FSharpFunc<AsyncActivation<Tuple<T, T1>>, AsyncReturn>)new $ParallelAsync.MergeSources@114-22<T, T1>(cancellationToken, binder));
}
}
[AutoOpen]
[CompilationMapping(/*Could not decode attribute arguments.*/)]
public static class CancellableTasks
{
[Serializable]
[CompilationMapping(/*Could not decode attribute arguments.*/)]
public class CancellableTaskBuilder : CancellableTaskBase.CancellableTaskBuilderBase
{
public static FSharpFunc<CancellationToken, Task<T>> RunDynamic<T>(ResumableCode<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>, T> code)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
FSharpRef<ResumableStateMachine<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>>> sm = new FSharpRef<ResumableStateMachine<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>>>(default(ResumableStateMachine<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>>));
ResumptionFunc<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>> initialResumptionFunc = new initialResumptionFunc@55-6<T>(code).Invoke;
ResumptionDynamicInfo<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>> resumptionInfo = new resumptionInfo@58-6<T>(initialResumptionFunc);
return new RunDynamic@92-19<T>(sm, resumptionInfo);
}
public FSharpFunc<CancellationToken, Task<T>> Run<T>(ResumableCode<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>, T> code)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
FSharpRef<ResumableStateMachine<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>>> sm = new FSharpRef<ResumableStateMachine<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>>>(default(ResumableStateMachine<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>>));
ResumptionFunc<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>> initialResumptionFunc = new Run@142-31<T>(code).Invoke;
ResumptionDynamicInfo<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>> resumptionInfo = new Run@142-32<T>(initialResumptionFunc);
return new Run@142-33<T>(sm, resumptionInfo);
}
public FSharpFunc<CancellationToken, TaskAwaiter<i>> Source<i>([InlineIfLambda] FSharpFunc<CancellationToken, Task<i>> x)
{
return new Source@148-1<i>(x);
}
[NoEagerConstraintApplication]
public FSharpFunc<CancellationToken, TaskAwaiter<(g, h)>> MergeSources<Awaiter1, g, Awaiter2, h>([InlineIfLambda] FSharpFunc<CancellationToken, Awaiter1> left, [InlineIfLambda] FSharpFunc<CancellationToken, Awaiter2> right) where Awaiter1 : ICriticalNotifyCompletion where Awaiter2 : ICriticalNotifyCompletion
{
MergeSources@157-47<Awaiter1, g, Awaiter2, h> mergeSources@157- = default(MergeSources@157-47<Awaiter1, g, Awaiter2, h>);
[email protected] = left;
[email protected] = right;
mergeSources@157- = mergeSources@157-;
FSharpFunc<CancellationToken, Task<(g, h)>> x = new MergeSources@157-48<Awaiter1, g, Awaiter2, h>(mergeSources@157-);
return new MergeSources@156-49<g, h>(x);
}
[NoEagerConstraintApplication]
public FSharpFunc<CancellationToken, TaskAwaiter<(g, h)>> MergeSources$W<Awaiter1, g, Awaiter2, h>(FSharpFunc<Awaiter1, g> getResult, FSharpFunc<Awaiter2, h> getResult1, FSharpFunc<Awaiter1, bool> get_IsCompleted, FSharpFunc<Awaiter2, bool> get_IsCompleted3, [InlineIfLambda] FSharpFunc<CancellationToken, Awaiter1> left, [InlineIfLambda] FSharpFunc<CancellationToken, Awaiter2> right) where Awaiter1 : ICriticalNotifyCompletion where Awaiter2 : ICriticalNotifyCompletion
{
MergeSources@157-50<Awaiter1, g, Awaiter2, h> mergeSources@157- = default(MergeSources@157-50<Awaiter1, g, Awaiter2, h>);
[email protected] = (FSharpFunc<Awaiter1, g>)(object)left;
[email protected] = (FSharpFunc<Awaiter2, h>)(object)right;
mergeSources@157- = mergeSources@157-;
FSharpFunc<CancellationToken, Task<(g, h)>> x = new MergeSources@157-51<Awaiter1, g, Awaiter2, h>(getResult, getResult1, get_IsCompleted, get_IsCompleted3, mergeSources@157-);
return new MergeSources@156-52<g, h>(x);
}
[NoEagerConstraintApplication]
public FSharpFunc<CancellationToken, TaskAwaiter<(e, f)>> MergeSources<Awaiter1, e, Awaiter2, f>(Awaiter1 left, [InlineIfLambda] FSharpFunc<CancellationToken, Awaiter2> right) where Awaiter1 : ICriticalNotifyCompletion where Awaiter2 : ICriticalNotifyCompletion
{
MergeSources@180-53<Awaiter1, e, Awaiter2, f> mergeSources@180- = default(MergeSources@180-53<Awaiter1, e, Awaiter2, f>);
[email protected] = left;
[email protected] = right;
mergeSources@180- = mergeSources@180-;
FSharpFunc<CancellationToken, Task<(e, f)>> x = new MergeSources@180-54<Awaiter1, e, Awaiter2, f>(mergeSources@180-);
return new MergeSources@179-55<e, f>(x);
}
[NoEagerConstraintApplication]
public FSharpFunc<CancellationToken, TaskAwaiter<(e, f)>> MergeSources$W<Awaiter1, e, Awaiter2, f>(FSharpFunc<Awaiter1, e> getResult, FSharpFunc<Awaiter2, f> getResult1, FSharpFunc<Awaiter1, bool> get_IsCompleted, FSharpFunc<Awaiter2, bool> get_IsCompleted3, Awaiter1 left, [InlineIfLambda] FSharpFunc<CancellationToken, Awaiter2> right) where Awaiter1 : ICriticalNotifyCompletion where Awaiter2 : ICriticalNotifyCompletion
{
MergeSources@180-56<Awaiter1, e, Awaiter2, f> mergeSources@180- = default(MergeSources@180-56<Awaiter1, e, Awaiter2, f>);
[email protected] = (FSharpFunc<Awaiter1, e>)left;
[email protected] = (FSharpFunc<Awaiter2, f>)(object)right;
mergeSources@180- = mergeSources@180-;
FSharpFunc<CancellationToken, Task<(e, f)>> x = new MergeSources@180-57<Awaiter1, e, Awaiter2, f>(getResult, getResult1, get_IsCompleted, get_IsCompleted3, mergeSources@180-);
return new MergeSources@179-58<e, f>(x);
}
[NoEagerConstraintApplication]
public FSharpFunc<CancellationToken, TaskAwaiter<(c, d)>> MergeSources<Awaiter1, c, Awaiter2, d>([InlineIfLambda] FSharpFunc<CancellationToken, Awaiter1> left, Awaiter2 right) where Awaiter1 : ICriticalNotifyCompletion where Awaiter2 : ICriticalNotifyCompletion
{
MergeSources@203-59<Awaiter1, c, Awaiter2, d> mergeSources@203- = default(MergeSources@203-59<Awaiter1, c, Awaiter2, d>);
[email protected] = left;
[email protected] = right;
mergeSources@203- = mergeSources@203-;
FSharpFunc<CancellationToken, Task<(c, d)>> x = new MergeSources@203-60<Awaiter1, c, Awaiter2, d>(mergeSources@203-);
return new MergeSources@202-61<c, d>(x);
}
[NoEagerConstraintApplication]
public FSharpFunc<CancellationToken, TaskAwaiter<(c, d)>> MergeSources$W<Awaiter1, c, Awaiter2, d>(FSharpFunc<Awaiter1, c> getResult, FSharpFunc<Awaiter2, d> getResult1, FSharpFunc<Awaiter1, bool> get_IsCompleted, FSharpFunc<Awaiter2, bool> get_IsCompleted3, [InlineIfLambda] FSharpFunc<CancellationToken, Awaiter1> left, Awaiter2 right) where Awaiter1 : ICriticalNotifyCompletion where Awaiter2 : ICriticalNotifyCompletion
{
MergeSources@203-62<Awaiter1, c, Awaiter2, d> mergeSources@203- = default(MergeSources@203-62<Awaiter1, c, Awaiter2, d>);
[email protected] = (FSharpFunc<Awaiter1, c>)(object)left;
[email protected] = (FSharpFunc<Awaiter2, d>)right;
mergeSources@203- = mergeSources@203-;
FSharpFunc<CancellationToken, Task<(c, d)>> x = new MergeSources@203-63<Awaiter1, c, Awaiter2, d>(getResult, getResult1, get_IsCompleted, get_IsCompleted3, mergeSources@203-);
return new MergeSources@202-64<c, d>(x);
}
[NoEagerConstraintApplication]
public FSharpFunc<CancellationToken, TaskAwaiter<(a, b)>> MergeSources<Awaiter1, a, Awaiter2, b>(Awaiter1 left, Awaiter2 right) where Awaiter1 : ICriticalNotifyCompletion where Awaiter2 : ICriticalNotifyCompletion
{
MergeSources@221-65<Awaiter1, a, Awaiter2, b> mergeSources@221- = default(MergeSources@221-65<Awaiter1, a, Awaiter2, b>);
[email protected] = left;
[email protected] = right;
mergeSources@221- = mergeSources@221-;
FSharpFunc<CancellationToken, Task<(a, b)>> x = new MergeSources@221-66<Awaiter1, a, Awaiter2, b>(mergeSources@221-);
return new MergeSources@220-67<a, b>(x);
}
[NoEagerConstraintApplication]
public FSharpFunc<CancellationToken, TaskAwaiter<(a, b)>> MergeSources$W<Awaiter1, a, Awaiter2, b>(FSharpFunc<Awaiter1, a> getResult, FSharpFunc<Awaiter2, b> getResult1, FSharpFunc<Awaiter1, bool> get_IsCompleted, FSharpFunc<Awaiter2, bool> get_IsCompleted3, Awaiter1 left, Awaiter2 right) where Awaiter1 : ICriticalNotifyCompletion where Awaiter2 : ICriticalNotifyCompletion
{
MergeSources@221-68<Awaiter1, a, Awaiter2, b> mergeSources@221- = default(MergeSources@221-68<Awaiter1, a, Awaiter2, b>);
[email protected] = (FSharpFunc<Awaiter1, a>)left;
[email protected] = (FSharpFunc<Awaiter2, b>)right;
mergeSources@221- = mergeSources@221-;
FSharpFunc<CancellationToken, Task<(a, b)>> x = new MergeSources@221-69<Awaiter1, a, Awaiter2, b>(getResult, getResult1, get_IsCompleted, get_IsCompleted3, mergeSources@221-);
return new MergeSources@220-70<a, b>(x);
}
}
[Serializable]
[SpecialName]
[StructLayout(LayoutKind.Auto, CharSet = CharSet.Auto)]
[CompilationMapping(/*Could not decode attribute arguments.*/)]
internal sealed class initialResumptionFunc@55-6<T>
{
public ResumableCode<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>, T> code;
public initialResumptionFunc@55-6(ResumableCode<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>, T> code)
{
this.code = code;
base..ctor();
}
internal bool Invoke(ref ResumableStateMachine<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>> sm)
{
return ((ResumableCode<CancellableTaskBase.CancellableTaskBaseStateMachineData<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>, AsyncTaskMethodBuilder<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>>>, CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>>)(object)code).Invoke(ref Unsafe.As<ResumableStateMachine<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>>, ResumableStateMachine<CancellableTaskBase.CancellableTaskBaseStateMachineData<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>, AsyncTaskMethodBuilder<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>>>>>(ref sm));
}
}
[Serializable]
[SpecialName]
[StructLayout(LayoutKind.Auto, CharSet = CharSet.Auto)]
[CompilationMapping(/*Could not decode attribute arguments.*/)]
internal sealed class resumptionInfo@58-6<T> : ResumptionDynamicInfo<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>>
{
public ResumptionFunc<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>> initialResumptionFunc;
public resumptionInfo@58-6(ResumptionFunc<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>> initialResumptionFunc)
{
this.initialResumptionFunc = initialResumptionFunc;
((ResumptionDynamicInfo<CancellableTaskBase.CancellableTaskBaseStateMachineData<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>, AsyncTaskMethodBuilder<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>>>>)(object)this)..ctor((ResumptionFunc<CancellableTaskBase.CancellableTaskBaseStateMachineData<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>, AsyncTaskMethodBuilder<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>>>>)(object)this.initialResumptionFunc);
}
public override void MoveNext(ref ResumableStateMachine<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>> sm)
{
Exception ex = null;
Exception ex2;
try
{
((ResumptionDynamicInfo<CancellableTaskBase.CancellableTaskBaseStateMachineData<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>, AsyncTaskMethodBuilder<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>>>>)(object)sm.ResumptionDynamicInfo).ResumptionData = null;
if (((ResumptionFunc<CancellableTaskBase.CancellableTaskBaseStateMachineData<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>, AsyncTaskMethodBuilder<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>>>>)(object)((ResumptionDynamicInfo<CancellableTaskBase.CancellableTaskBaseStateMachineData<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>, AsyncTaskMethodBuilder<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>>>>)(object)this).ResumptionFunc).Invoke(ref Unsafe.As<ResumableStateMachine<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>>, ResumableStateMachine<CancellableTaskBase.CancellableTaskBaseStateMachineData<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>, AsyncTaskMethodBuilder<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>>>>>(ref sm)))
{
sm.Data.MethodBuilder.SetResult(sm.Data.Result);
}
else
{
ICriticalNotifyCompletion awaiter = (ICriticalNotifyCompletion)((ResumptionDynamicInfo<CancellableTaskBase.CancellableTaskBaseStateMachineData<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>, AsyncTaskMethodBuilder<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>>>>)(object)sm.ResumptionDynamicInfo).ResumptionData;
sm.Data.MethodBuilder.AwaitUnsafeOnCompleted<ICriticalNotifyCompletion, ResumableStateMachine<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>>>(ref awaiter, ref sm);
}
}
catch (object obj)
{
ex2 = (Exception)obj;
ex = ex2;
}
ex2 = ex;
if (ex2 != null)
{
sm.Data.MethodBuilder.SetException(ex2);
}
}
public override void SetStateMachine(ref ResumableStateMachine<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>> sm, IAsyncStateMachine state)
{
sm.Data.MethodBuilder.SetStateMachine(state);
}
}
[Serializable]
internal sealed class RunDynamic@92-19<T> : FSharpFunc<CancellationToken, Task<T>>
{
public FSharpRef<ResumableStateMachine<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>>> sm;
public ResumptionDynamicInfo<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>> resumptionInfo;
[CompilerGenerated]
[DebuggerNonUserCode]
internal RunDynamic@92-19(FSharpRef<ResumableStateMachine<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>>> sm, ResumptionDynamicInfo<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>> resumptionInfo)
{
((FSharpFunc<CancellationToken, Task<CancellationToken>>)(object)this)..ctor();
this.sm = sm;
this.resumptionInfo = resumptionInfo;
}
public override Task<T> Invoke(CancellationToken ct)
{
if (ct.IsCancellationRequested)
{
return Task.FromCanceled<T>(ct);
}
[email protected] = ct;
[email protected] = resumptionInfo;
[email protected] = AsyncTaskMethodBuilder<T>.Create();
[email protected]<ResumableStateMachine<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>>>(ref sm.contents@);
return [email protected];
}
}
[Serializable]
[SpecialName]
[StructLayout(LayoutKind.Auto, CharSet = CharSet.Auto)]
[CompilationMapping(/*Could not decode attribute arguments.*/)]
internal sealed class Run@142-31<T>
{
public ResumableCode<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>, T> code;
public Run@142-31(ResumableCode<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>, T> code)
{
this.code = code;
base..ctor();
}
internal bool Invoke(ref ResumableStateMachine<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>> sm)
{
return ((ResumableCode<CancellableTaskBase.CancellableTaskBaseStateMachineData<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>, AsyncTaskMethodBuilder<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>>>, CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>>)(object)code).Invoke(ref Unsafe.As<ResumableStateMachine<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>>, ResumableStateMachine<CancellableTaskBase.CancellableTaskBaseStateMachineData<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>, AsyncTaskMethodBuilder<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>>>>>(ref sm));
}
}
[Serializable]
[SpecialName]
[StructLayout(LayoutKind.Auto, CharSet = CharSet.Auto)]
[CompilationMapping(/*Could not decode attribute arguments.*/)]
internal sealed class Run@142-32<T> : ResumptionDynamicInfo<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>>
{
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
[CompilerGenerated]
[DebuggerNonUserCode]
public ResumptionFunc<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>> initialResumptionFunc;
public Run@142-32(ResumptionFunc<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>> initialResumptionFunc)
{
this.initialResumptionFunc = initialResumptionFunc;
((ResumptionDynamicInfo<CancellableTaskBase.CancellableTaskBaseStateMachineData<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>, AsyncTaskMethodBuilder<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>>>>)(object)this)..ctor((ResumptionFunc<CancellableTaskBase.CancellableTaskBaseStateMachineData<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>, AsyncTaskMethodBuilder<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>>>>)(object)this.initialResumptionFunc);
}
public override void MoveNext(ref ResumableStateMachine<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>> sm)
{
Exception ex = null;
Exception ex2;
try
{
((ResumptionDynamicInfo<CancellableTaskBase.CancellableTaskBaseStateMachineData<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>, AsyncTaskMethodBuilder<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>>>>)(object)sm.ResumptionDynamicInfo).ResumptionData = null;
if (((ResumptionFunc<CancellableTaskBase.CancellableTaskBaseStateMachineData<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>, AsyncTaskMethodBuilder<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>>>>)(object)((ResumptionDynamicInfo<CancellableTaskBase.CancellableTaskBaseStateMachineData<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>, AsyncTaskMethodBuilder<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>>>>)(object)this).ResumptionFunc).Invoke(ref Unsafe.As<ResumableStateMachine<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>>, ResumableStateMachine<CancellableTaskBase.CancellableTaskBaseStateMachineData<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>, AsyncTaskMethodBuilder<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>>>>>(ref sm)))
{
sm.Data.MethodBuilder.SetResult(sm.Data.Result);
}
else
{
ICriticalNotifyCompletion awaiter = (ICriticalNotifyCompletion)((ResumptionDynamicInfo<CancellableTaskBase.CancellableTaskBaseStateMachineData<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>, AsyncTaskMethodBuilder<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>>>>)(object)sm.ResumptionDynamicInfo).ResumptionData;
sm.Data.MethodBuilder.AwaitUnsafeOnCompleted<ICriticalNotifyCompletion, ResumableStateMachine<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>>>(ref awaiter, ref sm);
}
}
catch (object obj)
{
ex2 = (Exception)obj;
ex = ex2;
}
ex2 = ex;
if (ex2 != null)
{
sm.Data.MethodBuilder.SetException(ex2);
}
}
public override void SetStateMachine(ref ResumableStateMachine<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>> sm, IAsyncStateMachine state)
{
sm.Data.MethodBuilder.SetStateMachine(state);
}
}
[Serializable]
internal sealed class Run@142-33<T> : FSharpFunc<CancellationToken, Task<T>>
{
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
[CompilerGenerated]
[DebuggerNonUserCode]
public FSharpRef<ResumableStateMachine<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>>> sm;
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
[CompilerGenerated]
[DebuggerNonUserCode]
public ResumptionDynamicInfo<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>> resumptionInfo;
[CompilerGenerated]
[DebuggerNonUserCode]
internal Run@142-33(FSharpRef<ResumableStateMachine<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>>> sm, ResumptionDynamicInfo<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>> resumptionInfo)
{
((FSharpFunc<CancellationToken, Task<CancellationToken>>)(object)this)..ctor();
this.sm = sm;
this.resumptionInfo = resumptionInfo;
}
public override Task<T> Invoke(CancellationToken ct)
{
if (ct.IsCancellationRequested)
{
return Task.FromCanceled<T>(ct);
}
[email protected] = ct;
[email protected] = resumptionInfo;
[email protected] = AsyncTaskMethodBuilder<T>.Create();
[email protected]<ResumableStateMachine<CancellableTaskBase.CancellableTaskBaseStateMachineData<T, AsyncTaskMethodBuilder<T>>>>(ref sm.contents@);
return [email protected];
}
}
[Serializable]
internal sealed class Source@148-1<i> : FSharpFunc<CancellationToken, TaskAwaiter<i>>
{
public FSharpFunc<CancellationToken, Task<i>> x;
[CompilerGenerated]
[DebuggerNonUserCode]
internal Source@148-1(FSharpFunc<CancellationToken, Task<i>> x)
{
((FSharpFunc<CancellationToken, TaskAwaiter<CancellationToken>>)(object)this)..ctor();
this.x = x;
}
public override TaskAwaiter<i> Invoke(CancellationToken ct)
{
return ((FSharpFunc<CancellationToken, Task<CancellationToken>>)(object)x).Invoke(ct).GetAwaiter();
}
}
[SpecialName]
[StructLayout(LayoutKind.Auto, CharSet = CharSet.Auto)]
[CompilerGenerated]
[CompilationMapping(/*Could not decode attribute arguments.*/)]
internal struct MergeSources@157-47<Awaiter1, g, Awaiter2, h> : IAsyncStateMachine, IResumableStateMachine<CancellableTaskBase.CancellableTaskBaseStateMachineData<(g, h), AsyncTaskMethodBuilder<(g, h)>>> where Awaiter1 : ICriticalNotifyCompletion where Awaiter2 : ICriticalNotifyCompletion
{
public CancellableTaskBase.CancellableTaskBaseStateMachineData<(g, h), AsyncTaskMethodBuilder<(g, h)>> Data;
public int ResumptionPoint;
public FSharpFunc<CancellationToken, Awaiter1> left;
public FSharpFunc<CancellationToken, Awaiter2> right;
public Awaiter2 right0;
public g leftR;
public Awaiter2 awaiter;
public Awaiter1 awaiter0;
public ValueTaskAwaiter<CancellationToken> awaiter1;
public override void MoveNext()
{
int resumptionPoint = ResumptionPoint;
Exception ex = default(Exception);
switch (resumptionPoint)
{
default:
ex = null;
break;
case 1:
case 2:
case 3:
break;
}
Exception ex2;
try
{
bool flag;
int num;
int num2;
int num3;
bool flag2;
int num4;
bool flag3;
int num5;
bool flag4;
int num6;
ICriticalNotifyCompletion criticalNotifyCompletion;
switch (resumptionPoint)
{
default:
{
Data.CancellationToken.ThrowIfCancellationRequested();
CancellationToken cancellationToken = Data.CancellationToken;
awaiter1 = new ValueTask<CancellationToken>(cancellationToken).GetAwaiter();
flag = true;
if (awaiter1.IsCompleted)
{
goto IL_00ac;
}
if (false)
{
goto case 1;
}
ResumptionPoint = 1;
num = 0;
goto IL_00a2;
}
case 1:
num = 1;
goto IL_00a2;
case 2:
num2 = 1;
goto IL_0129;
case 3:
{
num3 = 1;
goto IL_01a3;
}
IL_0129:
flag2 = (byte)num2 != 0;
flag3 = flag2;
goto IL_0133;
IL_0133:
if (flag3)
{
if (0 == 0)
{
throw new NotSupportedException("Dynamic invocation of GetResult is not supported");
}
g val = (g)(object)null;
leftR = val;
Data.CancellationToken.ThrowIfCancellationRequested();
awaiter = right0;
flag2 = true;
if (0 == 0)
{
throw new NotSupportedException("Dynamic invocation of get_IsCompleted is not supported");
}
if ((bool)(object)null)
{
goto IL_01ad;
}
if (false)
{
goto case 3;
}
ResumptionPoint = 3;
num3 = 0;
goto IL_01a3;
}
criticalNotifyCompletion = (ICriticalNotifyCompletion)(object)awaiter0;
Data.MethodBuilder.AwaitUnsafeOnCompleted(ref criticalNotifyCompletion, ref this);
num4 = 0;
goto IL_026d;
IL_00a2:
flag3 = (byte)num != 0;
flag = flag3;
goto IL_00ac;
IL_00ac:
if (flag)
{
CancellationToken cancellationToken = awaiter1.GetResult();
CancellationToken cancellationToken2 = cancellationToken;
Awaiter1 val2 = ((FSharpFunc<CancellationToken, CancellationToken>)(object)left).Invoke(cancellationToken2);
right0 = ((FSharpFunc<CancellationToken, ?>)(object)right).Invoke(cancellationToken2);
Data.CancellationToken.ThrowIfCancellationRequested();
awaiter0 = val2;
flag3 = true;
if (0 == 0)
{
throw new NotSupportedException("Dynamic invocation of get_IsCompleted is not supported");
}
if ((bool)(object)null)
{
goto IL_0133;
}
if (false)
{
goto case 2;
}
ResumptionPoint = 2;
num2 = 0;
goto IL_0129;
}
criticalNotifyCompletion = (ICriticalNotifyCompletion)(object)awaiter1;
Data.MethodBuilder.AwaitUnsafeOnCompleted(ref criticalNotifyCompletion, ref this);
num5 = 0;
break;
IL_01a3:
flag4 = (byte)num3 != 0;
flag2 = flag4;
goto IL_01ad;
IL_026d:
if (num4 != 0)
{
awaiter0 = default(Awaiter1);
if (true)
{
right0 = default(Awaiter2);
num5 = 1;
break;
}
}
goto end_IL_0029;
IL_01ad:
if (flag2)
{
if (0 == 0)
{
throw new NotSupportedException("Dynamic invocation of GetResult is not supported");
}
h val3 = (h)(object)null;
h item = val3;
(g, h) result = (leftR, item);
Data.Result = result;
num6 = 1;
}
else
{
criticalNotifyCompletion = (ICriticalNotifyCompletion)(object)awaiter;
Data.MethodBuilder.AwaitUnsafeOnCompleted(ref criticalNotifyCompletion, ref this);
num6 = 0;
}
if (num6 != 0)
{
awaiter = default(Awaiter2);
if (true)
{
leftR = default(g);
num4 = 1;
goto IL_026d;
}
}
goto end_IL_0029;
}
if (num5 != 0)
{
awaiter1 = default(ValueTaskAwaiter<CancellationToken>);
if (true)
{
Data.MethodBuilder.SetResult(Data.Result);
}
}
end_IL_0029:;
}
catch (object obj)
{
ex2 = (Exception)obj;
ex = ex2;
}
ex2 = ex;
if (ex2 != null)
{
Data.MethodBuilder.SetException(ex2);
}
}
void IAsyncStateMachine.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
this.MoveNext();
}
public override void SetStateMachine(IAsyncStateMachine state)
{
Data.MethodBuilder.SetStateMachine(state);
}
void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine state)
{
//ILSpy generated this explicit interface implementation from .override directive in SetStateMachine
this.SetStateMachine(state);
}
public override int get_ResumptionPoint()
{
return ResumptionPoint;
}
public override CancellableTaskBase.CancellableTaskBaseStateMachineData<(g, h), AsyncTaskMethodBuilder<(g, h)>> get_Data()
{
return Data;
}
public override void set_Data(CancellableTaskBase.CancellableTaskBaseStateMachineData<(g, h), AsyncTaskMethodBuilder<(g, h)>> value)
{
Data = value;
}
}
[Serializable]
internal sealed class MergeSources@157-48<Awaiter1, g, Awaiter2, h> : FSharpFunc<CancellationToken, Task<(g, h)>> where Awaiter1 : ICriticalNotifyCompletion where Awaiter2 : ICriticalNotifyCompletion
{
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
[CompilerGenerated]
[DebuggerNonUserCode]
public MergeSources@157-47<Awaiter1, g, Awaiter2, h> sm;
[CompilerGenerated]
[DebuggerNonUserCode]
internal MergeSources@157-48(MergeSources@157-47<Awaiter1, g, Awaiter2, h> sm)
{
((FSharpFunc<CancellationToken, Task<(Task<(g, h)>, ?)>>)(object)this)..ctor();
this.sm = sm;
}
public override Task<(g, h)> Invoke(CancellationToken ct)
{
if (ct.IsCancellationRequested)
{
return Task.FromCanceled<(g, h)>(ct);
}
MergeSources@157-47<Awaiter1, g, Awaiter2, h> stateMachine = sm;
stateMachine.Data.CancellationToken = ct;
stateMachine.Data.MethodBuilder = AsyncTaskMethodBuilder<(g, h)>.Create();
stateMachine.Data.MethodBuilder.Start(ref stateMachine);
return stateMachine.Data.MethodBuilder.Task;
}
}
[Serializable]
internal sealed class MergeSources@156-49<g, h> : FSharpFunc<CancellationToken, TaskAwaiter<(g, h)>>
{
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
[CompilerGenerated]
[DebuggerNonUserCode]
public FSharpFunc<CancellationToken, Task<(g, h)>> x;
[CompilerGenerated]
[DebuggerNonUserCode]
internal MergeSources@156-49(FSharpFunc<CancellationToken, Task<(g, h)>> x)
{
((FSharpFunc<CancellationToken, TaskAwaiter<(CancellationToken, TaskAwaiter<(g, h)>)>>)(object)this)..ctor();
this.x = x;
}
public override TaskAwaiter<(g, h)> Invoke(CancellationToken ct)
{
return ((FSharpFunc<CancellationToken, Task<(CancellationToken, Task<(g, h)>)>>)(object)x).Invoke(ct).GetAwaiter();
}
}
[SpecialName]
[StructLayout(LayoutKind.Auto, CharSet = CharSet.Auto)]
[CompilerGenerated]
[CompilationMapping(/*Could not decode attribute arguments.*/)]
internal struct MergeSources@157-50<Awaiter1, g, Awaiter2, h> : IAsyncStateMachine, IResumableStateMachine<CancellableTaskBase.CancellableTaskBaseStateMachineData<(g, h), AsyncTaskMethodBuilder<(g, h)>>> where Awaiter1 : ICriticalNotifyCompletion where Awaiter2 : ICriticalNotifyCompletion
{
public CancellableTaskBase.CancellableTaskBaseStateMachineData<(g, h), AsyncTaskMethodBuilder<(g, h)>> Data;
public int ResumptionPoint;
public FSharpFunc<Awaiter1, g> getResult;
public FSharpFunc<Awaiter2, h> getResult0;
public FSharpFunc<Awaiter1, bool> get_IsCompleted;
public FSharpFunc<Awaiter2, bool> get_IsCompleted0;
public FSharpFunc<CancellationToken, Awaiter1> left;
public FSharpFunc<CancellationToken, Awaiter2> right;
public Awaiter2 right0;
public g leftR;
public Awaiter2 awaiter;
public Awaiter1 awaiter0;
public ValueTaskAwaiter<CancellationToken> awaiter1;
public override void MoveNext()
{
int resumptionPoint = ResumptionPoint;
Exception ex = default(Exception);
switch (resumptionPoint)
{
default:
ex = null;
break;
case 1:
case 2:
case 3:
break;
}
Exception ex2;
try
{
bool flag;
int num;
int num5;
int num2;
int num3;
int num4;
bool flag2;
ICriticalNotifyCompletion criticalNotifyCompletion;
int num6;
bool flag4;
bool flag3;
switch (resumptionPoint)
{
default:
{
Data.CancellationToken.ThrowIfCancellationRequested();
CancellationToken cancellationToken = Data.CancellationToken;
awaiter1 = new ValueTask<CancellationToken>(cancellationToken).GetAwaiter();
flag = true;
if (awaiter1.IsCompleted)
{
goto IL_00ac;
}
if (false)
{
goto case 1;
}
ResumptionPoint = 1;
num = 0;
goto IL_00a2;
}
case 1:
num = 1;
goto IL_00a2;
case 2:
num5 = 1;
goto IL_0124;
case 3:
{
num2 = 1;
goto IL_0194;
}
IL_012e:
if (flag2)
{
g val = getResult.Invoke(awaiter0);
leftR = val;
Data.CancellationToken.ThrowIfCancellationRequested();
awaiter = right0;
flag3 = true;
if (((FSharpFunc<?, bool>)(object)get_IsCompleted0).Invoke(awaiter))
{
goto IL_019e;
}
if (false)
{
goto case 3;
}
ResumptionPoint = 3;
num2 = 0;
goto IL_0194;
}
criticalNotifyCompletion = (ICriticalNotifyCompletion)(object)awaiter0;
Data.MethodBuilder.AwaitUnsafeOnCompleted(ref criticalNotifyCompletion, ref this);
num3 = 0;
goto IL_0259;
IL_019e:
if (flag3)
{
h val2 = ((FSharpFunc<?, ?>)(object)getResult0).Invoke(awaiter);
h item = val2;
(g, h) result = (leftR, item);
Data.Result = result;
num4 = 1;
}
else
{
criticalNotifyCompletion = (ICriticalNotifyCompletion)(object)awaiter;
Data.MethodBuilder.AwaitUnsafeOnCompleted(ref criticalNotifyCompletion, ref this);
num4 = 0;
}
if (num4 != 0)
{
awaiter = default(Awaiter2);
if (true)
{
leftR = default(g);
num3 = 1;
goto IL_0259;
}
}
goto end_IL_0029;
IL_00a2:
flag2 = (byte)num != 0;
flag = flag2;
goto IL_00ac;
IL_00ac:
if (flag)
{
CancellationToken cancellationToken = awaiter1.GetResult();
CancellationToken cancellationToken2 = cancellationToken;
Awaiter1 val3 = ((FSharpFunc<CancellationToken, CancellationToken>)(object)left).Invoke(cancellationToken2);
right0 = ((FSharpFunc<CancellationToken, ?>)(object)right).Invoke(cancellationToken2);
Data.CancellationToken.ThrowIfCancellationRequested();
awaiter0 = val3;
flag2 = true;
if (get_IsCompleted.Invoke(awaiter0))
{
goto IL_012e;
}
if (false)
{
goto case 2;
}
ResumptionPoint = 2;
num5 = 0;
goto IL_0124;
}
criticalNotifyCompletion = (ICriticalNotifyCompletion)(object)awaiter1;
Data.MethodBuilder.AwaitUnsafeOnCompleted(ref criticalNotifyCompletion, ref this);
num6 = 0;
break;
IL_0259:
if (num3 != 0)
{
awaiter0 = default(Awaiter1);
if (true)
{
right0 = default(Awaiter2);
num6 = 1;
break;
}
}
goto end_IL_0029;
IL_0194:
flag4 = (byte)num2 != 0;
flag3 = flag4;
goto IL_019e;
IL_0124:
flag3 = (byte)num5 != 0;
flag2 = flag3;
goto IL_012e;
}
if (num6 != 0)
{
awaiter1 = default(ValueTaskAwaiter<CancellationToken>);
if (true)
{
Data.MethodBuilder.SetResult(Data.Result);
}
}
end_IL_0029:;
}
catch (object obj)
{
ex2 = (Exception)obj;
ex = ex2;
}
ex2 = ex;
if (ex2 != null)
{
Data.MethodBuilder.SetException(ex2);
}
}
void IAsyncStateMachine.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
this.MoveNext();
}
public override void SetStateMachine(IAsyncStateMachine state)
{
Data.MethodBuilder.SetStateMachine(state);
}
void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine state)
{
//ILSpy generated this explicit interface implementation from .override directive in SetStateMachine
this.SetStateMachine(state);
}
public override int get_ResumptionPoint()
{
return ResumptionPoint;
}
public override CancellableTaskBase.CancellableTaskBaseStateMachineData<(g, h), AsyncTaskMethodBuilder<(g, h)>> get_Data()
{
return Data;
}
public override void set_Data(CancellableTaskBase.CancellableTaskBaseStateMachineData<(g, h), AsyncTaskMethodBuilder<(g, h)>> value)
{
Data = value;
}
}
[Serializable]
internal sealed class MergeSources@157-51<Awaiter1, g, Awaiter2, h> : FSharpFunc<CancellationToken, Task<(g, h)>> where Awaiter1 : ICriticalNotifyCompletion where Awaiter2 : ICriticalNotifyCompletion
{
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
[CompilerGenerated]
[DebuggerNonUserCode]
public FSharpFunc<Awaiter1, g> getResult;
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
[CompilerGenerated]
[DebuggerNonUserCode]
public FSharpFunc<Awaiter2, h> getResult0;
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
[CompilerGenerated]
[DebuggerNonUserCode]
public FSharpFunc<Awaiter1, bool> get_IsCompleted;
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
[CompilerGenerated]
[DebuggerNonUserCode]
public FSharpFunc<Awaiter2, bool> get_IsCompleted0;
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
[CompilerGenerated]
[DebuggerNonUserCode]
public MergeSources@157-50<Awaiter1, g, Awaiter2, h> sm;
[CompilerGenerated]
[DebuggerNonUserCode]
internal MergeSources@157-51(FSharpFunc<Awaiter1, g> getResult, FSharpFunc<Awaiter2, h> getResult0, FSharpFunc<Awaiter1, bool> get_IsCompleted, FSharpFunc<Awaiter2, bool> get_IsCompleted0, MergeSources@157-50<Awaiter1, g, Awaiter2, h> sm)
{
((FSharpFunc<CancellationToken, Task<(Task<(g, h)>, ?)>>)(object)this)..ctor();
this.getResult = getResult;
this.getResult0 = getResult0;
this.get_IsCompleted = get_IsCompleted;
this.get_IsCompleted0 = get_IsCompleted0;
this.sm = sm;
}
public override Task<(g, h)> Invoke(CancellationToken ct)
{
if (ct.IsCancellationRequested)
{
return Task.FromCanceled<(g, h)>(ct);
}
MergeSources@157-50<Awaiter1, g, Awaiter2, h> stateMachine = sm;
stateMachine.Data.CancellationToken = ct;
stateMachine.Data.MethodBuilder = AsyncTaskMethodBuilder<(g, h)>.Create();
stateMachine.Data.MethodBuilder.Start(ref stateMachine);
return stateMachine.Data.MethodBuilder.Task;
}
}
[Serializable]
internal sealed class MergeSources@156-52<g, h> : FSharpFunc<CancellationToken, TaskAwaiter<(g, h)>>
{
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
[CompilerGenerated]
[DebuggerNonUserCode]
public FSharpFunc<CancellationToken, Task<(g, h)>> x;
[CompilerGenerated]
[DebuggerNonUserCode]
internal MergeSources@156-52(FSharpFunc<CancellationToken, Task<(g, h)>> x)
{
((FSharpFunc<CancellationToken, TaskAwaiter<(CancellationToken, TaskAwaiter<(g, h)>)>>)(object)this)..ctor();
this.x = x;
}
public override TaskAwaiter<(g, h)> Invoke(CancellationToken ct)
{
return ((FSharpFunc<CancellationToken, Task<(CancellationToken, Task<(g, h)>)>>)(object)x).Invoke(ct).GetAwaiter();
}
}
[SpecialName]
[StructLayout(LayoutKind.Auto, CharSet = CharSet.Auto)]
[CompilerGenerated]
[CompilationMapping(/*Could not decode attribute arguments.*/)]
internal struct MergeSources@180-53<Awaiter1, e, Awaiter2, f> : IAsyncStateMachine, IResumableStateMachine<CancellableTaskBase.CancellableTaskBaseStateMachineData<(e, f), AsyncTaskMethodBuilder<(e, f)>>> where Awaiter1 : ICriticalNotifyCompletion where Awaiter2 : ICriticalNotifyCompletion
{
public CancellableTaskBase.CancellableTaskBaseStateMachineData<(e, f), AsyncTaskMethodBuilder<(e, f)>> Data;
public int ResumptionPoint;
public Awaiter1 left;
public FSharpFunc<CancellationToken, Awaiter2> right;
public Awaiter2 right0;
public e leftR;
public Awaiter2 awaiter;
public Awaiter1 awaiter0;
public ValueTaskAwaiter<CancellationToken> awaiter1;
public override void MoveNext()
{
int resumptionPoint = ResumptionPoint;
Exception ex = default(Exception);
switch (resumptionPoint)
{
default:
ex = null;
break;
case 1:
case 2:
case 3:
break;
}
Exception ex2;
try
{
bool flag;
int num;
int num2;
int num3;
bool flag2;
int num4;
bool flag3;
int num5;
bool flag4;
int num6;
ICriticalNotifyCompletion criticalNotifyCompletion;
switch (resumptionPoint)
{
default:
{
Data.CancellationToken.ThrowIfCancellationRequested();
CancellationToken cancellationToken = Data.CancellationToken;
awaiter1 = new ValueTask<CancellationToken>(cancellationToken).GetAwaiter();
flag = true;
if (awaiter1.IsCompleted)
{
goto IL_00ac;
}
if (false)
{
goto case 1;
}
ResumptionPoint = 1;
num = 0;
goto IL_00a2;
}
case 1:
num = 1;
goto IL_00a2;
case 2:
num2 = 1;
goto IL_011e;
case 3:
{
num3 = 1;
goto IL_0198;
}
IL_011e:
flag2 = (byte)num2 != 0;
flag3 = flag2;
goto IL_0128;
IL_0128:
if (flag3)
{
if (0 == 0)
{
throw new NotSupportedException("Dynamic invocation of GetResult is not supported");
}
e val = (e)(object)null;
leftR = val;
Data.CancellationToken.ThrowIfCancellationRequested();
awaiter = right0;
flag2 = true;
if (0 == 0)
{
throw new NotSupportedException("Dynamic invocation of get_IsCompleted is not supported");
}
if ((bool)(object)null)
{
goto IL_01a2;
}
if (false)
{
goto case 3;
}
ResumptionPoint = 3;
num3 = 0;
goto IL_0198;
}
criticalNotifyCompletion = (ICriticalNotifyCompletion)(object)awaiter0;
Data.MethodBuilder.AwaitUnsafeOnCompleted(ref criticalNotifyCompletion, ref this);
num4 = 0;
goto IL_0262;
IL_00a2:
flag3 = (byte)num != 0;
flag = flag3;
goto IL_00ac;
IL_00ac:
if (flag)
{
CancellationToken cancellationToken = awaiter1.GetResult();
CancellationToken cancellationToken2 = cancellationToken;
right0 = ((FSharpFunc<CancellationToken, ?>)(object)right).Invoke(cancellationToken2);
Data.CancellationToken.ThrowIfCancellationRequested();
awaiter0 = left;
flag3 = true;
if (0 == 0)
{
throw new NotSupportedException("Dynamic invocation of get_IsCompleted is not supported");
}
if ((bool)(object)null)
{
goto IL_0128;
}
if (false)
{
goto case 2;
}
ResumptionPoint = 2;
num2 = 0;
goto IL_011e;
}
criticalNotifyCompletion = (ICriticalNotifyCompletion)(object)awaiter1;
Data.MethodBuilder.AwaitUnsafeOnCompleted(ref criticalNotifyCompletion, ref this);
num5 = 0;
break;
IL_0198:
flag4 = (byte)num3 != 0;
flag2 = flag4;
goto IL_01a2;
IL_0262:
if (num4 != 0)
{
awaiter0 = default(Awaiter1);
if (true)
{
right0 = default(Awaiter2);
num5 = 1;
break;
}
}
goto end_IL_0029;
IL_01a2:
if (flag2)
{
if (0 == 0)
{
throw new NotSupportedException("Dynamic invocation of GetResult is not supported");
}
f val2 = (f)(object)null;
f item = val2;
(e, f) result = (leftR, item);
Data.Result = result;
num6 = 1;
}
else
{
criticalNotifyCompletion = (ICriticalNotifyCompletion)(object)awaiter;
Data.MethodBuilder.AwaitUnsafeOnCompleted(ref criticalNotifyCompletion, ref this);
num6 = 0;
}
if (num6 != 0)
{
awaiter = default(Awaiter2);
if (true)
{
leftR = default(e);
num4 = 1;
goto IL_0262;
}
}
goto end_IL_0029;
}
if (num5 != 0)
{
awaiter1 = default(ValueTaskAwaiter<CancellationToken>);
if (true)
{
Data.MethodBuilder.SetResult(Data.Result);
}
}
end_IL_0029:;
}
catch (object obj)
{
ex2 = (Exception)obj;
ex = ex2;
}
ex2 = ex;
if (ex2 != null)
{
Data.MethodBuilder.SetException(ex2);
}
}
void IAsyncStateMachine.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
this.MoveNext();
}
public override void SetStateMachine(IAsyncStateMachine state)
{
Data.MethodBuilder.SetStateMachine(state);
}
void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine state)
{
//ILSpy generated this explicit interface implementation from .override directive in SetStateMachine
this.SetStateMachine(state);
}
public override int get_ResumptionPoint()
{
return ResumptionPoint;
}
public override CancellableTaskBase.CancellableTaskBaseStateMachineData<(e, f), AsyncTaskMethodBuilder<(e, f)>> get_Data()
{
return Data;
}
public override void set_Data(CancellableTaskBase.CancellableTaskBaseStateMachineData<(e, f), AsyncTaskMethodBuilder<(e, f)>> value)
{
Data = value;
}
}
[Serializable]
internal sealed class MergeSources@180-54<Awaiter1, e, Awaiter2, f> : FSharpFunc<CancellationToken, Task<(e, f)>> where Awaiter1 : ICriticalNotifyCompletion where Awaiter2 : ICriticalNotifyCompletion
{
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
[CompilerGenerated]
[DebuggerNonUserCode]
public MergeSources@180-53<Awaiter1, e, Awaiter2, f> sm;
[CompilerGenerated]
[DebuggerNonUserCode]
internal MergeSources@180-54(MergeSources@180-53<Awaiter1, e, Awaiter2, f> sm)
{
((FSharpFunc<CancellationToken, Task<(Task<(e, f)>, ?)>>)(object)this)..ctor();
this.sm = sm;
}
public override Task<(e, f)> Invoke(CancellationToken ct)
{
if (ct.IsCancellationRequested)
{
return Task.FromCanceled<(e, f)>(ct);
}
MergeSources@180-53<Awaiter1, e, Awaiter2, f> stateMachine = sm;
stateMachine.Data.CancellationToken = ct;
stateMachine.Data.MethodBuilder = AsyncTaskMethodBuilder<(e, f)>.Create();
stateMachine.Data.MethodBuilder.Start(ref stateMachine);
return stateMachine.Data.MethodBuilder.Task;
}
}
[Serializable]
internal sealed class MergeSources@179-55<e, f> : FSharpFunc<CancellationToken, TaskAwaiter<(e, f)>>
{
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
[CompilerGenerated]
[DebuggerNonUserCode]
public FSharpFunc<CancellationToken, Task<(e, f)>> x;
[CompilerGenerated]
[DebuggerNonUserCode]
internal MergeSources@179-55(FSharpFunc<CancellationToken, Task<(e, f)>> x)
{
((FSharpFunc<CancellationToken, TaskAwaiter<(CancellationToken, TaskAwaiter<(e, f)>)>>)(object)this)..ctor();
this.x = x;
}
public override TaskAwaiter<(e, f)> Invoke(CancellationToken ct)
{
return ((FSharpFunc<CancellationToken, Task<(CancellationToken, Task<(e, f)>)>>)(object)x).Invoke(ct).GetAwaiter();
}
}
[SpecialName]
[StructLayout(LayoutKind.Auto, CharSet = CharSet.Auto)]
[CompilerGenerated]
[CompilationMapping(/*Could not decode attribute arguments.*/)]
internal struct MergeSources@180-56<Awaiter1, e, Awaiter2, f> : IAsyncStateMachine, IResumableStateMachine<CancellableTaskBase.CancellableTaskBaseStateMachineData<(e, f), AsyncTaskMethodBuilder<(e, f)>>> where Awaiter1 : ICriticalNotifyCompletion where Awaiter2 : ICriticalNotifyCompletion
{
public CancellableTaskBase.CancellableTaskBaseStateMachineData<(e, f), AsyncTaskMethodBuilder<(e, f)>> Data;
public int ResumptionPoint;
public FSharpFunc<Awaiter1, e> getResult;
public FSharpFunc<Awaiter2, f> getResult0;
public FSharpFunc<Awaiter1, bool> get_IsCompleted;
public FSharpFunc<Awaiter2, bool> get_IsCompleted0;
public Awaiter1 left;
public FSharpFunc<CancellationToken, Awaiter2> right;
public Awaiter2 right0;
public e leftR;
public Awaiter2 awaiter;
public Awaiter1 awaiter0;
public ValueTaskAwaiter<CancellationToken> awaiter1;
public override void MoveNext()
{
int resumptionPoint = ResumptionPoint;
Exception ex = default(Exception);
switch (resumptionPoint)
{
default:
ex = null;
break;
case 1:
case 2:
case 3:
break;
}
Exception ex2;
try
{
bool flag;
int num;
int num5;
int num2;
int num3;
int num4;
bool flag2;
ICriticalNotifyCompletion criticalNotifyCompletion;
int num6;
bool flag4;
bool flag3;
switch (resumptionPoint)
{
default:
{
Data.CancellationToken.ThrowIfCancellationRequested();
CancellationToken cancellationToken = Data.CancellationToken;
awaiter1 = new ValueTask<CancellationToken>(cancellationToken).GetAwaiter();
flag = true;
if (awaiter1.IsCompleted)
{
goto IL_00ac;
}
if (false)
{
goto case 1;
}
ResumptionPoint = 1;
num = 0;
goto IL_00a2;
}
case 1:
num = 1;
goto IL_00a2;
case 2:
num5 = 1;
goto IL_0119;
case 3:
{
num2 = 1;
goto IL_0189;
}
IL_0123:
if (flag2)
{
e val = getResult.Invoke(awaiter0);
leftR = val;
Data.CancellationToken.ThrowIfCancellationRequested();
awaiter = right0;
flag3 = true;
if (((FSharpFunc<?, bool>)(object)get_IsCompleted0).Invoke(awaiter))
{
goto IL_0193;
}
if (false)
{
goto case 3;
}
ResumptionPoint = 3;
num2 = 0;
goto IL_0189;
}
criticalNotifyCompletion = (ICriticalNotifyCompletion)(object)awaiter0;
Data.MethodBuilder.AwaitUnsafeOnCompleted(ref criticalNotifyCompletion, ref this);
num3 = 0;
goto IL_024e;
IL_0193:
if (flag3)
{
f val2 = ((FSharpFunc<?, ?>)(object)getResult0).Invoke(awaiter);
f item = val2;
(e, f) result = (leftR, item);
Data.Result = result;
num4 = 1;
}
else
{
criticalNotifyCompletion = (ICriticalNotifyCompletion)(object)awaiter;
Data.MethodBuilder.AwaitUnsafeOnCompleted(ref criticalNotifyCompletion, ref this);
num4 = 0;
}
if (num4 != 0)
{
awaiter = default(Awaiter2);
if (true)
{
leftR = default(e);
num3 = 1;
goto IL_024e;
}
}
goto end_IL_0029;
IL_00a2:
flag2 = (byte)num != 0;
flag = flag2;
goto IL_00ac;
IL_00ac:
if (flag)
{
CancellationToken cancellationToken = awaiter1.GetResult();
CancellationToken cancellationToken2 = cancellationToken;
right0 = ((FSharpFunc<CancellationToken, ?>)(object)right).Invoke(cancellationToken2);
Data.CancellationToken.ThrowIfCancellationRequested();
awaiter0 = left;
flag2 = true;
if (get_IsCompleted.Invoke(awaiter0))
{
goto IL_0123;
}
if (false)
{
goto case 2;
}
ResumptionPoint = 2;
num5 = 0;
goto IL_0119;
}
criticalNotifyCompletion = (ICriticalNotifyCompletion)(object)awaiter1;
Data.MethodBuilder.AwaitUnsafeOnCompleted(ref criticalNotifyCompletion, ref this);
num6 = 0;
break;
IL_024e:
if (num3 != 0)
{
awaiter0 = default(Awaiter1);
if (true)
{
right0 = default(Awaiter2);
num6 = 1;
break;
}
}
goto end_IL_0029;
IL_0189:
flag4 = (byte)num2 != 0;
flag3 = flag4;
goto IL_0193;
IL_0119:
flag3 = (byte)num5 != 0;
flag2 = flag3;
goto IL_0123;
}
if (num6 != 0)
{
awaiter1 = default(ValueTaskAwaiter<CancellationToken>);
if (true)
{
Data.MethodBuilder.SetResult(Data.Result);
}
}
end_IL_0029:;
}
catch (object obj)
{
ex2 = (Exception)obj;
ex = ex2;
}
ex2 = ex;
if (ex2 != null)
{
Data.MethodBuilder.SetException(ex2);
}
}
void IAsyncStateMachine.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
this.MoveNext();
}
public override void SetStateMachine(IAsyncStateMachine state)
{
Data.MethodBuilder.SetStateMachine(state);
}
void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine state)
{
//ILSpy generated this explicit interface implementation from .override directive in SetStateMachine
this.SetStateMachine(state);
}
public override int get_ResumptionPoint()
{
return ResumptionPoint;
}
public override CancellableTaskBase.CancellableTaskBaseStateMachineData<(e, f), AsyncTaskMethodBuilder<(e, f)>> get_Data()
{
return Data;
}
public override void set_Data(CancellableTaskBase.CancellableTaskBaseStateMachineData<(e, f), AsyncTaskMethodBuilder<(e, f)>> value)
{
Data = value;
}
}
[Serializable]
internal sealed class MergeSources@180-57<Awaiter1, e, Awaiter2, f> : FSharpFunc<CancellationToken, Task<(e, f)>> where Awaiter1 : ICriticalNotifyCompletion where Awaiter2 : ICriticalNotifyCompletion
{
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
[CompilerGenerated]
[DebuggerNonUserCode]
public FSharpFunc<Awaiter1, e> getResult;
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
[CompilerGenerated]
[DebuggerNonUserCode]
public FSharpFunc<Awaiter2, f> getResult0;
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
[CompilerGenerated]
[DebuggerNonUserCode]
public FSharpFunc<Awaiter1, bool> get_IsCompleted;
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
[CompilerGenerated]
[DebuggerNonUserCode]
public FSharpFunc<Awaiter2, bool> get_IsCompleted0;
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
[CompilerGenerated]
[DebuggerNonUserCode]
public MergeSources@180-56<Awaiter1, e, Awaiter2, f> sm;
[CompilerGenerated]
[DebuggerNonUserCode]
internal MergeSources@180-57(FSharpFunc<Awaiter1, e> getResult, FSharpFunc<Awaiter2, f> getResult0, FSharpFunc<Awaiter1, bool> get_IsCompleted, FSharpFunc<Awaiter2, bool> get_IsCompleted0, MergeSources@180-56<Awaiter1, e, Awaiter2, f> sm)
{
((FSharpFunc<CancellationToken, Task<(Task<(e, f)>, ?)>>)(object)this)..ctor();
this.getResult = getResult;
this.getResult0 = getResult0;
this.get_IsCompleted = get_IsCompleted;
this.get_IsCompleted0 = get_IsCompleted0;
this.sm = sm;
}
public override Task<(e, f)> Invoke(CancellationToken ct)
{
if (ct.IsCancellationRequested)
{
return Task.FromCanceled<(e, f)>(ct);
}
MergeSources@180-56<Awaiter1, e, Awaiter2, f> stateMachine = sm;
stateMachine.Data.CancellationToken = ct;
stateMachine.Data.MethodBuilder = AsyncTaskMethodBuilder<(e, f)>.Create();
stateMachine.Data.MethodBuilder.Start(ref stateMachine);
return stateMachine.Data.MethodBuilder.Task;
}
}
[Serializable]
internal sealed class MergeSources@179-58<e, f> : FSharpFunc<CancellationToken, TaskAwaiter<(e, f)>>
{
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
[CompilerGenerated]
[DebuggerNonUserCode]
public FSharpFunc<CancellationToken, Task<(e, f)>> x;
[CompilerGenerated]
[DebuggerNonUserCode]
internal MergeSources@179-58(FSharpFunc<CancellationToken, Task<(e, f)>> x)
{
((FSharpFunc<CancellationToken, TaskAwaiter<(CancellationToken, TaskAwaiter<(e, f)>)>>)(object)this)..ctor();
this.x = x;
}
public override TaskAwaiter<(e, f)> Invoke(CancellationToken ct)
{
return ((FSharpFunc<CancellationToken, Task<(CancellationToken, Task<(e, f)>)>>)(object)x).Invoke(ct).GetAwaiter();
}
}
[SpecialName]
[StructLayout(LayoutKind.Auto, CharSet = CharSet.Auto)]
[CompilerGenerated]
[CompilationMapping(/*Could not decode attribute arguments.*/)]
internal struct MergeSources@203-59<Awaiter1, c, Awaiter2, d> : IAsyncStateMachine, IResumableStateMachine<CancellableTaskBase.CancellableTaskBaseStateMachineData<(c, d), AsyncTaskMethodBuilder<(c, d)>>> where Awaiter1 : ICriticalNotifyCompletion where Awaiter2 : ICriticalNotifyCompletion
{
public CancellableTaskBase.CancellableTaskBaseStateMachineData<(c, d), AsyncTaskMethodBuilder<(c, d)>> Data;
public int ResumptionPoint;
public FSharpFunc<CancellationToken, Awaiter1> left;
public Awaiter2 right;
public c leftR;
public Awaiter2 awaiter;
public Awaiter1 awaiter0;
public ValueTaskAwaiter<CancellationToken> awaiter1;
public override void MoveNext()
{
int resumptionPoint = ResumptionPoint;
Exception ex = default(Exception);
switch (resumptionPoint)
{
default:
ex = null;
break;
case 1:
case 2:
case 3:
break;
}
Exception ex2;
try
{
bool flag;
int num;
int num2;
int num3;
bool flag2;
int num4;
bool flag3;
int num5;
bool flag4;
int num6;
ICriticalNotifyCompletion criticalNotifyCompletion;
switch (resumptionPoint)
{
default:
{
Data.CancellationToken.ThrowIfCancellationRequested();
CancellationToken cancellationToken = Data.CancellationToken;
awaiter1 = new ValueTask<CancellationToken>(cancellationToken).GetAwaiter();
flag = true;
if (awaiter1.IsCompleted)
{
goto IL_00ac;
}
if (false)
{
goto case 1;
}
ResumptionPoint = 1;
num = 0;
goto IL_00a2;
}
case 1:
num = 1;
goto IL_00a2;
case 2:
num2 = 1;
goto IL_0116;
case 3:
{
num3 = 1;
goto IL_0190;
}
IL_0116:
flag2 = (byte)num2 != 0;
flag3 = flag2;
goto IL_0120;
IL_0120:
if (flag3)
{
if (0 == 0)
{
throw new NotSupportedException("Dynamic invocation of GetResult is not supported");
}
c val = (c)(object)null;
leftR = val;
Data.CancellationToken.ThrowIfCancellationRequested();
awaiter = right;
flag2 = true;
if (0 == 0)
{
throw new NotSupportedException("Dynamic invocation of get_IsCompleted is not supported");
}
if ((bool)(object)null)
{
goto IL_019a;
}
if (false)
{
goto case 3;
}
ResumptionPoint = 3;
num3 = 0;
goto IL_0190;
}
criticalNotifyCompletion = (ICriticalNotifyCompletion)(object)awaiter0;
Data.MethodBuilder.AwaitUnsafeOnCompleted(ref criticalNotifyCompletion, ref this);
num4 = 0;
goto IL_025a;
IL_00a2:
flag3 = (byte)num != 0;
flag = flag3;
goto IL_00ac;
IL_00ac:
if (flag)
{
CancellationToken cancellationToken = awaiter1.GetResult();
CancellationToken cancellationToken2 = cancellationToken;
Awaiter1 val2 = ((FSharpFunc<CancellationToken, CancellationToken>)(object)left).Invoke(cancellationToken2);
Data.CancellationToken.ThrowIfCancellationRequested();
awaiter0 = val2;
flag3 = true;
if (0 == 0)
{
throw new NotSupportedException("Dynamic invocation of get_IsCompleted is not supported");
}
if ((bool)(object)null)
{
goto IL_0120;
}
if (false)
{
goto case 2;
}
ResumptionPoint = 2;
num2 = 0;
goto IL_0116;
}
criticalNotifyCompletion = (ICriticalNotifyCompletion)(object)awaiter1;
Data.MethodBuilder.AwaitUnsafeOnCompleted(ref criticalNotifyCompletion, ref this);
num5 = 0;
break;
IL_0190:
flag4 = (byte)num3 != 0;
flag2 = flag4;
goto IL_019a;
IL_025a:
if (num4 != 0)
{
awaiter0 = default(Awaiter1);
num5 = 1;
break;
}
goto end_IL_0029;
IL_019a:
if (flag2)
{
if (0 == 0)
{
throw new NotSupportedException("Dynamic invocation of GetResult is not supported");
}
d val3 = (d)(object)null;
d item = val3;
(c, d) result = (leftR, item);
Data.Result = result;
num6 = 1;
}
else
{
criticalNotifyCompletion = (ICriticalNotifyCompletion)(object)awaiter;
Data.MethodBuilder.AwaitUnsafeOnCompleted(ref criticalNotifyCompletion, ref this);
num6 = 0;
}
if (num6 != 0)
{
awaiter = default(Awaiter2);
if (true)
{
leftR = default(c);
num4 = 1;
goto IL_025a;
}
}
goto end_IL_0029;
}
if (num5 != 0)
{
awaiter1 = default(ValueTaskAwaiter<CancellationToken>);
if (true)
{
Data.MethodBuilder.SetResult(Data.Result);
}
}
end_IL_0029:;
}
catch (object obj)
{
ex2 = (Exception)obj;
ex = ex2;
}
ex2 = ex;
if (ex2 != null)
{
Data.MethodBuilder.SetException(ex2);
}
}
void IAsyncStateMachine.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
this.MoveNext();
}
public override void SetStateMachine(IAsyncStateMachine state)
{
Data.MethodBuilder.SetStateMachine(state);
}
void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine state)
{
//ILSpy generated this explicit interface implementation from .override directive in SetStateMachine
this.SetStateMachine(state);
}
public override int get_ResumptionPoint()
{
return ResumptionPoint;
}
public override CancellableTaskBase.CancellableTaskBaseStateMachineData<(c, d), AsyncTaskMethodBuilder<(c, d)>> get_Data()
{
return Data;
}
public override void set_Data(CancellableTaskBase.CancellableTaskBaseStateMachineData<(c, d), AsyncTaskMethodBuilder<(c, d)>> value)
{
Data = value;
}
}
[Serializable]
internal sealed class MergeSources@203-60<Awaiter1, c, Awaiter2, d> : FSharpFunc<CancellationToken, Task<(c, d)>> where Awaiter1 : ICriticalNotifyCompletion where Awaiter2 : ICriticalNotifyCompletion
{
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
[CompilerGenerated]
[DebuggerNonUserCode]
public MergeSources@203-59<Awaiter1, c, Awaiter2, d> sm;
[CompilerGenerated]
[DebuggerNonUserCode]
internal MergeSources@203-60(MergeSources@203-59<Awaiter1, c, Awaiter2, d> sm)
{
((FSharpFunc<CancellationToken, Task<(Task<(c, d)>, ?)>>)(object)this)..ctor();
this.sm = sm;
}
public override Task<(c, d)> Invoke(CancellationToken ct)
{
if (ct.IsCancellationRequested)
{
return Task.FromCanceled<(c, d)>(ct);
}
MergeSources@203-59<Awaiter1, c, Awaiter2, d> stateMachine = sm;
stateMachine.Data.CancellationToken = ct;
stateMachine.Data.MethodBuilder = AsyncTaskMethodBuilder<(c, d)>.Create();
stateMachine.Data.MethodBuilder.Start(ref stateMachine);
return stateMachine.Data.MethodBuilder.Task;
}
}
[Serializable]
internal sealed class MergeSources@202-61<c, d> : FSharpFunc<CancellationToken, TaskAwaiter<(c, d)>>
{
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
[CompilerGenerated]
[DebuggerNonUserCode]
public FSharpFunc<CancellationToken, Task<(c, d)>> x;
[CompilerGenerated]
[DebuggerNonUserCode]
internal MergeSources@202-61(FSharpFunc<CancellationToken, Task<(c, d)>> x)
{
((FSharpFunc<CancellationToken, TaskAwaiter<(CancellationToken, TaskAwaiter<(c, d)>)>>)(object)this)..ctor();
this.x = x;
}
public override TaskAwaiter<(c, d)> Invoke(CancellationToken ct)
{
return ((FSharpFunc<CancellationToken, Task<(CancellationToken, Task<(c, d)>)>>)(object)x).Invoke(ct).GetAwaiter();
}
}
[SpecialName]
[StructLayout(LayoutKind.Auto, CharSet = CharSet.Auto)]
[CompilerGenerated]
[CompilationMapping(/*Could not decode attribute arguments.*/)]
internal struct MergeSources@203-62<Awaiter1, c, Awaiter2, d> : IAsyncStateMachine, IResumableStateMachine<CancellableTaskBase.CancellableTaskBaseStateMachineData<(c, d), AsyncTaskMethodBuilder<(c, d)>>> where Awaiter1 : ICriticalNotifyCompletion where Awaiter2 : ICriticalNotifyCompletion
{
public CancellableTaskBase.CancellableTaskBaseStateMachineData<(c, d), AsyncTaskMethodBuilder<(c, d)>> Data;
public int ResumptionPoint;
public FSharpFunc<Awaiter1, c> getResult;
public FSharpFunc<Awaiter2, d> getResult0;
public FSharpFunc<Awaiter1, bool> get_IsCompleted;
public FSharpFunc<Awaiter2, bool> get_IsCompleted0;
public FSharpFunc<CancellationToken, Awaiter1> left;
public Awaiter2 right;
public c leftR;
public Awaiter2 awaiter;
public Awaiter1 awaiter0;
public ValueTaskAwaiter<CancellationToken> awaiter1;
public override void MoveNext()
{
int resumptionPoint = ResumptionPoint;
Exception ex = default(Exception);
switch (resumptionPoint)
{
default:
ex = null;
break;
case 1:
case 2:
case 3:
break;
}
Exception ex2;
try
{
bool flag;
int num;
int num5;
int num2;
int num3;
int num4;
bool flag2;
ICriticalNotifyCompletion criticalNotifyCompletion;
int num6;
bool flag4;
bool flag3;
switch (resumptionPoint)
{
default:
{
Data.CancellationToken.ThrowIfCancellationRequested();
CancellationToken cancellationToken = Data.CancellationToken;
awaiter1 = new ValueTask<CancellationToken>(cancellationToken).GetAwaiter();
flag = true;
if (awaiter1.IsCompleted)
{
goto IL_00ac;
}
if (false)
{
goto case 1;
}
ResumptionPoint = 1;
num = 0;
goto IL_00a2;
}
case 1:
num = 1;
goto IL_00a2;
case 2:
num5 = 1;
goto IL_0111;
case 3:
{
num2 = 1;
goto IL_0181;
}
IL_011b:
if (flag2)
{
c val = getResult.Invoke(awaiter0);
leftR = val;
Data.CancellationToken.ThrowIfCancellationRequested();
awaiter = right;
flag3 = true;
if (((FSharpFunc<?, bool>)(object)get_IsCompleted0).Invoke(awaiter))
{
goto IL_018b;
}
if (false)
{
goto case 3;
}
ResumptionPoint = 3;
num2 = 0;
goto IL_0181;
}
criticalNotifyCompletion = (ICriticalNotifyCompletion)(object)awaiter0;
Data.MethodBuilder.AwaitUnsafeOnCompleted(ref criticalNotifyCompletion, ref this);
num3 = 0;
goto IL_0246;
IL_018b:
if (flag3)
{
d val2 = ((FSharpFunc<?, ?>)(object)getResult0).Invoke(awaiter);
d item = val2;
(c, d) result = (leftR, item);
Data.Result = result;
num4 = 1;
}
else
{
criticalNotifyCompletion = (ICriticalNotifyCompletion)(object)awaiter;
Data.MethodBuilder.AwaitUnsafeOnCompleted(ref criticalNotifyCompletion, ref this);
num4 = 0;
}
if (num4 != 0)
{
awaiter = default(Awaiter2);
if (true)
{
leftR = default(c);
num3 = 1;
goto IL_0246;
}
}
goto end_IL_0029;
IL_00a2:
flag2 = (byte)num != 0;
flag = flag2;
goto IL_00ac;
IL_00ac:
if (flag)
{
CancellationToken cancellationToken = awaiter1.GetResult();
CancellationToken cancellationToken2 = cancellationToken;
Awaiter1 val3 = ((FSharpFunc<CancellationToken, CancellationToken>)(object)left).Invoke(cancellationToken2);
Data.CancellationToken.ThrowIfCancellationRequested();
awaiter0 = val3;
flag2 = true;
if (get_IsCompleted.Invoke(awaiter0))
{
goto IL_011b;
}
if (false)
{
goto case 2;
}
ResumptionPoint = 2;
num5 = 0;
goto IL_0111;
}
criticalNotifyCompletion = (ICriticalNotifyCompletion)(object)awaiter1;
Data.MethodBuilder.AwaitUnsafeOnCompleted(ref criticalNotifyCompletion, ref this);
num6 = 0;
break;
IL_0246:
if (num3 != 0)
{
awaiter0 = default(Awaiter1);
num6 = 1;
break;
}
goto end_IL_0029;
IL_0181:
flag4 = (byte)num2 != 0;
flag3 = flag4;
goto IL_018b;
IL_0111:
flag3 = (byte)num5 != 0;
flag2 = flag3;
goto IL_011b;
}
if (num6 != 0)
{
awaiter1 = default(ValueTaskAwaiter<CancellationToken>);
if (true)
{
Data.MethodBuilder.SetResult(Data.Result);
}
}
end_IL_0029:;
}
catch (object obj)
{
ex2 = (Exception)obj;
ex = ex2;
}
ex2 = ex;
if (ex2 != null)
{
Data.MethodBuilder.SetException(ex2);
}
}
void IAsyncStateMachine.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
this.MoveNext();
}
public override void SetStateMachine(IAsyncStateMachine state)
{
Data.MethodBuilder.SetStateMachine(state);
}
void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine state)
{
//ILSpy generated this explicit interface implementation from .override directive in SetStateMachine
this.SetStateMachine(state);
}
public override int get_ResumptionPoint()
{
return ResumptionPoint;
}
public override CancellableTaskBase.CancellableTaskBaseStateMachineData<(c, d), AsyncTaskMethodBuilder<(c, d)>> get_Data()
{
return Data;
}
public override void set_Data(CancellableTaskBase.CancellableTaskBaseStateMachineData<(c, d), AsyncTaskMethodBuilder<(c, d)>> value)
{
Data = value;
}
}
[Serializable]
internal sealed class MergeSources@203-63<Awaiter1, c, Awaiter2, d> : FSharpFunc<CancellationToken, Task<(c, d)>> where Awaiter1 : ICriticalNotifyCompletion where Awaiter2 : ICriticalNotifyCompletion
{
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
[CompilerGenerated]
[DebuggerNonUserCode]
public FSharpFunc<Awaiter1, c> getResult;
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
[CompilerGenerated]
[DebuggerNonUserCode]
public FSharpFunc<Awaiter2, d> getResult0;
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
[CompilerGenerated]
[DebuggerNonUserCode]
public FSharpFunc<Awaiter1, bool> get_IsCompleted;
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
[CompilerGenerated]
[DebuggerNonUserCode]
public FSharpFunc<Awaiter2, bool> get_IsCompleted0;
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
[CompilerGenerated]
[DebuggerNonUserCode]
public MergeSources@203-62<Awaiter1, c, Awaiter2, d> sm;
[CompilerGenerated]
[DebuggerNonUserCode]
internal MergeSources@203-63(FSharpFunc<Awaiter1, c> getResult, FSharpFunc<Awaiter2, d> getResult0, FSharpFunc<Awaiter1, bool> get_IsCompleted, FSharpFunc<Awaiter2, bool> get_IsCompleted0, MergeSources@203-62<Awaiter1, c, Awaiter2, d> sm)
{
((FSharpFunc<CancellationToken, Task<(Task<(c, d)>, ?)>>)(object)this)..ctor();
this.getResult = getResult;
this.getResult0 = getResult0;
this.get_IsCompleted = get_IsCompleted;
this.get_IsCompleted0 = get_IsCompleted0;
this.sm = sm;
}
public override Task<(c, d)> Invoke(CancellationToken ct)
{
if (ct.IsCancellationRequested)
{
return Task.FromCanceled<(c, d)>(ct);
}
MergeSources@203-62<Awaiter1, c, Awaiter2, d> stateMachine = sm;
stateMachine.Data.CancellationToken = ct;
stateMachine.Data.MethodBuilder = AsyncTaskMethodBuilder<(c, d)>.Create();
stateMachine.Data.MethodBuilder.Start(ref stateMachine);
return stateMachine.Data.MethodBuilder.Task;
}
}
[Serializable]
internal sealed class MergeSources@202-64<c, d> : FSharpFunc<CancellationToken, TaskAwaiter<(c, d)>>
{
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
[CompilerGenerated]
[DebuggerNonUserCode]
public FSharpFunc<CancellationToken, Task<(c, d)>> x;
[CompilerGenerated]
[DebuggerNonUserCode]
internal MergeSources@202-64(FSharpFunc<CancellationToken, Task<(c, d)>> x)
{
((FSharpFunc<CancellationToken, TaskAwaiter<(CancellationToken, TaskAwaiter<(c, d)>)>>)(object)this)..ctor();
this.x = x;
}
public override TaskAwaiter<(c, d)> Invoke(CancellationToken ct)
{
return ((FSharpFunc<CancellationToken, Task<(CancellationToken, Task<(c, d)>)>>)(object)x).Invoke(ct).GetAwaiter();
}
}
[SpecialName]
[StructLayout(LayoutKind.Auto, CharSet = CharSet.Auto)]
[CompilerGenerated]
[CompilationMapping(/*Could not decode attribute arguments.*/)]
internal struct MergeSources@221-65<Awaiter1, a, Awaiter2, b> : IAsyncStateMachine, IResumableStateMachine<CancellableTaskBase.CancellableTaskBaseStateMachineData<(a, b), AsyncTaskMethodBuilder<(a, b)>>> where Awaiter1 : ICriticalNotifyCompletion where Awaiter2 : ICriticalNotifyCompletion
{
public CancellableTaskBase.CancellableTaskBaseStateMachineData<(a, b), AsyncTaskMethodBuilder<(a, b)>> Data;
public int ResumptionPoint;
public Awaiter1 left;
public Awaiter2 right;
public a leftR;
public Awaiter2 awaiter;
public Awaiter1 awaiter0;
public override void MoveNext()
{
int resumptionPoint = ResumptionPoint;
Exception ex = default(Exception);
switch (resumptionPoint)
{
default:
ex = null;
break;
case 1:
case 2:
break;
}
Exception ex2;
try
{
bool flag;
int num;
int num2;
bool flag2;
int num3;
int num4;
bool flag3;
ICriticalNotifyCompletion criticalNotifyCompletion;
switch (resumptionPoint)
{
default:
Data.CancellationToken.ThrowIfCancellationRequested();
awaiter0 = left;
flag = true;
if (0 == 0)
{
throw new NotSupportedException("Dynamic invocation of get_IsCompleted is not supported");
}
if ((bool)(object)null)
{
goto IL_008f;
}
if (false)
{
goto case 1;
}
ResumptionPoint = 1;
num = 0;
goto IL_0086;
case 1:
num = 1;
goto IL_0086;
case 2:
{
num2 = 1;
goto IL_00fe;
}
IL_00fe:
flag2 = (byte)num2 != 0;
flag3 = flag2;
goto IL_0108;
IL_0108:
if (flag3)
{
if (0 == 0)
{
throw new NotSupportedException("Dynamic invocation of GetResult is not supported");
}
b val = (b)(object)null;
b item = val;
(a, b) result = (leftR, item);
Data.Result = result;
num3 = 1;
}
else
{
criticalNotifyCompletion = (ICriticalNotifyCompletion)(object)awaiter;
Data.MethodBuilder.AwaitUnsafeOnCompleted(ref criticalNotifyCompletion, ref this);
num3 = 0;
}
if (num3 != 0)
{
awaiter = default(Awaiter2);
if (true)
{
leftR = default(a);
num4 = 1;
break;
}
}
goto end_IL_0022;
IL_0086:
flag3 = (byte)num != 0;
flag = flag3;
goto IL_008f;
IL_008f:
if (flag)
{
if (0 == 0)
{
throw new NotSupportedException("Dynamic invocation of GetResult is not supported");
}
a val2 = (a)(object)null;
leftR = val2;
Data.CancellationToken.ThrowIfCancellationRequested();
awaiter = right;
flag3 = true;
if (0 == 0)
{
throw new NotSupportedException("Dynamic invocation of get_IsCompleted is not supported");
}
if ((bool)(object)null)
{
goto IL_0108;
}
if (false)
{
goto case 2;
}
ResumptionPoint = 2;
num2 = 0;
goto IL_00fe;
}
criticalNotifyCompletion = (ICriticalNotifyCompletion)(object)awaiter0;
Data.MethodBuilder.AwaitUnsafeOnCompleted(ref criticalNotifyCompletion, ref this);
num4 = 0;
break;
}
if (num4 != 0)
{
awaiter0 = default(Awaiter1);
if (true)
{
Data.MethodBuilder.SetResult(Data.Result);
}
}
end_IL_0022:;
}
catch (object obj)
{
ex2 = (Exception)obj;
ex = ex2;
}
ex2 = ex;
if (ex2 != null)
{
Data.MethodBuilder.SetException(ex2);
}
}
void IAsyncStateMachine.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
this.MoveNext();
}
public override void SetStateMachine(IAsyncStateMachine state)
{
Data.MethodBuilder.SetStateMachine(state);
}
void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine state)
{
//ILSpy generated this explicit interface implementation from .override directive in SetStateMachine
this.SetStateMachine(state);
}
public override int get_ResumptionPoint()
{
return ResumptionPoint;
}
public override CancellableTaskBase.CancellableTaskBaseStateMachineData<(a, b), AsyncTaskMethodBuilder<(a, b)>> get_Data()
{
return Data;
}
public override void set_Data(CancellableTaskBaseusing System;
using System.Collections;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using Microsoft.FSharp.Core;
[assembly: FSharpInterfaceDataVersion(2, 0, 0)]
[assembly: AssemblyCompany("SileroVAD")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+f92be8fcbe66fd762d0c1c2edddcef0d8b265fbf")]
[assembly: AssemblyProduct("SileroVAD")]
[assembly: AssemblyTitle("SileroVAD")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Silero
{
[CompilationMapping(/*Could not decode attribute arguments.*/)]
public static class API
{
[Serializable]
[StructLayout(LayoutKind.Auto, CharSet = CharSet.Auto)]
[DebuggerDisplay("{__DebugDisplay(),nq}")]
[CompilationMapping(/*Could not decode attribute arguments.*/)]
public sealed class SileroVAD : IEquatable<SileroVAD>, IStructuralEquatable, IComparable<SileroVAD>, IComparable, IStructuralComparable
{
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
[CompilerGenerated]
[DebuggerNonUserCode]
internal readonly IntPtr item;
[CompilerGenerated]
[DebuggerNonUserCode]
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
internal int Tag
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return 0;
}
}
[CompilationMapping(/*Could not decode attribute arguments.*/)]
[CompilerGenerated]
[DebuggerNonUserCode]
internal IntPtr Item
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return item;
}
}
[CompilationMapping(/*Could not decode attribute arguments.*/)]
internal static SileroVAD NewSileroVAD(IntPtr item)
{
return new SileroVAD(item);
}
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(SileroVAD))]
[CompilerGenerated]
[DebuggerNonUserCode]
internal SileroVAD(IntPtr item)
{
this.item = item;
}
[SpecialName]
[CompilerGenerated]
[DebuggerNonUserCode]
internal object __DebugDisplay()
{
return ExtraTopLevelOperators.PrintFormatToString<FSharpFunc<SileroVAD, string>>((PrintfFormat<FSharpFunc<SileroVAD, string>, Unit, string, string>)(object)new PrintfFormat<FSharpFunc<SileroVAD, string>, Unit, string, string, string>("%+0.8A")).Invoke(this);
}
[CompilerGenerated]
public override string ToString()
{
return ExtraTopLevelOperators.PrintFormatToString<FSharpFunc<SileroVAD, string>>((PrintfFormat<FSharpFunc<SileroVAD, string>, Unit, string, string>)(object)new PrintfFormat<FSharpFunc<SileroVAD, string>, Unit, string, string, SileroVAD>("%+A")).Invoke(this);
}
[CompilerGenerated]
public sealed int CompareTo(SileroVAD obj)
{
if (this != null)
{
if (obj != null)
{
IComparer genericComparer = LanguagePrimitives.GenericComparer;
IntPtr intPtr = item;
IntPtr intPtr2 = obj.item;
return (((nint)intPtr > (nint)intPtr2) ? 1 : 0) - (((nint)intPtr < (nint)intPtr2) ? 1 : 0);
}
return 1;
}
if (obj != null)
{
return -1;
}
return 0;
}
[CompilerGenerated]
public sealed int CompareTo(object obj)
{
return CompareTo((SileroVAD)obj);
}
[CompilerGenerated]
public sealed int CompareTo(object obj, IComparer comp)
{
SileroVAD sileroVAD = (SileroVAD)obj;
if (this != null)
{
if ((SileroVAD)obj != null)
{
SileroVAD sileroVAD2 = sileroVAD;
IntPtr intPtr = item;
IntPtr intPtr2 = sileroVAD2.item;
return (((nint)intPtr > (nint)intPtr2) ? 1 : 0) - (((nint)intPtr < (nint)intPtr2) ? 1 : 0);
}
return 1;
}
if ((SileroVAD)obj != null)
{
return -1;
}
return 0;
}
[CompilerGenerated]
public sealed int GetHashCode(IEqualityComparer comp)
{
if (this != null)
{
int num = 0;
num = 0;
IntPtr intPtr = item;
return -1640531527 + ((int)(nuint)(nint)intPtr + ((num << 6) + (num >> 2)));
}
return 0;
}
[CompilerGenerated]
public sealed override int GetHashCode()
{
return GetHashCode(LanguagePrimitives.GenericEqualityComparer);
}
[CompilerGenerated]
public bool Equals(SileroVAD obj, IEqualityComparer comp)
{
if (this != null)
{
if (obj != null)
{
return item == obj.item;
}
return false;
}
return obj == null;
}
[CompilerGenerated]
public sealed bool Equals(object obj, IEqualityComparer comp)
{
if (obj is SileroVAD obj2)
{
return Equals(obj2, comp);
}
return false;
}
[CompilerGenerated]
public sealed bool Equals(SileroVAD obj)
{
if (this != null)
{
if (obj != null)
{
return item == obj.item;
}
return false;
}
return obj == null;
}
[CompilerGenerated]
public sealed override bool Equals(object obj)
{
if (obj is SileroVAD obj2)
{
return Equals(obj2);
}
return false;
}
}
[Serializable]
[CompilationMapping(/*Could not decode attribute arguments.*/)]
public enum LogLevel
{
Verbose,
Info,
Warning,
Error,
Fatal
}
public static SileroVAD SileroVAD(int windowSize)
{
string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
return API.SileroVAD.NewSileroVAD(Foreign.init_silero(new Foreign.SileroInitParams(Path.Combine(directoryName, "onnxruntime.dll"), Path.Combine(directoryName, "silero_vad.onnx"), 3, 1, 1, windowSize)));
}
public static void releaseSilero(SileroVAD _arg1)
{
Foreign.release_silero(_arg1.item);
}
[CompilationArgumentCounts(new int[] { 1, 1, 1 })]
public static float detectSpeech(SileroVAD _arg1, float[] pcmData, int pcmLength)
{
IntPtr item = _arg1.item;
return Foreign.detect_speech(item, pcmData, pcmLength);
}
}
}
namespace <StartupCode$SileroVAD>.$Silero
{
internal static class API
{
}
}
namespace Silero
{
[CompilationMapping(/*Could not decode attribute arguments.*/)]
public static class Foreign
{
[Serializable]
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
[Struct]
[CompilationMapping(/*Could not decode attribute arguments.*/)]
internal struct SileroInitParams : IEquatable<SileroInitParams>, IStructuralEquatable, IComparable<SileroInitParams>, IComparable, IStructuralComparable
{
[CompilerGenerated]
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
internal string onnxruntime_path@;
[CompilerGenerated]
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
internal string model_path@;
[CompilerGenerated]
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
internal int log_level@;
[CompilerGenerated]
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
internal int inter_threads@;
[CompilerGenerated]
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
internal int intra_threads@;
[CompilerGenerated]
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
internal int window_size@;
[CompilationMapping(/*Could not decode attribute arguments.*/)]
internal readonly string onnxruntime_path
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return onnxruntime_path@;
}
}
[CompilationMapping(/*Could not decode attribute arguments.*/)]
internal readonly string model_path
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return model_path@;
}
}
[CompilationMapping(/*Could not decode attribute arguments.*/)]
internal readonly int log_level
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return log_level@;
}
}
[CompilationMapping(/*Could not decode attribute arguments.*/)]
internal readonly int inter_threads
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return inter_threads@;
}
}
[CompilationMapping(/*Could not decode attribute arguments.*/)]
internal readonly int intra_threads
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return intra_threads@;
}
}
[CompilationMapping(/*Could not decode attribute arguments.*/)]
internal readonly int window_size
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return window_size@;
}
}
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(SileroInitParams))]
internal SileroInitParams(string onnxruntime_path, string model_path, int log_level, int inter_threads, int intra_threads, int window_size)
{
onnxruntime_path@ = onnxruntime_path;
model_path@ = model_path;
log_level@ = log_level;
inter_threads@ = inter_threads;
intra_threads@ = intra_threads;
window_size@ = window_size;
}
[CompilerGenerated]
public override string ToString()
{
return ExtraTopLevelOperators.PrintFormatToString<FSharpFunc<SileroInitParams, string>>((PrintfFormat<FSharpFunc<SileroInitParams, string>, Unit, string, string>)(object)new PrintfFormat<FSharpFunc<SileroInitParams, string>, Unit, string, string, SileroInitParams>("%+A")).Invoke(this);
}
[CompilerGenerated]
public sealed int CompareTo(SileroInitParams obj)
{
IComparer genericComparer = LanguagePrimitives.GenericComparer;
int num = string.CompareOrdinal(onnxruntime_path@, obj.onnxruntime_path@);
if (num < 0)
{
return num;
}
if (num > 0)
{
return num;
}
genericComparer = LanguagePrimitives.GenericComparer;
int num2 = string.CompareOrdinal(model_path@, obj.model_path@);
if (num2 < 0)
{
return num2;
}
if (num2 > 0)
{
return num2;
}
genericComparer = LanguagePrimitives.GenericComparer;
int num3 = log_level@;
int num4 = obj.log_level@;
int num5 = ((num3 > num4) ? 1 : 0) - ((num3 < num4) ? 1 : 0);
if (num5 < 0)
{
return num5;
}
if (num5 > 0)
{
return num5;
}
genericComparer = LanguagePrimitives.GenericComparer;
num4 = inter_threads@;
int num6 = obj.inter_threads@;
num3 = ((num4 > num6) ? 1 : 0) - ((num4 < num6) ? 1 : 0);
if (num3 < 0)
{
return num3;
}
if (num3 > 0)
{
return num3;
}
genericComparer = LanguagePrimitives.GenericComparer;
num6 = intra_threads@;
int num7 = obj.intra_threads@;
num4 = ((num6 > num7) ? 1 : 0) - ((num6 < num7) ? 1 : 0);
if (num4 < 0)
{
return num4;
}
if (num4 > 0)
{
return num4;
}
genericComparer = LanguagePrimitives.GenericComparer;
num6 = window_size@;
num7 = obj.window_size@;
return ((num6 > num7) ? 1 : 0) - ((num6 < num7) ? 1 : 0);
}
[CompilerGenerated]
public sealed int CompareTo(object obj)
{
return CompareTo((SileroInitParams)obj);
}
[CompilerGenerated]
public sealed int CompareTo(object obj, IComparer comp)
{
SileroInitParams sileroInitParams = (SileroInitParams)obj;
int num = string.CompareOrdinal(onnxruntime_path@, sileroInitParams.onnxruntime_path@);
if (num < 0)
{
return num;
}
if (num > 0)
{
return num;
}
int num2 = string.CompareOrdinal(model_path@, sileroInitParams.model_path@);
if (num2 < 0)
{
return num2;
}
if (num2 > 0)
{
return num2;
}
int num3 = log_level@;
int num4 = sileroInitParams.log_level@;
int num5 = ((num3 > num4) ? 1 : 0) - ((num3 < num4) ? 1 : 0);
if (num5 < 0)
{
return num5;
}
if (num5 > 0)
{
return num5;
}
num4 = inter_threads@;
int num6 = sileroInitParams.inter_threads@;
num3 = ((num4 > num6) ? 1 : 0) - ((num4 < num6) ? 1 : 0);
if (num3 < 0)
{
return num3;
}
if (num3 > 0)
{
return num3;
}
num6 = intra_threads@;
int num7 = sileroInitParams.intra_threads@;
num4 = ((num6 > num7) ? 1 : 0) - ((num6 < num7) ? 1 : 0);
if (num4 < 0)
{
return num4;
}
if (num4 > 0)
{
return num4;
}
num6 = window_size@;
num7 = sileroInitParams.window_size@;
return ((num6 > num7) ? 1 : 0) - ((num6 < num7) ? 1 : 0);
}
[CompilerGenerated]
public sealed int GetHashCode(IEqualityComparer comp)
{
int num = 0;
num = -1640531527 + (window_size@ + ((num << 6) + (num >> 2)));
num = -1640531527 + (intra_threads@ + ((num << 6) + (num >> 2)));
num = -1640531527 + (inter_threads@ + ((num << 6) + (num >> 2)));
num = -1640531527 + (log_level@ + ((num << 6) + (num >> 2)));
num = -1640531527 + ((model_path@?.GetHashCode() ?? 0) + ((num << 6) + (num >> 2)));
return -1640531527 + ((onnxruntime_path@?.GetHashCode() ?? 0) + ((num << 6) + (num >> 2)));
}
[CompilerGenerated]
public sealed override int GetHashCode()
{
return GetHashCode(LanguagePrimitives.GenericEqualityComparer);
}
[CompilerGenerated]
internal bool Equals(SileroInitParams obj, IEqualityComparer comp)
{
if (string.Equals(onnxruntime_path@, obj.onnxruntime_path@))
{
if (string.Equals(model_path@, obj.model_path@))
{
if (log_level@ == obj.log_level@)
{
if (inter_threads@ == obj.inter_threads@)
{
if (intra_threads@ == obj.intra_threads@)
{
return window_size@ == obj.window_size@;
}
return false;
}
return false;
}
return false;
}
return false;
}
return false;
}
[CompilerGenerated]
public sealed bool Equals(object obj, IEqualityComparer comp)
{
if (obj is SileroInitParams obj2)
{
return Equals(obj2, comp);
}
return false;
}
[CompilerGenerated]
public sealed bool Equals(SileroInitParams obj)
{
if (string.Equals(onnxruntime_path@, obj.onnxruntime_path@))
{
if (string.Equals(model_path@, obj.model_path@))
{
if (log_level@ == obj.log_level@)
{
if (inter_threads@ == obj.inter_threads@)
{
if (intra_threads@ == obj.intra_threads@)
{
return window_size@ == obj.window_size@;
}
return false;
}
return false;
}
return false;
}
return false;
}
return false;
}
[CompilerGenerated]
public sealed override bool Equals(object obj)
{
if (obj is SileroInitParams)
{
return Equals((SileroInitParams)obj);
}
return false;
}
}
[Literal]
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
public const string dll = "SileroVAD.API.dll";
[DllImport("SileroVAD.API.dll")]
internal static extern IntPtr init_silero(SileroInitParams _arg1);
[DllImport("SileroVAD.API.dll")]
internal static extern void release_silero(IntPtr _arg1);
[DllImport("SileroVAD.API.dll")]
internal static extern float detect_speech(IntPtr _arg1, float[] _arg2, long _arg3);
}
}
namespace <StartupCode$SileroVAD>.$Silero
{
internal static class Foreign
{
}
}
namespace <StartupCode$SileroVAD>.$.NETStandard,Version=v2.1
{
internal static class AssemblyAttributes
{
}
}
namespace <StartupCode$SileroVAD>.$Silero
{
internal static class AssemblyInfo
{
}
}
namespace System.Diagnostics.CodeAnalysis
{
[Serializable]
[Flags]
[CompilerGenerated]
[DebuggerNonUserCode]
internal enum DynamicallyAccessedMemberTypes
{
All = -1,
None = 0,
PublicParameterlessConstructor = 1,
PublicConstructors = 3,
NonPublicConstructors = 4,
PublicMethods = 8,
NonPublicMethods = 0x10,
PublicFields = 0x20,
NonPublicFields = 0x40,
PublicNestedTypes = 0x80,
NonPublicNestedTypes = 0x100,
PublicProperties = 0x200,
NonPublicProperties = 0x400,
PublicEvents = 0x800,
NonPublicEvents = 0x1000,
Interfaces = 0x2000
}
[CompilerGenerated]
internal class DynamicDependencyAttribute : Attribute
{
[CompilerGenerated]
[DebuggerNonUserCode]
private DynamicallyAccessedMemberTypes MemberType@;
[CompilerGenerated]
[DebuggerNonUserCode]
private Type Type@;
[CompilerGenerated]
[DebuggerNonUserCode]
public DynamicallyAccessedMemberTypes MemberType
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return MemberType@;
}
}
[CompilerGenerated]
[DebuggerNonUserCode]
public Type Type
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return Type@;
}
}
[CompilerGenerated]
[DebuggerNonUserCode]
public DynamicDependencyAttribute(DynamicallyAccessedMemberTypes MemberType, Type Type)
{
MemberType@ = MemberType;
Type@ = Type;
}
}
}using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Numerics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.ExceptionServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using <StartupCode$FSharpPlus>;
using FSharpPlus;
using FSharpPlus.Control;
using FSharpPlus.Data;
using FSharpPlus.Internals;
using Microsoft.FSharp.Collections;
using Microsoft.FSharp.Control;
using Microsoft.FSharp.Core;
using Microsoft.FSharp.Core.CompilerServices;
using Microsoft.FSharp.Quotations;
[assembly: FSharpInterfaceDataVersion(2, 0, 0)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("gusty; wallymathieu")]
[assembly: AssemblyCopyright("2012-2024 Gustavo M. Wild - Oskar Gewalli (and contributors https://github.com/fsprojects/FSharpPlus/graphs/contributors)")]
[assembly: AssemblyInformationalVersion("1.6.1")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/fsprojects/FSharpPlus")]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyVersion("0.0.0.0")]
namespace FSharpPlus.Internals
{
[Serializable]
[CompilationMapping(/*Could not decode attribute arguments.*/)]
public class Default6
{
}
[Serializable]
[CompilationMapping(/*Could not decode attribute arguments.*/)]
public class Default5 : Default6
{
}
[Serializable]
[CompilationMapping(/*Could not decode attribute arguments.*/)]
public class Default4 : Default5
{
}
[Serializable]
[CompilationMapping(/*Could not decode attribute arguments.*/)]
public class Default3 : Default4
{
}
[Serializable]
[CompilationMapping(/*Could not decode attribute arguments.*/)]
public class Default2 : Default3
{
}
[Serializable]
[CompilationMapping(/*Could not decode attribute arguments.*/)]
public class Default1 : Default2
{
}
[Serializable]
[CompilationMapping(/*Could not decode attribute arguments.*/)]
public class Id<t>
{
internal t value;
public t getValue => value;
public Id(t v)
{
value = v;
}
}
[Serializable]
[CompilationMapping(/*Could not decode attribute arguments.*/)]
public class Id0
{
internal string value;
public string getValue => value;
public Id0(string v)
{
value = v;
}
}
[Serializable]
[StructLayout(LayoutKind.Auto, CharSet = CharSet.Auto)]
[DebuggerDisplay("{__DebugDisplay(),nq}")]
[CompilationMapping(/*Could not decode attribute arguments.*/)]
public abstract class Either<t, u> : IEquatable<Either<t, u>>, IStructuralEquatable, IComparable<Either<t, u>>, IComparable, IStructuralComparable
{
public static class Tags
{
public const int Left = 0;
public const int Right = 1;
}
[Serializable]
[SpecialName]
[DebuggerTypeProxy(typeof(Either<, >.Left@DebugTypeProxy))]
[DebuggerDisplay("{__DebugDisplay(),nq}")]
public class Left : Either<t, u>
{
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
[CompilerGenerated]
[DebuggerNonUserCode]
internal readonly t item;
[CompilationMapping(/*Could not decode attribute arguments.*/)]
[CompilerGenerated]
[DebuggerNonUserCode]
public t Item
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return item;
}
}
[CompilerGenerated]
[DebuggerNonUserCode]
internal Left(t item)
{
this.item = item;
}
}
[Serializable]
[SpecialName]
[DebuggerTypeProxy(typeof(Either<, >.Right@DebugTypeProxy))]
[DebuggerDisplay("{__DebugDisplay(),nq}")]
public class Right : Either<t, u>
{
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
[CompilerGenerated]
[DebuggerNonUserCode]
internal readonly u item;
[CompilationMapping(/*Could not decode attribute arguments.*/)]
[CompilerGenerated]
[DebuggerNonUserCode]
public u Item
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return item;
}
}
[CompilerGenerated]
[DebuggerNonUserCode]
internal Right(u item)
{
this.item = item;
}
}
[SpecialName]
internal class Left@DebugTypeProxy
{
[CompilationMapping(/*Could not decode attribute arguments.*/)]
[CompilerGenerated]
[DebuggerNonUserCode]
public t Item
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return _obj.item;
}
}
[CompilerGenerated]
[DebuggerNonUserCode]
public Left@DebugTypeProxy(Left obj)
{
_obj = obj;
}
}
[SpecialName]
internal class Right@DebugTypeProxy
{
[CompilationMapping(/*Could not decode attribute arguments.*/)]
[CompilerGenerated]
[DebuggerNonUserCode]
public u Item
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return _obj.item;
}
}
[CompilerGenerated]
[DebuggerNonUserCode]
public Right@DebugTypeProxy(Right obj)
{
_obj = obj;
}
}
[CompilerGenerated]
[DebuggerNonUserCode]
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
public int Tag
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return (this is Right) ? 1 : 0;
}
}
[CompilerGenerated]
[DebuggerNonUserCode]
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
public bool IsLeft
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return this is Left;
}
}
[CompilerGenerated]
[DebuggerNonUserCode]
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
public bool IsRight
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return this is Right;
}
}
[CompilerGenerated]
[DebuggerNonUserCode]
internal Either()
{
}
[CompilationMapping(/*Could not decode attribute arguments.*/)]
public static Either<t, u> NewLeft(t item)
{
return new Left(item);
}
[CompilationMapping(/*Could not decode attribute arguments.*/)]
public static Either<t, u> NewRight(u item)
{
return new Right(item);
}
[SpecialName]
[CompilerGenerated]
[DebuggerNonUserCode]
internal object __DebugDisplay()
{
return ((FSharpFunc<Either<Either<t, u>, string>, string>)(object)ExtraTopLevelOperators.PrintFormatToString<FSharpFunc<Either<t, u>, string>>((PrintfFormat<FSharpFunc<Either<t, u>, string>, Unit, string, string>)(object)new PrintfFormat<FSharpFunc<Either<FSharpFunc<Either<t, u>, string>, Unit>, string>, Unit, string, string, string>("%+0.8A"))).Invoke((Either<Either<t, u>, string>)(object)this);
}
[CompilerGenerated]
public override string ToString()
{
return ((FSharpFunc<Either<Either<t, u>, string>, string>)(object)ExtraTopLevelOperators.PrintFormatToString<FSharpFunc<Either<t, u>, string>>((PrintfFormat<FSharpFunc<Either<t, u>, string>, Unit, string, string>)(object)new PrintfFormat<FSharpFunc<Either<FSharpFunc<Either<t, u>, string>, Unit>, string>, Unit, string, string, Either<FSharpFunc<Either<t, u>, string>, Unit>>("%+A"))).Invoke((Either<Either<t, u>, string>)(object)this);
}
[CompilerGenerated]
public virtual sealed int CompareTo(Either<t, u> obj)
{
if (this != null)
{
if (obj != null)
{
int num = ((this is Right) ? 1 : 0);
int num2 = ((obj is Right) ? 1 : 0);
if (num == num2)
{
IComparer genericComparer;
if (this is Left)
{
Left left = (Left)this;
Left left2 = (Left)obj;
genericComparer = LanguagePrimitives.GenericComparer;
t item = left.item;
t item2 = left2.item;
return HashCompare.GenericComparisonWithComparerIntrinsic<t>(genericComparer, item, item2);
}
Right right = (Right)this;
Right right2 = (Right)obj;
genericComparer = LanguagePrimitives.GenericComparer;
u item3 = right.item;
u item4 = right2.item;
return HashCompare.GenericComparisonWithComparerIntrinsic<u>(genericComparer, item3, item4);
}
return num - num2;
}
return 1;
}
if (obj != null)
{
return -1;
}
return 0;
}
[CompilerGenerated]
public virtual sealed int CompareTo(object obj)
{
return CompareTo((Either<t, u>)obj);
}
[CompilerGenerated]
public virtual sealed int CompareTo(object obj, IComparer comp)
{
Either<t, u> either = (Either<t, u>)obj;
if (this != null)
{
if ((Either<t, u>)obj != null)
{
int num = ((this is Right) ? 1 : 0);
Either<t, u> either2 = either;
int num2 = ((either2 is Right) ? 1 : 0);
if (num == num2)
{
if (this is Left)
{
Left left = (Left)this;
Left left2 = (Left)either;
t item = left.item;
t item2 = left2.item;
return HashCompare.GenericComparisonWithComparerIntrinsic<t>(comp, item, item2);
}
Right right = (Right)this;
Right right2 = (Right)either;
u item3 = right.item;
u item4 = right2.item;
return HashCompare.GenericComparisonWithComparerIntrinsic<u>(comp, item3, item4);
}
return num - num2;
}
return 1;
}
if ((Either<t, u>)obj != null)
{
return -1;
}
return 0;
}
[CompilerGenerated]
public virtual sealed int GetHashCode(IEqualityComparer comp)
{
if (this != null)
{
int num = 0;
if (this is Left)
{
Left left = (Left)this;
num = 0;
t item = left.item;
return -1640531527 + (HashCompare.GenericHashWithComparerIntrinsic<t>(comp, item) + ((num << 6) + (num >> 2)));
}
Right right = (Right)this;
num = 1;
u item2 = right.item;
return -1640531527 + (HashCompare.GenericHashWithComparerIntrinsic<u>(comp, item2) + ((num << 6) + (num >> 2)));
}
return 0;
}
[CompilerGenerated]
public sealed override int GetHashCode()
{
return GetHashCode(LanguagePrimitives.GenericEqualityComparer);
}
[CompilerGenerated]
public virtual sealed bool Equals(object obj, IEqualityComparer comp)
{
if (this != null)
{
if (obj is Either<t, u> either)
{
int num = ((this is Right) ? 1 : 0);
Either<t, u> either2 = either;
int num2 = ((either2 is Right) ? 1 : 0);
if (num == num2)
{
if (this is Left)
{
Left left = (Left)this;
Left left2 = (Left)either;
t item = left.item;
t item2 = left2.item;
return HashCompare.GenericEqualityWithComparerIntrinsic<t>(comp, item, item2);
}
Right right = (Right)this;
Right right2 = (Right)either;
u item3 = right.item;
u item4 = right2.item;
return HashCompare.GenericEqualityWithComparerIntrinsic<u>(comp, item3, item4);
}
return false;
}
return false;
}
return obj == null;
}
[CompilerGenerated]
public virtual sealed bool Equals(Either<t, u> obj)
{
if (this != null)
{
if (obj != null)
{
int num = ((this is Right) ? 1 : 0);
int num2 = ((obj is Right) ? 1 : 0);
if (num == num2)
{
if (this is Left)
{
Left left = (Left)this;
Left left2 = (Left)obj;
t item = left.item;
t item2 = left2.item;
return HashCompare.GenericEqualityERIntrinsic<t>(item, item2);
}
Right right = (Right)this;
Right right2 = (Right)obj;
u item3 = right.item;
u item4 = right2.item;
return HashCompare.GenericEqualityERIntrinsic<u>(item3, item4);
}
return false;
}
return false;
}
return obj == null;
}
[CompilerGenerated]
public sealed override bool Equals(object obj)
{
if (obj is Either<t, u> obj2)
{
return Equals(obj2);
}
return false;
}
}
[Serializable]
[StructLayout(LayoutKind.Sequential, Size = 1)]
[CompilationMapping(/*Could not decode attribute arguments.*/)]
public struct DmStruct : IEquatable<DmStruct>, IStructuralEquatable, IComparable<DmStruct>, IComparable, IStructuralComparable
{
[CompilerGenerated]
public sealed int CompareTo(DmStruct obj)
{
return 0;
}
[CompilerGenerated]
public sealed int CompareTo(object obj)
{
DmStruct dmStruct = (DmStruct)obj;
return 0;
}
[CompilerGenerated]
public sealed int CompareTo(object obj, IComparer comp)
{
DmStruct dmStruct = (DmStruct)obj;
return 0;
}
[CompilerGenerated]
public sealed int GetHashCode(IEqualityComparer comp)
{
return 0;
}
[CompilerGenerated]
public sealed override int GetHashCode()
{
return GetHashCode(LanguagePrimitives.GenericEqualityComparer);
}
[CompilerGenerated]
public sealed bool Equals(object obj, IEqualityComparer comp)
{
if (obj is DmStruct)
{
return true;
}
return false;
}
[CompilerGenerated]
public sealed bool Equals(DmStruct obj)
{
return true;
}
[CompilerGenerated]
public sealed override bool Equals(object obj)
{
if (obj is DmStruct)
{
return true;
}
return false;
}
}
[Serializable]
[StructLayout(LayoutKind.Sequential, Size = 1)]
[CompilationMapping(/*Could not decode attribute arguments.*/)]
public struct DmStruct1<T1> : IEquatable<DmStruct1<T1>>, IStructuralEquatable, IComparable<DmStruct1<T1>>, IComparable, IStructuralComparable
{
[CompilerGenerated]
public sealed int CompareTo(DmStruct1<T1> obj)
{
return 0;
}
[CompilerGenerated]
public sealed int CompareTo(object obj)
{
DmStruct1<T1> dmStruct = (DmStruct1<T1>)obj;
return 0;
}
[CompilerGenerated]
public sealed int CompareTo(object obj, IComparer comp)
{
DmStruct1<T1> dmStruct = (DmStruct1<T1>)obj;
return 0;
}
[CompilerGenerated]
public sealed int GetHashCode(IEqualityComparer comp)
{
return 0;
}
[CompilerGenerated]
public sealed override int GetHashCode()
{
return GetHashCode(LanguagePrimitives.GenericEqualityComparer);
}
[CompilerGenerated]
public sealed bool Equals(object obj, IEqualityComparer comp)
{
if (obj is DmStruct1<T1>)
{
return true;
}
return false;
}
[CompilerGenerated]
public sealed bool Equals(DmStruct1<T1> obj)
{
return true;
}
[CompilerGenerated]
public sealed override bool Equals(object obj)
{
if (obj is DmStruct1<T1>)
{
return true;
}
return false;
}
}
[Serializable]
[CompilationMapping(/*Could not decode attribute arguments.*/)]
public struct KeyValuePair2<TKey, TValue> : IEquatable<KeyValuePair2<TKey, TValue>>, IStructuralEquatable, IComparable<KeyValuePair2<TKey, TValue>>, IComparable, IStructuralComparable
{
internal TKey Key@;
internal TValue Value@;
[CompilationMapping(/*Could not decode attribute arguments.*/)]
public TKey Key => Key@;
[CompilationMapping(/*Could not decode attribute arguments.*/)]
public TValue Value => Value@;
[CompilerGenerated]
public sealed int CompareTo(KeyValuePair2<TKey, TValue> obj)
{
IComparer genericComparer = LanguagePrimitives.GenericComparer;
TKey key@ = Key@;
TKey key@2 = obj.Key@;
int num = HashCompare.GenericComparisonWithComparerIntrinsic<TKey>(genericComparer, key@, key@2);
if (num < 0)
{
return num;
}
if (num > 0)
{
return num;
}
genericComparer = LanguagePrimitives.GenericComparer;
TValue value@ = Value@;
TValue value@2 = obj.Value@;
return HashCompare.GenericComparisonWithComparerIntrinsic<TValue>(genericComparer, value@, value@2);
}
[CompilerGenerated]
public sealed int CompareTo(object obj)
{
return CompareTo((KeyValuePair2<TKey, TValue>)obj);
}
[CompilerGenerated]
public sealed int CompareTo(object obj, IComparer comp)
{
KeyValuePair2<TKey, TValue> keyValuePair = (KeyValuePair2<TKey, TValue>)obj;
TKey key@ = Key@;
TKey key@2 = keyValuePair.Key@;
int num = HashCompare.GenericComparisonWithComparerIntrinsic<TKey>(comp, key@, key@2);
if (num < 0)
{
return num;
}
if (num > 0)
{
return num;
}
TValue value@ = Value@;
TValue value@2 = keyValuePair.Value@;
return HashCompare.GenericComparisonWithComparerIntrinsic<TValue>(comp, value@, value@2);
}
[CompilerGenerated]
public sealed int GetHashCode(IEqualityComparer comp)
{
int num = 0;
TValue value@ = Value@;
num = -1640531527 + (HashCompare.GenericHashWithComparerIntrinsic<TValue>(comp, value@) + ((num << 6) + (num >> 2)));
TKey key@ = Key@;
return -1640531527 + (HashCompare.GenericHashWithComparerIntrinsic<TKey>(comp, key@) + ((num << 6) + (num >> 2)));
}
[CompilerGenerated]
public sealed override int GetHashCode()
{
return GetHashCode(LanguagePrimitives.GenericEqualityComparer);
}
[CompilerGenerated]
public sealed bool Equals(object obj, IEqualityComparer comp)
{
if (obj is KeyValuePair2<TKey, TValue> keyValuePair)
{
TKey key@ = Key@;
TKey key@2 = keyValuePair.Key@;
if (HashCompare.GenericEqualityWithComparerIntrinsic<TKey>(comp, key@, key@2))
{
TValue value@ = Value@;
TValue value@2 = keyValuePair.Value@;
return HashCompare.GenericEqualityWithComparerIntrinsic<TValue>(comp, value@, value@2);
}
return false;
}
return false;
}
public KeyValuePair2(TKey key, TValue value)
{
Key@ = key;
Value@ = value;
}
[CompilerGenerated]
public sealed bool Equals(KeyValuePair2<TKey, TValue> obj)
{
TKey key@ = Key@;
TKey key@2 = obj.Key@;
if (HashCompare.GenericEqualityERIntrinsic<TKey>(key@, key@2))
{
TValue value@ = Value@;
TValue value@2 = obj.Value@;
return HashCompare.GenericEqualityERIntrinsic<TValue>(value@, value@2);
}
return false;
}
[CompilerGenerated]
public sealed override bool Equals(object obj)
{
if (obj is KeyValuePair2<TKey, TValue>)
{
return Equals((KeyValuePair2<TKey, TValue>)obj);
}
return false;
}
}
[Serializable]
[Sealed]
[CompilationMapping(/*Could not decode attribute arguments.*/)]
public sealed class Set2<T>
{
}
[Serializable]
[CompilationMapping(/*Could not decode attribute arguments.*/)]
public class BitConverter
{
public static byte[] GetBytes(bool value)
{
return new byte[1] { (byte)(value ? 1 : 0) };
}
public static byte[] GetBytes(char value, bool isLittleEndian)
{
return GetBytes((short)value, isLittleEndian);
}
public unsafe static byte[] GetBytes(short value, bool isLittleEndian)
{
//The blocks IL_004a are reachable both inside and outside the pinned region starting at IL_003c. ILSpy has duplicated these blocks in order to place them both within and outside the `fixed` statement.
if (!isLittleEndian)
{
return new byte[2]
{
(byte)(short)(value >> 8),
(byte)value
};
}
byte[] array = ArrayModule.ZeroCreate<byte>(2);
nint num;
IntPtr intPtr;
if (array != null)
{
if (ArrayModule.Length<byte>(array) != 0)
{
fixed (byte* ptr = &array[0])
{
num = (intPtr = (nint)ptr);
*(short*)intPtr = value;
return array;
}
}
num = 0;
}
else
{
num = 0;
}
intPtr = num;
*(short*)intPtr = value;
return array;
}
public unsafe static byte[] GetBytes(int value, bool isLittleEndian)
{
//The blocks IL_0061 are reachable both inside and outside the pinned region starting at IL_0053. ILSpy has duplicated these blocks in order to place them both within and outside the `fixed` statement.
if (!isLittleEndian)
{
return new byte[4]
{
(byte)(value >> 24),
(byte)(value >> 16),
(byte)(value >> 8),
(byte)value
};
}
byte[] array = ArrayModule.ZeroCreate<byte>(4);
nint num;
IntPtr intPtr;
if (array != null)
{
if (ArrayModule.Length<byte>(array) != 0)
{
fixed (byte* ptr = &array[0])
{
num = (intPtr = (nint)ptr);
*(int*)intPtr = value;
return array;
}
}
num = 0;
}
else
{
num = 0;
}
intPtr = num;
*(int*)intPtr = value;
return array;
}
public unsafe static byte[] GetBytes(long value, bool isLittleEndian)
{
//The blocks IL_0091 are reachable both inside and outside the pinned region starting at IL_0083. ILSpy has duplicated these blocks in order to place them both within and outside the `fixed` statement.
if (!isLittleEndian)
{
return new byte[8]
{
(byte)(value >> 56),
(byte)(value >> 48),
(byte)(value >> 40),
(byte)(value >> 32),
(byte)(value >> 24),
(byte)(value >> 16),
(byte)(value >> 8),
(byte)value
};
}
byte[] array = ArrayModule.ZeroCreate<byte>(8);
nint num;
IntPtr intPtr;
if (array != null)
{
if (ArrayModule.Length<byte>(array) != 0)
{
fixed (byte* ptr = &array[0])
{
num = (intPtr = (nint)ptr);
*(long*)intPtr = value;
return array;
}
}
num = 0;
}
else
{
num = 0;
}
intPtr = num;
*(long*)intPtr = value;
return array;
}
public static byte[] GetBytes(ushort value, bool isLittleEndian)
{
return GetBytes((short)value, isLittleEndian);
}
public static byte[] GetBytes(uint value, bool isLittleEndian)
{
return GetBytes((int)value, isLittleEndian);
}
public static byte[] GetBytes(ulong value, bool isLittleEndian)
{
return GetBytes((long)value, isLittleEndian);
}
public unsafe static byte[] GetBytes(float value, bool isLittleEndian)
{
float num = value;
return GetBytes(*(int*)(&num), isLittleEndian);
}
public unsafe static byte[] GetBytes(double value, bool isLittleEndian)
{
double num = value;
return GetBytes(*(long*)(&num), isLittleEndian);
}
public static byte[] GetBytes(Guid value, bool isLittleEndian)
{
byte[] array = value.ToByteArray();
if (isLittleEndian)
{
return array;
}
return $Internals.GetBytes$cont@204(array, null);
}
public static char ToChar(byte[] value, int startIndex, bool isLittleEndian)
{
return (char)ToInt16(value, startIndex, isLittleEndian);
}
public unsafe static short ToInt16(byte[] value, int startIndex, bool isLittleEndian)
{
if (value == null)
{
throw new ArgumentNullException("value");
}
if (startIndex >= value.Length)
{
ArgumentOutOfRangeException ex = new ArgumentOutOfRangeException("startIndex", "ArgumentOutOfRange_Index");
throw ex;
}
if (startIndex > value.Length - 2)
{
ArgumentException ex2 = new ArgumentException("Arg_ArrayPlusOffTooSmall");
throw ex2;
}
fixed (byte* ptr = &value[startIndex])
{
nint num = (nint)ptr;
short num3;
if (isLittleEndian)
{
if (startIndex % 2 == 0)
{
return *(short*)num;
}
short num2 = *(byte*)(num + (nint)0 * (nint)sizeof(byte));
num3 = *(byte*)(num + (nint)1 * (nint)sizeof(byte));
return (short)(num2 | (short)(num3 << 8));
}
num3 = *(byte*)(num + (nint)0 * (nint)sizeof(byte));
return (short)((short)(num3 << 8) | (short)(*(byte*)(num + (nint)1 * (nint)sizeof(byte))));
}
}
public unsafe static int ToInt32(byte[] value, int startIndex, bool isLittleEndian)
{
if (value == null)
{
throw new ArgumentNullException("value");
}
if (startIndex >= value.Length)
{
ArgumentOutOfRangeException ex = new ArgumentOutOfRangeException("startIndex", "ArgumentOutOfRange_Index");
throw ex;
}
if (startIndex > value.Length - 4)
{
ArgumentException ex2 = new ArgumentException("Arg_ArrayPlusOffTooSmall");
throw ex2;
}
fixed (byte* ptr = &value[startIndex])
{
nint num = (nint)ptr;
if (isLittleEndian)
{
if (startIndex % 4 == 0)
{
return *(int*)num;
}
return *(byte*)(num + (nint)0 * (nint)sizeof(byte)) | (*(byte*)(num + (nint)1 * (nint)sizeof(byte)) << 8) | (*(byte*)(num + (nint)2 * (nint)sizeof(byte)) << 16) | (*(byte*)(num + (nint)3 * (nint)sizeof(byte)) << 24);
}
return (*(byte*)(num + (nint)0 * (nint)sizeof(byte)) << 24) | (*(byte*)(num + (nint)1 * (nint)sizeof(byte)) << 16) | (*(byte*)(num + (nint)2 * (nint)sizeof(byte)) << 8) | *(byte*)(num + (nint)3 * (nint)sizeof(byte));
}
}
public unsafe static long ToInt64(byte[] value, int startIndex, bool isLittleEndian)
{
if (value == null)
{
throw new ArgumentNullException("value");
}
if (startIndex >= value.Length)
{
ArgumentOutOfRangeException ex = new ArgumentOutOfRangeException("startIndex", "ArgumentOutOfRange_Index");
throw ex;
}
if (startIndex > value.Length - 8)
{
ArgumentException ex2 = new ArgumentException("Arg_ArrayPlusOffTooSmall");
throw ex2;
}
fixed (byte* ptr = &value[startIndex])
{
nint num = (nint)ptr;
long num2;
if (isLittleEndian)
{
if (startIndex % 8 == 0)
{
return *(long*)num;
}
num2 = (long)(*(byte*)(num + (nint)0 * (nint)sizeof(byte)) | ((ulong)(*(byte*)(num + (nint)1 * (nint)sizeof(byte))) << 8) | ((ulong)(*(byte*)(num + (nint)2 * (nint)sizeof(byte))) << 16) | ((ulong)(*(byte*)(num + (nint)3 * (nint)sizeof(byte))) << 24));
long num3 = (long)(*(byte*)(num + (nint)4 * (nint)sizeof(byte)) | ((ulong)(*(byte*)(num + (nint)5 * (nint)sizeof(byte))) << 8) | ((ulong)(*(byte*)(num + (nint)6 * (nint)sizeof(byte))) << 16) | ((ulong)(*(byte*)(num + (nint)7 * (nint)sizeof(byte))) << 24));
return num2 | (num3 << 32);
}
num2 = (long)(((ulong)(*(byte*)(num + (nint)0 * (nint)sizeof(byte))) << 24) | ((ulong)(*(byte*)(num + (nint)1 * (nint)sizeof(byte))) << 16) | ((ulong)(*(byte*)(num + (nint)2 * (nint)sizeof(byte))) << 8) | *(byte*)(num + (nint)3 * (nint)sizeof(byte)));
return (long)(((ulong)(*(byte*)(num + (nint)4 * (nint)sizeof(byte))) << 24) | ((ulong)(*(byte*)(num + (nint)5 * (nint)sizeof(byte))) << 16) | ((ulong)(*(byte*)(num + (nint)6 * (nint)sizeof(byte))) << 8) | *(byte*)(num + (nint)7 * (nint)sizeof(byte))) | (num2 << 32);
}
}
public static Guid ToGuid(byte[] value, int startIndex, bool isLittleEndian)
{
if (value == null)
{
throw new ArgumentNullException("value");
}
if (startIndex >= value.Length)
{
ArgumentOutOfRangeException ex = new ArgumentOutOfRangeException("startIndex", "ArgumentOutOfRange_Index");
throw ex;
}
if (startIndex > value.Length - 16)
{
ArgumentException ex2 = new ArgumentException("Arg_ArrayPlusOffTooSmall");
throw ex2;
}
if (isLittleEndian)
{
if (startIndex == 0)
{
return new Guid(value);
}
int num = startIndex + 15;
int num2 = value.Length;
int num3 = ((startIndex >= 0) ? startIndex : 0);
int num4 = ((num >= 0 + num2) ? (0 + num2 - 1) : num);
int num5 = num4 - num3 + 1;
int num6 = ((num5 >= 0) ? num5 : 0);
byte[] array = new byte[num6];
int num7 = 0;
int num8 = num6 - 1;
if (num8 >= num7)
{
do
{
array[num7] = value[num3 + num7];
num7++;
}
while (num7 != num8 + 1);
}
return new Guid(array);
}
return $Internals.ToGuid$cont@264(value, startIndex, null);
}
public static ushort ToUInt16(byte[] value, int startIndex, bool isLittleEndian)
{
return (ushort)ToInt16(value, startIndex, isLittleEndian);
}
public static uint ToUInt32(byte[] value, int startIndex, bool isLittleEndian)
{
return (uint)ToInt32(value, startIndex, isLittleEndian);
}
public static ulong ToUInt64(byte[] value, int startIndex, bool isLittleEndian)
{
return (ulong)ToInt64(value, startIndex, isLittleEndian);
}
public unsafe static float ToSingle(byte[] value, int startIndex, bool isLittleEndian)
{
int num = ToInt32(value, startIndex, isLittleEndian);
return *(float*)(&num);
}
public unsafe static double ToDouble(byte[] value, int startIndex, bool isLittleEndian)
{
long num = ToInt64(value, startIndex, isLittleEndian);
return *(double*)(&num);
}
internal static char GetHexValue(int i)
{
char c;
if (i < 10)
{
c = (char)i;
return (char)(c + 48);
}
c = (char)(i - 10);
return (char)(c + 65);
}
public static string ToString(byte[] value, int startIndex, int length)
{
if (value == null)
{
throw new ArgumentNullException("value");
}
int num = value.Length;
if (startIndex >= value.Length)
{
ArgumentOutOfRangeException ex = new ArgumentOutOfRangeException("startIndex", "ArgumentOutOfRange_StartIndex");
throw ex;
}
if (length < 0)
{
ArgumentOutOfRangeException ex = new ArgumentOutOfRangeException("length", "ArgumentOutOfRange_GenericPositive");
throw ex;
}
if (startIndex > num - length)
{
ArgumentException ex2 = new ArgumentException("Arg_ArrayPlusOffTooSmall");
throw ex2;
}
if (length == 0)
{
return string.Empty;
}
char[] array = ArrayModule.ZeroCreate<char>(length * 3);
int num2 = startIndex;
IEnumerable<int> enumerable = OperatorIntrinsics.RangeInt32(0, 3, 3 * length - 1);
foreach (int item in enumerable)
{
int num3 = value[num2];
num2++;
array[item] = GetHexValue(num3 / 16);
array[item + 1] = GetHexValue(num3 % 16);
array[item + 2] = '-';
}
return new string(array, 0, array.Length - 1);
}
public static string ToString(byte[] value)
{
if (value == null)
{
throw new ArgumentNullException("value");
}
return ToString(value, 0, value.Length);
}
public static string ToString(byte[] value, int startIndex)
{
if (value == null)
{
throw new ArgumentNullException("value");
}
return ToString(value, startIndex, value.Length - startIndex);
}
}
}
namespace FSharpPlus.Data
{
[Serializable]
[CompilationMapping(/*Could not decode attribute arguments.*/)]
public interface NonEmptySeq<T> : IEnumerable<T>
{
T First { get; }
}
}
namespace FSharpPlus.Control
{
[Serializable]
[CompilationMapping(/*Could not decode attribute arguments.*/)]
public class Explicit : Default1
{
public static FSharpFunc<t, R> Explicit<R, t>(R _arg1, Default1 _arg2)
{
return $Converter.Explicit@18<R, t>.@_instance;
}
public static FSharpFunc<t, R> Explicit$W<R, t>(FSharpFunc<t, R> op_Explicit, R _arg1, Default1 _arg2)
{
return new $Converter.Explicit@18-1<R, t>(op_Explicit);
}
public static void Explicit<t>(t _arg3, Default1 _arg4) where t : class
{
}
public static FSharpFunc<a, byte> Explicit<a>(byte _arg5, Explicit _arg6)
{
return $Converter.Explicit@21-2<a>.@_instance;
}
public static FSharpFunc<a, byte> Explicit$W<a>(FSharpFunc<a, byte> op_Explicit, byte _arg5, Explicit _arg6)
{
return new $Converter.Explicit@21-3<a>(op_Explicit);
}
public static FSharpFunc<a, sbyte> Explicit<a>(sbyte _arg7, Explicit _arg8)
{
return $Converter.Explicit@22-4<a>.@_instance;
}
public static FSharpFunc<a, sbyte> Explicit$W<a>(FSharpFunc<a, sbyte> op_Explicit, sbyte _arg7, Explicit _arg8)
{
return new $Converter.Explicit@22-5<a>(op_Explicit);
}
public static FSharpFunc<a, short> Explicit<a>(short _arg9, Explicit _arg10)
{
return $Converter.Explicit@23-6<a>.@_instance;
}
public static FSharpFunc<a, short> Explicit$W<a>(FSharpFunc<a, short> op_Explicit, short _arg9, Explicit _arg10)
{
return new $Converter.Explicit@23-7<a>(op_Explicit);
}
public static FSharpFunc<a, ushort> Explicit<a>(ushort _arg11, Explicit _arg12)
{
return $Converter.Explicit@24-8<a>.@_instance;
}
public static FSharpFunc<a, ushort> Explicit$W<a>(FSharpFunc<a, ushort> op_Explicit, ushort _arg11, Explicit _arg12)
{
return new $Converter.Explicit@24-9<a>(op_Explicit);
}
public static FSharpFunc<a, int> Explicit<a>(int _arg13, Explicit _arg14)
{
return $Converter.Explicit@25-10<a>.@_instance;
}
public static FSharpFunc<a, int> Explicit$W<a>(FSharpFunc<a, int> op_Explicit, int _arg13, Explicit _arg14)
{
return new $Converter.Explicit@25-11<a>(op_Explicit);
}
public static FSharpFunc<a, uint> Explicit<a>(uint _arg15, Explicit _arg16)
{
return $Converter.Explicit@26-12<a>.@_instance;
}
public static FSharpFunc<a, uint> Explicit$W<a>(FSharpFunc<a, uint> op_Explicit, uint _arg15, Explicit _arg16)
{
return new $Converter.Explicit@26-13<a>(op_Explicit);
}
public static FSharpFunc<a, long> Explicit<a>(long _arg17, Explicit _arg18)
{
return $Converter.Explicit@27-14<a>.@_instance;
}
public static FSharpFunc<a, long> Explicit$W<a>(FSharpFunc<a, long> op_Explicit, long _arg17, Explicit _arg18)
{
return new $Converter.Explicit@27-15<a>(op_Explicit);
}
public static FSharpFunc<a, ulong> Explicit<a>(ulong _arg19, Explicit _arg20)
{
return $Converter.Explicit@28-16<a>.@_instance;
}
public static FSharpFunc<a, ulong> Explicit$W<a>(FSharpFunc<a, ulong> op_Explicit, ulong _arg19, Explicit _arg20)
{
return new $Converter.Explicit@28-17<a>(op_Explicit);
}
public static FSharpFunc<a, IntPtr> Explicit<a>(IntPtr _arg21, Explicit _arg22)
{
return $Converter.Explicit@30-18<a>.@_instance;
}
public static FSharpFunc<a, IntPtr> Explicit$W<a>(FSharpFunc<a, int> op_Explicit, IntPtr _arg21, Explicit _arg22)
{
return new $Converter.Explicit@30-19<a>(op_Explicit);
}
public static FSharpFunc<a, UIntPtr> Explicit<a>(UIntPtr _arg23, Explicit _arg24)
{
return $Converter.Explicit@31-20<a>.@_instance;
}
public static FSharpFunc<a, UIntPtr> Explicit$W<a>(FSharpFunc<a, uint> op_Explicit, UIntPtr _arg23, Explicit _arg24)
{
return new $Converter.Explicit@31-21<a>(op_Explicit);
}
public static FSharpFunc<a, double> Explicit<a>(double _arg25, Explicit _arg26)
{
return $Converter.Explicit@33-22<a>.@_instance;
}
public static FSharpFunc<a, double> Explicit$W<a>(FSharpFunc<a, double> op_Explicit, double _arg25, Explicit _arg26)
{
return new $Converter.Explicit@33-23<a>(op_Explicit);
}
public static FSharpFunc<a, float> Explicit<a>(float _arg27, Explicit _arg28)
{
return $Converter.Explicit@34-24<a>.@_instance;
}
public static FSharpFunc<a, float> Explicit$W<a>(FSharpFunc<a, float> op_Explicit, float _arg27, Explicit _arg28)
{
return new $Converter.Explicit@34-25<a>(op_Explicit);
}
public static FSharpFunc<a, decimal> Explicit<a>(decimal _arg29, Explicit _arg30)
{
return $Converter.Explicit@35-26<a>.@_instance;
}
public static FSharpFunc<a, decimal> Explicit$W<a>(FSharpFunc<a, decimal> op_Explicit, decimal _arg29, Explicit _arg30)
{
return new $Converter.Explicit@35-27<a>(op_Explicit);
}
public static FSharpFunc<a, char> Explicit<a>(char _arg31, Explicit _arg32)
{
return $Converter.Explicit@36-28<a>.@_instance;
}
public static FSharpFunc<a, char> Explicit$W<a>(FSharpFunc<a, char> op_Explicit, char _arg31, Explicit _arg32)
{
return new $Converter.Explicit@36-29<a>(op_Explicit);
}
public static T Invoke<a, T>(a value)
{
Explicit item = null;
return FSharpFunc<Tuple<FSharpPlus.Control.Explicit, ?>, T>.InvokeFast<T>((FSharpFunc<Tuple<Explicit, ?>, FSharpFunc<T, T>>)(object)$Converter.Invoke@40<a, T>.@_instance, (Tuple<Explicit, ?>)(object)new Tuple<Explicit, T>(item, default(T)), (T)value);
}
public static T Invoke$W<a, T>(FSharpFunc<T, FSharpFunc<Explicit, FSharpFunc<a, T>>> @explicit, a value)
{
Explicit item = null;
return FSharpFunc<Tuple<FSharpPlus.Control.Explicit, ?>, T>.InvokeFast<T>((FSharpFunc<Tuple<Explicit, ?>, FSharpFunc<T, T>>)(object)new $Converter.Invoke@40-1<a, T>(@explicit), (Tuple<Explicit, ?>)(object)new Tuple<Explicit, T>(item, default(T)), (T)value);
}
}
[Serializable]
[CompilationMapping(/*Could not decode attribute arguments.*/)]
public class OfBytes
{
public static FSharpFunc<Tuple<byte[], int, a>, bool> OfBytes<a>(bool _arg1, OfBytes _arg2)
{
return $Converter.OfBytes@43<a>.@_instance;
}
public static FSharpFunc<Tuple<byte[], int, bool>, char> OfBytes(char _arg3, OfBytes _arg4)
{
return $Converter.OfBytes@45-1.@_instance;
}
public static FSharpFunc<Tuple<byte[], int, bool>, double> OfBytes(double _arg5, OfBytes _arg6)
{
return $Converter.OfBytes@46-2.@_instance;
}
public static FSharpFunc<Tuple<byte[], int, bool>, short> OfBytes(short _arg7, OfBytes _arg8)
{
return $Converter.OfBytes@47-3.@_instance;
}
public static FSharpFunc<Tuple<byte[], int, bool>, int> OfBytes(int _arg9, OfBytes _arg10)
{
return $Converter.OfBytes@48-4.@_instance;
}
public static FSharpFunc<Tuple<byte[], int, bool>, long> OfBytes(long _arg11, OfBytes _arg12)
{
return $Converter.OfBytes@49-5.@_instance;
}
public static FSharpFunc<Tuple<byte[], int, bool>, float> OfBytes(float _arg13, OfBytes _arg14)
{
return $Converter.OfBytes@50-6.@_instance;
}
public static FSharpFunc<Tuple<byte[], int, b>, string> OfBytes<b>(string _arg15, OfBytes _arg16)
{
return $Converter.OfBytes@52-7<b>.@_instance;
}
public static FSharpFunc<Tuple<byte[], int, bool>, Guid> OfBytes(Guid _arg17, OfBytes _arg18)
{
return $Converter.OfBytes@53-8.@_instance;
}
public static FSharpFunc<Tuple<byte[], int, bool>, ushort> OfBytes(ushort _arg19, OfBytes _arg20)
{
return $Converter.OfBytes@55-9.@_instance;
}
public static FSharpFunc<Tuple<byte[], int, bool>, uint> OfBytes(uint _arg21, OfBytes _arg22)
{
return $Converter.OfBytes@56-10.@_instance;
}
public static FSharpFunc<Tuple<byte[], int, bool>, ulong> OfBytes(ulong _arg23, OfBytes _arg24)
{
return $Converter.OfBytes@57-11.@_instance;
}
[CompilationArgumentCounts(new int[] { 1, 1, 1 })]
public static a Invoke<a>(bool isLtEndian, int startIndex, byte[] value)
{
OfBytes item = null;
Tuple<byte[], int, bool> tuple = new Tuple<byte[], int, bool>(value, startIndex, isLtEndian);
return FSharpFunc<Tuple<FSharpPlus.Control.OfBytes, a>, Tuple<byte[], int, bool>>.InvokeFast<a>((FSharpFunc<Tuple<OfBytes, a>, FSharpFunc<Tuple<byte[], int, bool>, a>>)$Converter.Invoke@62-2<a>.@_instance, new Tuple<OfBytes, a>(item, default(a)), tuple);
}
[CompilationArgumentCounts(new int[] { 1, 1, 1 })]
public static a Invoke$W<a>(FSharpFunc<a, FSharpFunc<OfBytes, FSharpFunc<Tuple<byte[], int, bool>, a>>> ofBytes, bool isLtEndian, int startIndex, byte[] value)
{
OfBytes item = null;
Tuple<byte[], int, bool> tuple = new Tuple<byte[], int, bool>(value, startIndex, isLtEndian);
return FSharpFunc<Tuple<FSharpPlus.Control.OfBytes, a>, Tuple<byte[], int, bool>>.InvokeFast<a>((FSharpFunc<Tuple<OfBytes, a>, FSharpFunc<Tuple<byte[], int, bool>, a>>)new $Converter.Invoke@62-3<a>(ofBytes), new Tuple<OfBytes, a>(item, default(a)), tuple);
}
}
[Serializable]
[CompilationMapping(/*Could not decode attribute arguments.*/)]
public class ToBytes
{
public static byte[] ToBytes<a>(bool x, a _arg1, ToBytes _arg2)
{
return new byte[1] { (byte)(x ? 1 : 0) };
}
public static byte[] ToBytes(char x, bool e, ToBytes _arg3)
{
bool isLittleEndian = System.BitConverter.IsLittleEndian == e;
return FSharpPlus.Internals.BitConverter.GetBytes((short)x, isLittleEndian);
}
public unsafe static byte[] ToBytes(double x, bool e, ToBytes _arg4)
{
bool isLittleEndian = System.BitConverter.IsLittleEndian == e;
double num = x;
return FSharpPlus.Internals.BitConverter.GetBytes(*(long*)(&num), isLittleEndian);
}
public static byte[] ToBytes(short x, bool e, ToBytes _arg5)
{
return FSharpPlus.Internals.BitConverter.GetBytes(x, System.BitConverter.IsLittleEndian == e);
}
public static byte[] ToBytes(int x, bool e, ToBytes _arg6)
{
return FSharpPlus.Internals.BitConverter.GetBytes(x, System.BitConverter.IsLittleEndian == e);
}
public static byte[] ToBytes(long x, bool e, ToBytes _arg7)
{
return FSharpPlus.Internals.BitConverter.GetBytes(x, System.BitConverter.IsLittleEndian == e);
}
public unsafe static byte[] ToBytes(float x, bool e, ToBytes _arg8)
{
bool isLittleEndian = System.BitConverter.IsLittleEndian == e;
float num = x;
return FSharpPlus.Internals.BitConverter.GetBytes(*(int*)(&num), isLittleEndian);
}
public static byte[] ToBytes<b>(string x, b _arg9, ToBytes _arg10)
{
char[] array = x.ToCharArray();
if (array == null)
{
throw new ArgumentNullException("array");
}
byte[] array2 = new byte[array.Length];
for (int i = 0; i < array2.Length; i++)
{
array2[i] = (byte)array[i];
}
return array2;
}
public static byte[] ToBytes(Guid x, bool e, ToBytes _arg11)
{
return FSharpPlus.Internals.BitConverter.GetBytes(x, System.BitConverter.IsLittleEndian == e);
}
public static byte[] ToBytes(ushort x, bool e, ToBytes _arg12)
{
bool isLittleEndian = System.BitConverter.IsLittleEndian == e;
return FSharpPlus.Internals.BitConverter.GetBytes((short)x, isLittleEndian);
}
public static byte[] ToBytes(uint x, bool e, ToBytes _arg13)
{
bool isLittleEndian = System.BitConverter.IsLittleEndian == e;
return FSharpPlus.Internals.BitConverter.GetBytes((int)x, isLittleEndian);
}
public static byte[] ToBytes(ulong x, bool e, ToBytes _arg14)
{
bool isLittleEndian = System.BitConverter.IsLittleEndian == e;
return FSharpPlus.Internals.BitConverter.GetBytes((long)x, isLittleEndian);
}
[CompilationArgumentCounts(new int[] { 1, 1 })]
public static byte[] Invoke<a>(bool isLittleEndian, a value)
{
throw new NotSupportedException("Dynamic invocation of ToBytes is not supported");
}
[CompilationArgumentCounts(new int[] { 1, 1 })]
public static byte[] Invoke$W<a>(FSharpFunc<a, FSharpFunc<bool, FSharpFunc<ToBytes, byte[]>>> toBytes, bool isLittleEndian, a value)
{
return FSharpFunc<FSharpPlus.Control.ToBytes, bool>.InvokeFast<ToBytes, byte[]>((FSharpFunc<ToBytes, FSharpFunc<bool, FSharpFunc<ToBytes, byte[]>>>)(object)toBytes, (ToBytes)value, isLittleEndian, (ToBytes)null);
}
}
[Serializable]
[CompilationMapping(/*Could not decode attribute arguments.*/)]
public class TryParse : Default1
{
public static FSharpFunc<string, FSharpOption<decimal>> TryParse(decimal _arg1, TryParse _arg2)
{
return $Converter.TryParse@90.@_instance;
}
public static FSharpFunc<string, FSharpOption<float>> TryParse(float _arg3, TryParse _arg4)
{
return $Converter.TryParse@91-1.@_instance;
}
public static FSharpFunc<string, FSharpOption<double>> TryParse(double _arg5, TryParse _arg6)
{
return $Converter.TryParse@92-2.@_instance;
}
public static FSharpFunc<string, FSharpOption<ushort>> TryParse(ushort _arg7, TryParse _arg8)
{
return $Converter.TryParse@93-3.@_instance;
}
public static FSharpFunc<string, FSharpOption<uint>> TryParse(uint _arg9, TryParse _arg10)
{
return $Converter.TryParse@94-4.@_instance;
}
public static FSharpFunc<string, FSharpOption<ulong>> TryParse(ulong _arg11, TryParse _arg12)
{
return $Converter.TryParse@95-5.@_instance;
}
public static FSharpFunc<string, FSharpOption<short>> TryParse(short _arg13, TryParse _arg14)
{
return $Converter.TryParse@96-6.@_instance;
}
public static FSharpFunc<string, FSharpOption<int>> TryParse(int _arg15, TryParse _arg16)
{
return $Converter.TryParse@97-7.@_instance;
}
public static FSharpFunc<string, FSharpOption<long>> TryParse(long _arg17, TryParse _arg18)
{
return $Converter.TryParse@98-8.@_instance;
}
public static FSharpFunc<string, FSharpOption<string>> TryParse(string _arg19, TryParse _arg20)
{
return $Converter.TryParse@111-9.@_instance;
}
public static FSharpFunc<string, FSharpOption<StringBuilder>> TryParse(StringBuilder _arg21, TryParse _arg22)
{
return $Converter.TryParse@112-10.@_instance;
}
public static FSharpFunc<string, FSharpOption<DateTime>> TryParse(DateTime _arg23, TryParse _arg24)
{
return $Converter.TryParse@115-11.@_instance;
}
public static FSharpFunc<string, FSharpOption<DateTimeOffset>> TryParse(DateTimeOffset _arg25, TryParse _arg26)
{
return $Converter.TryParse@123-12.@_instance;
}
public static FSharpOption<b> Invoke<b>(string value)
{
TryParse item = null;
return FSharpFunc<Tuple<FSharpPlus.Control.TryParse, FSharpOption<b>>, string>.InvokeFast<FSharpOption<b>>((FSharpFunc<Tuple<TryParse, FSharpOption<b>>, FSharpFunc<string, FSharpOption<b>>>)(object)$Converter.Invoke@135-4<b>.@_instance, (Tuple<TryParse, FSharpOption<b>>)(object)new Tuple<TryParse, b>(item, default(b)), value);
}
public static FSharpOption<b> Invoke$W<b>(FSharpFunc<b, FSharpFunc<TryParse, FSharpFunc<string, FSharpOption<b>>>> tryParse, string value)
{
TryParse item = null;
return FSharpFunc<Tuple<FSharpPlus.Control.TryParse, FSharpOption<b>>, string>.InvokeFast<FSharpOption<b>>((FSharpFunc<Tuple<TryParse, FSharpOption<b>>, FSharpFunc<string, FSharpOption<b>>>)(object)new $Converter.Invoke@135-5<b>(tryParse), (Tuple<TryParse, FSharpOption<b>>)(object)new Tuple<TryParse, b>(item, default(b)), value);
}
public static FSharpOption<R> InvokeOnInstance<R>(string value)
{
throw new NotSupportedException("Dynamic invocation of TryParse is not supported");
}
public static FSharpOption<R> InvokeOnInstance$W<R>(FSharpFunc<string, FSharpOption<R>> tryParse, string value)
{
return tryParse.Invoke(value);
}
public static FSharpOption<R> InvokeOnConvention<R, a>(string value)
{
R val = default(R);
if (0 == 0)
{
throw new NotSupportedException("Dynamic invocation of TryParse is not supported");
}
if ((bool)(object)null)
{
return FSharpOption<R>.Some(val);
}
return null;
}
public unsafe static FSharpOption<R> InvokeOnConvention$W<R, a>(FSharpFunc<string, FSharpFunc<ref R, bool>> tryParse, string value)
{
R val = default(R);
if (FSharpFunc<string, ref bool>.InvokeFast<bool>((FSharpFunc<string, FSharpFunc<ref bool, bool>>)(object)tryParse, value, ref *(bool*)(&val)))
{
return FSharpOption<R>.Some(val);
}
return null;
}
public static FSharpFunc<string, FSharpOption<R>> TryParse<R>(R _arg1, Default4 _arg2)
{
return $Converter.TryParse@211-13<R>.@_instance;
}
public static FSharpFunc<string, FSharpOption<R>> TryParse$W<R>(FSharpFunc<string, R> parse, R _arg1, Default4 _arg2)
{
return new $Converter.TryParse@211-14<R>(parse);
}
public static FSharpFunc<string, FSharpOption<R>> TryParse<R, a>(R _arg3, Default3 _arg4)
{
return $Converter.TryParse@216-15<R, a>.@_instance;
}
public static FSharpFunc<string, FSharpOption<R>> TryParse$W<R, a>(FSharpFunc<string, FSharpFunc<ref R, bool>> tryParse, R _arg3, Default3 _arg4)
{
return new $Converter.TryParse@216-16<R, a>(tryParse);
}
public static FSharpFunc<string, FSharpOption<R>> TryParse<R>(R _arg5, Default2 _arg6)
{
return $Converter.TryParse@218-17<R>.@_instance;
}
public static FSharpFunc<string, FSharpOption<R>> TryParse$W<R>(FSharpFunc<string, FSharpOption<R>> tryParse, R _arg5, Default2 _arg6)
{
return new $Converter.TryParse@218-18<R>(tryParse);
}
public static FSharpFunc<a, a> TryParse<t, a>(t _arg7, Default2 _arg8) where t : class
{
return $Converter.TryParse@224-19<a>.@_instance;
}
}
[Serializable]
[CompilationMapping(/*Could not decode attribute arguments.*/)]
public class Parse : Default1
{
public static FSharpFunc<string, R> Parse<R>(R _arg1, Parse _arg2)
{
return $Converter.Parse@155<R>.@_instance;
}
public static FSharpFunc<string, R> Parse$W<R>(FSharpFunc<string, FSharpFunc<CultureInfo, R>> parse, R _arg1, Parse _arg2)
{
return new $Converter.Parse@155-1<R>(parse);
}
public static FSharpFunc<string, @enum> Parse<T, a, @enum>(T _arg3, Parse _arg4) where @enum : struct
{
return $Converter.Parse@157-2<@enum>.@_instance;
}
public static FSharpFunc<string, DateTime> Parse(DateTime _arg5, Parse _arg6)
{
return $Converter.Parse@164-3.@_instance;
}
public static FSharpFunc<string, DateTimeOffset> Parse(DateTimeOffset _arg7, Parse _arg8)
{
return $Converter.Parse@169-4.@_instance;
}
public static FSharpFunc<string, bool> Parse(bool _arg9, Parse _arg10)
{
return $Converter.Parse@174-5.@_instance;
}
public static FSharpFunc<string, char> Parse(char _arg11, Parse _arg12)
{
return $Converter.Parse@176-6.@_instance;
}
public static FSharpFunc<string, string> Parse(string _arg13, Parse _arg14)
{
return $Converter.Parse@177-7.@_instance;
}
public static FSharpFunc<string, StringBuilder> Parse(StringBuilder _arg15, Parse _arg16)
{
return $Converter.Parse@178-8.@_instance;
}
public static a Invoke<a>(string value)
{
Parse item = null;
return FSharpFunc<Tuple<FSharpPlus.Control.Parse, a>, string>.InvokeFast<a>((FSharpFunc<Tuple<Parse, a>, FSharpFunc<string, a>>)$Converter.Invoke@183-6<a>.@_instance, new Tuple<Parse, a>(item, default(a)), value);
}
public static a Invoke$W<a>(FSharpFunc<a, FSharpFunc<Parse, FSharpFunc<string, a>>> parse, string value)
{
Parse item = null;
return FSharpFunc<Tuple<FSharpPlus.Control.Parse, a>, string>.InvokeFast<a>((FSharpFunc<Tuple<Parse, a>, FSharpFunc<string, a>>)new $Converter.Invoke@183-7<a>(parse), new Tuple<Parse, a>(item, default(a)), value);
}
public static R InvokeOnInstance<R>(string value)
{
throw new NotSupportedException("Dynamic invocation of Parse is not supported");
}
public static R InvokeOnInstance$W<R>(FSharpFunc<string, R> parse, string value)
{
return parse.Invoke(value);
}
public static FSharpFunc<string, R> Parse<R, a>(R _arg1, Default4 _arg2)
{
return $Converter.Parse@190-9<R, a>.@_instance;
}
public static FSharpFunc<string, R> Parse$W<R, a>(FSharpFunc<string, FSharpFunc<ref R, bool>> tryParse, R _arg1, Default4 _arg2)
{
return new $Converter.Parse@190-10<R, a>(tryParse);
}
public static FSharpFunc<string, R> Parse<R>(R _arg3, Default3 _arg4)
{
return $Converter.Parse@195-11<R>.@_instance;
}
public static FSharpFunc<string, R> Parse$W<R>(FSharpFunc<string, FSharpOption<R>> tryParse, R _arg3, Default3 _arg4)
{
return new $Converter.Parse@195-12<R>(tryParse);
}
public static FSharpFunc<string, R> Parse<R>(R _arg5, Default2 _arg6)
{
return $Converter.Parse@200-13<R>.@_instance;
}
public static FSharpFunc<string, R> Parse$W<R>(FSharpFunc<string, R> parse, R _arg5, Default2 _arg6)
{
return new $Converter.Parse@200-14<R>(parse);
}
public static FSharpFunc<a, a> Parse<t, a>(t _arg7, Default2 _arg8) where t : class
{
return $Converter.Parse@206-15<a>.@_instance;
}
}
[Serializable]
[CompilationMapping(/*Could not decode attribute arguments.*/)]
public class FromBigInt : Default1
{
public static FSharpFunc<System.Numerics.BigInteger, R> FromBigInt<R>(R _arg1, Default4 _arg2)
{
return $Numeric.FromBigInt@19<R>.@_instance;
}
public static FSharpFunc<System.Numerics.BigInteger, R> FromBigInt$W<R>(FSharpFunc<R, FSharpFunc<Explicit, FSharpFunc<System.Numerics.BigInteger, R>>> @explicit, R _arg1, Default4 _arg2)
{
return new $Numeric.FromBigInt@19-2<R>(@explicit);
}
public static FSharpFunc<System.Numerics.BigInteger, R> FromBigInt<R>(R _arg3, Default3 _arg4)
{
return $Numeric.FromBigInt@20-4<R>.@_instance;
}
public static FSharpFunc<System.Numerics.BigInteger, R> FromBigInt$W<R>(FSharpFunc<long, R> op_Implicit, R _arg3, Default3 _arg4)
{
return new $Numeric.FromBigInt@20-5<R>(op_Implicit);
}
public static FSharpFunc<System.Numerics.BigInteger, R> FromBigInt<R>(R _arg5, Default2 _arg6)
{
return $Numeric.FromBigInt@21-6<R>.@_instance;
}
public static FSharpFunc<System.Numerics.BigInteger, R> FromBigInt$W<R>(FSharpFunc<System.Numerics.BigInteger, R> op_Implicit, R _arg5, Default2 _arg6)
{
return new $Numeric.FromBigInt@21-7<R>(op_Implicit);
}
public static FSharpFunc<System.Numerics.BigInteger, R> FromBigInt<R>(R _arg7, Default1 _arg8)
{
return $Numeric.FromBigInt@22-8<R>.@_instance;
}
public static FSharpFunc<System.Numerics.BigInteger, R> FromBigInt$W<R>(FSharpFunc<System.Numerics.BigInteger, R> fromBigInt, R _arg7, Default1 _arg8)
{
return new $Numeric.FromBigInt@22-9<R>(fromBigInt);
}
public static FSharpFunc<System.Numerics.BigInteger, R> FromBigInt<R>(Default1 _arg9, Default1 _arg10)
{
return $Numeric.FromBigInt@23-10<R>.@_instance;
}
public static FSharpFunc<System.Numerics.BigInteger, R> FromBigInt$W<R>(FSharpFunc<System.Numerics.BigInteger, R> fromBigInt, Default1 _arg9, Default1 _arg10)
{
return new $Numeric.FromBigInt@23-11<R>(fromBigInt);
}
public static FSharpFunc<System.Numerics.BigInteger, int> FromBigInt(int _arg11, FromBigInt _arg12)
{
return $Numeric.FromBigInt@24-12.@_instance;
}
public static FSharpFunc<System.Numerics.BigInteger, long> FromBigInt(long _arg13, FromBigInt _arg14)
{
return $Numeric.FromBigInt@25-13.@_instance;
}
public static FSharpFunc<System.Numerics.BigInteger, IntPtr> FromBigInt(IntPtr _arg15, FromBigInt _arg16)
{
return $Numeric.FromBigInt@26-14.@_instance;
}
public static FSharpFunc<System.Numerics.BigInteger, UIntPtr> FromBigInt(UIntPtr _arg17, FromBigInt _arg18)
{
return $Numeric.FromBigInt@27-15.@_instance;
}
public static FSharpFunc<System.Numerics.BigInteger, System.Numerics.BigInteger> FromBigInt(System.Numerics.BigInteger _arg19, FromBigInt _arg20)
{
return $Numeric.FromBigInt@28-16.@_instance;
}
public static FSharpFunc<System.Numerics.BigInteger, double> FromBigInt(double _arg21, FromBigInt _arg22)
{
return $Numeric.FromBigInt@29-17.@_instance;
}
public static FSharpFunc<System.Numerics.BigInteger, sbyte> FromBigInt(sbyte _arg23, FromBigInt _arg24)
{
return $Numeric.FromBigInt@30-18.@_instance;
}
public static FSharpFunc<System.Numerics.BigInteger, short> FromBigInt(short _arg25, FromBigInt _arg26)
{
return $Numeric.FromBigInt@31-19.@_instance;
}
public static FSharpFunc<System.Numerics.BigInteger, byte> FromBigInt(byte _arg27, FromBigInt _arg28)
{
return $Numeric.FromBigInt@32-20.@_instance;
}
public static FSharpFunc<System.Numerics.BigInteger, ushort> FromBigInt(ushort _arg29, FromBigInt _arg30)
{
return $Numeric.FromBigInt@33-21.@_instance;
}
public static FSharpFunc<System.Numerics.BigInteger, uint> FromBigInt(uint _arg31, FromBigInt _arg32)
{
return $Numeric.FromBigInt@34-22.@_instance;
}
public static FSharpFunc<System.Numerics.BigInteger, ulong> FromBigInt(ulong _arg33, FromBigInt _arg34)
{
return $Numeric.FromBigInt@35-23.@_instance;
}
public static FSharpFunc<System.Numerics.BigInteger, float> FromBigInt(float _arg35, FromBigInt _arg36)
{
return $Numeric.FromBigInt@36-24.@_instance;
}
public static FSharpFunc<System.Numerics.BigInteger, decimal> FromBigInt(decimal _arg37, FromBigInt _arg38)
{
return $Numeric.FromBigInt@37-25.@_instance;
}
public static Num Invoke<Num>(System.Numerics.BigInteger x)
{
FromBigInt item = null;
return FSharpFunc<Tuple<FSharpPlus.Control.FromBigInt, Num>, System.Numerics.BigInteger>.InvokeFast<Num>((FSharpFunc<Tuple<FromBigInt, Num>, FSharpFunc<System.Numerics.BigInteger, Num>>)$Numeric.Invoke@42-8<Num>.@_instance, new Tuple<FromBigInt, Num>(item, default(Num)), x);
}
public static Num Invoke$W<Num>(FSharpFunc<Num, FSharpFunc<FromBigInt, FSharpFunc<System.Numerics.BigInteger, Num>>> fromBigInt, System.Numerics.BigInteger x)
{
FromBigInt item = null;
return FSharpFunc<Tuple<FSharpPlus.Control.FromBigInt, Num>, System.Numerics.BigInteger>.InvokeFast<Num>((FSharpFunc<Tuple<FromBigInt, Num>, FSharpFunc<System.Numerics.BigInteger, Num>>)new $Numeric.Invoke@42-9<Num>(fromBigInt), new Tuple<FromBigInt, Num>(item, default(Num)), x);
}
}
[Serializable]
[CompilationMapping(/*Could not decode attribute arguments.*/)]
public class FromInt64 : Default1
{
public static FSharpFunc<long, R> FromInt64<R>(R _arg1, Default4 _arg2)
{
return $Numeric.FromInt64@49<R>.@_instance;
}
public static FSharpFunc<long, R> FromInt64$W<R>(FSharpFunc<R, FSharpFunc<Explicit, FSharpFunc<long, R>>> @explicit, R _arg1, Default4 _arg2)
{
return new $Numeric.FromInt64@49-2<R>(@explicit);
}
public static FSharpFunc<long, R> FromInt64<R>(R _arg3, Default3 _arg4)
{
return $Numeric.FromInt64@51-4<R>.@_instance;
}
public static FSharpFunc<long, R> FromInt64$W<R>(FSharpFunc<R, FSharpFunc<FromBigInt, FSharpFunc<System.Numerics.BigInteger, R>>> fromBigInt, R _arg3, Default3 _arg4)
{
return new $Numeric.FromInt64@51-6<R>(fromBigInt);
}
public static FSharpFunc<long, R> FromInt64<R>(R _arg5, Default2 _arg6)
{
return $Numeric.FromInt64@53-8<R>.@_instance;
}
public static FSharpFunc<long, R> FromInt64$W<R>(FSharpFunc<long, R> op_Implicit, R _arg5, Default2 _arg6)
{
return new $Numeric.FromInt64@53-9<R>(op_Implicit);
}
public static FSharpFunc<long, R> FromInt64<R>(R _arg7, Default1 _arg8)
{
return $Numeric.FromInt64@54-10<R>.@_instance;
}
public static FSharpFunc<long, R> FromInt64$W<R>(FSharpFunc<long, R> fromInt64, R _arg7, Default1 _arg8)
{
return new $Numeric.FromInt64@54-11<R>(fromInt64);
}
public static FSharpFunc<long, R> FromInt64<R>(Default1 _arg9, Default1 _arg10)
{
return $Numeric.FromInt64@55-12<R>.@_instance;
}
public static FSharpFunc<long, R> FromInt64$W<R>(FSharpFunc<long, R> fromInt64, Default1 _arg9, Default1 _arg10)
{
return new $Numeric.FromInt64@55-13<R>(fromInt64);
}
public static FSharpFunc<long, int> FromInt64(int _arg11, FromInt64 _arg12)
{
return $Numeric.FromInt64@56-14.@_instance;
}
public static FSharpFunc<long, long> FromInt64(long _arg13, FromInt64 _arg14)
{
return $Numeric.FromInt64@57-15.@_instance;
}
public static FSharpFunc<long, IntPtr> FromInt64(IntPtr _arg15, FromInt64 _arg16)
{
return $Numeric.FromInt64@59-16.@_instance;
}
public static FSharpFunc<long, UIntPtr> FromInt64(UIntPtr _arg17, FromInt64 _arg18)
{
return $Numeric.FromInt64@60-17.@_instance;
}
public static FSharpFunc<long, System.Numerics.BigInteger> FromInt64(System.Numerics.BigInteger _arg19, FromInt64 _arg20)
{
return $Numeric.FromInt64@61-18.@_instance;
}
public static FSharpFunc<long, double> FromInt64(double _arg21, FromInt64 _arg22)
{
return $Numeric.FromInt64@63-19.@_instance;
}
public static FSharpFunc<long, float> FromInt64(float _arg23, FromInt64 _arg24)
{
return $Numeric.FromInt64@64-20.@_instance;
}
public static FSharpFunc<long, decimal> FromInt64(decimal _arg25, FromInt64 _arg26)
{
return $Numeric.FromInt64@65-21.@_instance;
}
public static FSharpFunc<long, sbyte> FromInt64(sbyte _arg27, FromInt64 _arg28)
{
return $Numeric.FromInt64@66-22.@_instance;
}
public static FSharpFunc<long, short> FromInt64(short _arg29, FromInt64 _arg30)
{
return $Numeric.FromInt64@67-23.@_instance;
}
public static FSharpFunc<long, byte> FromInt64(byte _arg31, FromInt64 _arg32)
{
return $Numeric.FromInt64@68-24.@_instance;
}
public static FSharpFunc<long, ushort> FromInt64(ushort _arg33, FromInt64 _arg34)
{
return $Numeric.FromInt64@69-25.@_instance;
}
public static FSharpFunc<long, uint> FromInt64(uint _arg35, FromInt64 _arg36)
{
return $Numeric.FromInt64@70-26.@_instance;
}
public static FSharpFunc<long, ulong> FromInt64(ulong _arg37, FromInt64 _arg38)
{
return $Numeric.FromInt64@71-27.@_instance;
}
public static Num Invoke<Num>(long x)
{
FromInt64 item = null;
return FSharpFunc<Tuple<FSharpPlus.Control.FromInt64, Num>, long>.InvokeFast<Num>((FSharpFunc<Tuple<FromInt64, Num>, FSharpFunc<long, Num>>)$Numeric.Invoke@76-10<Num>.@_instance, new Tuple<FromInt64, Num>(item, default(Num)), x);
}
public static Num Invoke$W<Num>(FSharpFunc<Num, FSharpFunc<FromInt64, FSharpFunc<long, Num>>> fromInt64, long x)
{
FromInt64 item = null;
return FSharpFunc<Tuple<FSharpPlus.Control.FromInt64, Num>, long>.InvokeFast<Num>((FSharpFunc<Tuple<FromInt64, Num>, FSharpFunc<long, Num>>)new $Numeric.Invoke@76-11<Num>(fromInt64), new Tuple<FromInt64, Num>(item, default(Num)), x);
}
}
[Serializable]
[CompilationMapping(/*Could not decode attribute arguments.*/)]
public class FromInt32 : Default1
{
public static FSharpFunc<int, R> FromInt32<R>(R _arg1, Default4 _arg2)
{
return $Numeric.FromInt32@81<R>.@_instance;
}
public static FSharpFunc<int, R> FromInt32$W<R>(FSharpFunc<R, FSharpFunc<Explicit, FSharpFunc<int, R>>> @explicit, R _arg1, Default4 _arg2)
{
return new $Numeric.FromInt32@81-2<R>(@explicit);
}
public static FSharpFunc<int, R> FromInt32<R>(R _arg3, Default3 _arg4)
{
return $Numeric.FromInt32@82-4<R>.@_instance;
}
public static FSharpFunc<int, R> FromInt32$W<R>(FSharpFunc<R, FSharpFunc<FromInt64, FSharpFunc<long, R>>> fromInt64, R _arg3, Default3 _arg4)
{
return new $Numeric.FromInt32@82-6<R>(fromInt64);
}
public static FSharpFunc<int, R> FromInt32<R>(R _arg5, Default2 _arg6)
{
return $Numeric.FromInt32@83-8<R>.@_instance;
}
public static FSharpFunc<int, R> FromInt32$W<R>(FSharpFunc<int, R> op_Implicit, R _arg5, Default2 _arg6)
{
return new $Numeric.FromInt32@83-9<R>(op_Implicit);
}
public static FSharpFunc<int, R> FromInt32<R>(R _arg7, Default1 _arg8)
{
return $Numeric.FromInt32@84-10<R>.@_instance;
}
public static FSharpFunc<int, R> FromInt32$W<R>(FSharpFunc<int, R> fromInt32, R _arg7, Default1 _arg8)
{
return new $Numeric.FromInt32@84-11<R>(fromInt32);
}
public static FSharpFunc<int, R> FromInt32<R>(Default1 _arg9, Default1 _arg10)
{
return $Numeric.FromInt32@85-12<R>.@_instance;
}
public static FSharpFunc<int, R> FromInt32$W<R>(FSharpFunc<int, R> fromInt32, Default1 _arg9, Default1 _arg10)
{
return new $Numeric.FromInt32@85-13<R>(fromInt32);
}
public static FSharpFunc<int, int> FromInt32(int _arg11, FromInt32 _arg12)
{
return $Numeric.FromInt32@86-14.@_instance;
}
public static FSharpFunc<int, long> FromInt32(long _arg13, FromInt32 _arg14)
{
return $Numeric.FromInt32@87-15.@_instance;
}
public static FSharpFunc<int, IntPtr> FromInt32(IntPtr _arg15, FromInt32 _arg16)
{
return $Numeric.FromInt32@89-16.@_instance;
}
public static FSharpFunc<int, UIntPtr> FromInt32(UIntPtr _arg17, FromInt32 _arg18)
{
return $Numeric.FromInt32@90-17.@_instance;
}
public static FSharpFunc<int, System.Numerics.BigInteger> FromInt32(System.Numerics.BigInteger _arg19, FromInt32 _arg20)
{
return $Numeric.FromInt32@91-18.@_instance;
}
public static FSharpFunc<int, double> FromInt32(double _arg21, FromInt32 _arg22)
{
return $Numeric.FromInt32@93-19.@_instance;
}
public static FSharpFunc<int, sbyte> FromInt32(sbyte _arg23, FromInt32 _arg24)
{
return $Numeric.FromInt32@94-20.@_instance;
}
public static FSharpFunc<int, short> FromInt32(short _arg25, FromInt32 _arg26)
{
return $Numeric.FromInt32@95-21.@_instance;
}
public static FSharpFunc<int, byte> FromInt32(byte _arg27, FromInt32 _arg28)
{
return $Numeric.FromInt32@96-22.@_instance;
}
public static FSharpFunc<int, ushort> FromInt32(ushort _arg29, FromInt32 _arg30)
{
return $Numeric.FromInt32@97-23.@_instance;
}
public static FSharpFunc<int, uint> FromInt32(uint _arg31, FromInt32 _arg32)
{
return $Numeric.FromInt32@98-24.@_instance;
}
public static FSharpFunc<int, ulong> FromInt32(ulong _arg33, FromInt32 _arg34)
{
return $Numeric.FromInt32@99-25.@_instance;
}
public static FSharpFunc<int, float> FromInt32(float _arg35, FromInt32 _arg36)
{
return $Numeric.FromInt32@100-26.@_instance;
}
public static FSharpFunc<int, decimal> FromInt32(decimal _arg37, FromInt32 _arg38)
{
return $Numeric.FromInt32@101-27.@_instance;
}
public static Num Invoke<Num>(int x)
{
FromInt32 item = null;
return FSharpFunc<Tuple<FSharpPlus.Control.FromInt32, Num>, int>.InvokeFast<Num>((FSharpFunc<Tuple<FromInt32, Num>, FSharpFunc<int, Num>>)$Numeric.Invoke@106-12<Num>.@_instance, new Tuple<FromInt32, Num>(item, default(Num)), x);
}
public static Num Invoke$W<Num>(FSharpFunc<Num, FSharpFunc<FromInt32, FSharpFunc<int, Num>>> fromInt32, int x)
{
FromInt32 item = null;
return FSharpFunc<Tuple<FSharpPlus.Control.FromInt32, Num>, int>.InvokeFast<Num>((FSharpFunc<Tuple<FromInt32, Num>, FSharpFunc<int, Num>>)new $Numeric.Invoke@106-13<Num>(fromInt32), new Tuple<FromInt32, Num>(item, default(Num)), x);
}
public static Num InvokeOnInstance<Num>(int x)
{
throw new NotSupportedException("Dynamic invocation of FromInt32 is not supported");
}
public static Num InvokeOnInstance$W<Num>(FSharpFunc<int, Num> fromInt32, int x)
{
return fromInt32.Invoke(x);
}
}
[Serializable]
[CompilationMapping(/*Could not decode attribute arguments.*/)]
public class One : Default1
{
public static t One<t>(t _arg1, Default1 _arg2)
{
FromInt32 item = null;
return FSharpFunc<Tuple<FromInt32, t>, int>.InvokeFast<t>((FSharpFunc<Tuple<FromInt32, t>, FSharpFunc<int, t>>)$Numeric.One@115<t>.@_instance, new Tuple<FromInt32, t>(item, default(t)), 1);
}
public static t One$W<t>(FSharpFunc<t, FSharpFunc<FromInt32, FSharpFunc<int, t>>> fromInt32, t _arg1, Default1 _arg2)
{
FromInt32 item = null;
return FSharpFunc<Tuple<FromInt32, t>, int>.InvokeFast<t>((FSharpFunc<Tuple<FromInt32, t>, FSharpFunc<int, t>>)new $Numeric.One@115-1<t>(fromInt32), new Tuple<FromInt32, t>(item, default(t)), 1);
}
public static t One<t>(t _arg3, One _arg4)
{
return LanguagePrimitives.GenericOneDynamic<t>();
}
public static t One$W<t>(FSharpFunc<Unit, t> get_One, t _arg3, One _arg4)
{
return get_One.Invoke((Unit)null);
}
public static FSharpFunc<a, a> One<t, a>(t _arg5, One _arg6) where t : class
{
return $Numeric.One@117-2<a>.@_instance;
}
public static Num Invoke<Num>()
{
One one = null;
throw new NotSupportedException("Dynamic invocation of One is not supported");
}
public static Num Invoke$W<Num>(FSharpFunc<Num, FSharpFunc<One, Num>> one)
{
One one2 = null;
return FSharpFunc<Num, FSharpPlus.Control.One>.InvokeFast<Num>(one, default(Num), one2);
}
}
[Serializable]
[CompilationMapping(/*Could not decode attribute arguments.*/)]
public class Zero : Default1
{
public static TimeSpan Zero(TimeSpan _arg1, Zero _arg2)
{
return default(TimeSpan);
}
public static DmStruct Zero(DmStruct _arg3, Zero _arg4)
{
return default(DmStruct);
}
public static FSharpList<a> Zero<a>(FSharpList<a> _arg5, Zero _arg6)
{
return FSharpList<a>.Empty;
}
public static FSharpOption<a> Zero<a>(FSharpOption<a> _arg7, Zero _arg8)
{
return null;
}
public static FSharpValueOption<a> Zero<a>(FSharpValueOption<a> _arg9, Zero _arg10)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
return FSharpValueOption<a>.ValueNone;
}
public static a[] Zero<a>(a[] _arg11, Zero _arg12)
{
return System.Array.Empty<a>();
}
public static string Zero(string _arg13, Zero _arg14)
{
return "";
}
public static StringBuilder Zero(StringBuilder _arg15, Zero _arg16)
{
return new StringBuilder();
}
public static void Zero(Unit _arg17, Zero _arg18)
{
}
public static bool Zero(bool _arg19, Zero _arg20)
{
return false;
}
public static FSharpSet<a> Zero<a>(FSharpSet<a> _arg21, Zero _arg22)
{
return SetModule.Empty<a>();
}
public static FSharpMap<a, b> Zero<a, b>(FSharpMap<a, b> _arg23, Zero _arg24)
{
return MapModule.Empty<a, b>();
}
public static a Invoke<a>()
{
Zero zero = null;
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
public static a Invoke$W<a>(FSharpFunc<a, FSharpFunc<Zero, a>> zero)
{
Zero zero2 = null;
return FSharpFunc<a, FSharpPlus.Control.Zero>.InvokeFast<a>(zero, default(a), zero2);
}
public static t Zero<t, t1, t2, t3, t4, t5, t6, t7, tr>(t t, Zero _arg1)
{
Zero zero = null;
if (0 == 0)
{
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
tr rest = (tr)(object)null;
zero = null;
if (0 == 0)
{
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
t7 item = (t7)(object)null;
zero = null;
if (0 == 0)
{
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
t6 item2 = (t6)(object)null;
zero = null;
if (0 == 0)
{
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
t5 item3 = (t5)(object)null;
zero = null;
if (0 == 0)
{
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
t4 item4 = (t4)(object)null;
zero = null;
if (0 == 0)
{
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
t3 item5 = (t3)(object)null;
zero = null;
if (0 == 0)
{
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
t2 item6 = (t2)(object)null;
zero = null;
if (0 == 0)
{
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
t1 item7 = (t1)(object)null;
return (t)new Tuple<t1, t2, t3, t4, t5, t6, t7, tr>(item7, item6, item5, item4, item3, item2, item, rest);
}
public static t Zero$W<t, t1, t2, t3, t4, t5, t6, t7, tr>(FSharpFunc<t1, FSharpFunc<Zero, t1>> zero, FSharpFunc<t2, FSharpFunc<Zero, t2>> zero1, FSharpFunc<t3, FSharpFunc<Zero, t3>> zero2, FSharpFunc<t4, FSharpFunc<Zero, t4>> zero3, FSharpFunc<t5, FSharpFunc<Zero, t5>> zero4, FSharpFunc<t6, FSharpFunc<Zero, t6>> zero5, FSharpFunc<t7, FSharpFunc<Zero, t7>> zero6, FSharpFunc<tr, FSharpFunc<Zero, tr>> zero7, FSharpFunc<t, t1> get_Item1, FSharpFunc<t, t2> get_Item2, FSharpFunc<t, t3> get_Item3, FSharpFunc<t, t4> get_Item4, FSharpFunc<t, t5> get_Item5, FSharpFunc<t, t6> get_Item6, FSharpFunc<t, t7> get_Item7, FSharpFunc<t, tr> get_Rest, t t, Zero _arg1)
{
Zero zero8 = null;
tr rest = FSharpFunc<?, FSharpPlus.Control.Zero>.InvokeFast<tr>((FSharpFunc<?, FSharpFunc<Zero, tr>>)(object)zero7, default(tr), zero8);
zero8 = null;
t7 item = FSharpFunc<?, FSharpPlus.Control.Zero>.InvokeFast<t7>((FSharpFunc<?, FSharpFunc<Zero, t7>>)(object)zero6, default(t7), zero8);
zero8 = null;
t6 item2 = FSharpFunc<?, FSharpPlus.Control.Zero>.InvokeFast<t6>((FSharpFunc<?, FSharpFunc<Zero, t6>>)(object)zero5, default(t6), zero8);
zero8 = null;
t5 item3 = FSharpFunc<?, FSharpPlus.Control.Zero>.InvokeFast<t5>((FSharpFunc<?, FSharpFunc<Zero, t5>>)(object)zero4, default(t5), zero8);
zero8 = null;
t4 item4 = FSharpFunc<?, FSharpPlus.Control.Zero>.InvokeFast<t4>((FSharpFunc<?, FSharpFunc<Zero, t4>>)(object)zero3, default(t4), zero8);
zero8 = null;
t3 item5 = FSharpFunc<?, FSharpPlus.Control.Zero>.InvokeFast<t3>((FSharpFunc<?, FSharpFunc<Zero, t3>>)(object)zero2, default(t3), zero8);
zero8 = null;
t2 item6 = FSharpFunc<?, FSharpPlus.Control.Zero>.InvokeFast<t2>((FSharpFunc<?, FSharpFunc<Zero, t2>>)(object)zero1, default(t2), zero8);
zero8 = null;
t1 item7 = FSharpFunc<?, FSharpPlus.Control.Zero>.InvokeFast<t1>((FSharpFunc<?, FSharpFunc<Zero, t1>>)(object)zero, default(t1), zero8);
return (t)new Tuple<t1, t2, t3, t4, t5, t6, t7, tr>(item7, item6, item5, item4, item3, item2, item, rest);
}
public static Tuple<a> Zero<a>(Tuple<a> _arg1, Zero _arg2)
{
Zero zero = null;
if (0 == 0)
{
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
return new Tuple<a>((a)(object)null);
}
public static Tuple<a> Zero$W<a>(FSharpFunc<a, FSharpFunc<Zero, a>> zero, Tuple<a> _arg1, Zero _arg2)
{
Zero zero2 = null;
return new Tuple<a>(FSharpFunc<a, FSharpPlus.Control.Zero>.InvokeFast<a>(zero, default(a), zero2));
}
public static Id<a> Zero<a, a>(Id<a> _arg3, Zero _arg4)
{
Zero zero = null;
if (0 == 0)
{
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
return new Id<a>((a)(object)null);
}
public static Id<a> Zero$W<a, a>(FSharpFunc<a, FSharpFunc<Zero, a>> zero, Id<a> _arg3, Zero _arg4)
{
Zero zero2 = null;
return new Id<a>(FSharpFunc<?, FSharpPlus.Control.Zero>.InvokeFast<a>((FSharpFunc<?, FSharpFunc<Zero, a>>)(object)zero, default(a), zero2));
}
public static ValueTuple<a> Zero<a>(ValueTuple<a> _arg5, Zero _arg6)
{
Zero zero = null;
if (0 == 0)
{
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
return new ValueTuple<a>((a)(object)null);
}
public static ValueTuple<a> Zero$W<a>(FSharpFunc<a, FSharpFunc<Zero, a>> zero, ValueTuple<a> _arg5, Zero _arg6)
{
Zero zero2 = null;
return new ValueTuple<a>(FSharpFunc<a, FSharpPlus.Control.Zero>.InvokeFast<a>(zero, default(a), zero2));
}
public static Tuple<a, b> Zero<a, b>(Tuple<a, b> _arg1, Zero _arg2)
{
Zero zero = null;
if (false)
{
a item = (a)(object)null;
zero = null;
if (0 == 0)
{
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
return new Tuple<a, b>(item, (b)(object)null);
}
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
public static Tuple<a, b> Zero$W<a, b>(FSharpFunc<a, FSharpFunc<Zero, a>> zero, FSharpFunc<b, FSharpFunc<Zero, b>> zero1, Tuple<a, b> _arg1, Zero _arg2)
{
Zero zero2 = null;
a item = FSharpFunc<a, FSharpPlus.Control.Zero>.InvokeFast<a>(zero, default(a), zero2);
zero2 = null;
return new Tuple<a, b>(item, FSharpFunc<?, FSharpPlus.Control.Zero>.InvokeFast<b>((FSharpFunc<?, FSharpFunc<Zero, b>>)(object)zero1, default(b), zero2));
}
public static Tuple<a, b, c> Zero<a, b, c>(Tuple<a, b, c> _arg1, Zero _arg2)
{
Zero zero = null;
if (false)
{
a item = (a)(object)null;
zero = null;
if (false)
{
b item2 = (b)(object)null;
zero = null;
if (0 == 0)
{
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
return new Tuple<a, b, c>(item, item2, (c)(object)null);
}
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
public static Tuple<a, b, c> Zero$W<a, b, c>(FSharpFunc<a, FSharpFunc<Zero, a>> zero, FSharpFunc<b, FSharpFunc<Zero, b>> zero1, FSharpFunc<c, FSharpFunc<Zero, c>> zero2, Tuple<a, b, c> _arg1, Zero _arg2)
{
Zero zero3 = null;
a item = FSharpFunc<a, FSharpPlus.Control.Zero>.InvokeFast<a>(zero, default(a), zero3);
zero3 = null;
b item2 = FSharpFunc<?, FSharpPlus.Control.Zero>.InvokeFast<b>((FSharpFunc<?, FSharpFunc<Zero, b>>)(object)zero1, default(b), zero3);
zero3 = null;
return new Tuple<a, b, c>(item, item2, FSharpFunc<?, FSharpPlus.Control.Zero>.InvokeFast<c>((FSharpFunc<?, FSharpFunc<Zero, c>>)(object)zero2, default(c), zero3));
}
public static Tuple<a, b, c, d> Zero<a, b, c, d>(Tuple<a, b, c, d> _arg1, Zero _arg2)
{
Zero zero = null;
if (false)
{
a item = (a)(object)null;
zero = null;
if (false)
{
b item2 = (b)(object)null;
zero = null;
if (false)
{
c item3 = (c)(object)null;
zero = null;
if (0 == 0)
{
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
return new Tuple<a, b, c, d>(item, item2, item3, (d)(object)null);
}
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
public static Tuple<a, b, c, d> Zero$W<a, b, c, d>(FSharpFunc<a, FSharpFunc<Zero, a>> zero, FSharpFunc<b, FSharpFunc<Zero, b>> zero1, FSharpFunc<c, FSharpFunc<Zero, c>> zero2, FSharpFunc<d, FSharpFunc<Zero, d>> zero3, Tuple<a, b, c, d> _arg1, Zero _arg2)
{
Zero zero4 = null;
a item = FSharpFunc<a, FSharpPlus.Control.Zero>.InvokeFast<a>(zero, default(a), zero4);
zero4 = null;
b item2 = FSharpFunc<?, FSharpPlus.Control.Zero>.InvokeFast<b>((FSharpFunc<?, FSharpFunc<Zero, b>>)(object)zero1, default(b), zero4);
zero4 = null;
c item3 = FSharpFunc<?, FSharpPlus.Control.Zero>.InvokeFast<c>((FSharpFunc<?, FSharpFunc<Zero, c>>)(object)zero2, default(c), zero4);
zero4 = null;
return new Tuple<a, b, c, d>(item, item2, item3, FSharpFunc<?, FSharpPlus.Control.Zero>.InvokeFast<d>((FSharpFunc<?, FSharpFunc<Zero, d>>)(object)zero3, default(d), zero4));
}
public static Tuple<a, b, c, d, e> Zero<a, b, c, d, e>(Tuple<a, b, c, d, e> _arg1, Zero _arg2)
{
Zero zero = null;
if (false)
{
a item = (a)(object)null;
zero = null;
if (false)
{
b item2 = (b)(object)null;
zero = null;
if (false)
{
c item3 = (c)(object)null;
zero = null;
if (false)
{
d item4 = (d)(object)null;
zero = null;
if (0 == 0)
{
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
return new Tuple<a, b, c, d, e>(item, item2, item3, item4, (e)(object)null);
}
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
public static Tuple<a, b, c, d, e> Zero$W<a, b, c, d, e>(FSharpFunc<a, FSharpFunc<Zero, a>> zero, FSharpFunc<b, FSharpFunc<Zero, b>> zero1, FSharpFunc<c, FSharpFunc<Zero, c>> zero2, FSharpFunc<d, FSharpFunc<Zero, d>> zero3, FSharpFunc<e, FSharpFunc<Zero, e>> zero4, Tuple<a, b, c, d, e> _arg1, Zero _arg2)
{
Zero zero5 = null;
a item = FSharpFunc<a, FSharpPlus.Control.Zero>.InvokeFast<a>(zero, default(a), zero5);
zero5 = null;
b item2 = FSharpFunc<?, FSharpPlus.Control.Zero>.InvokeFast<b>((FSharpFunc<?, FSharpFunc<Zero, b>>)(object)zero1, default(b), zero5);
zero5 = null;
c item3 = FSharpFunc<?, FSharpPlus.Control.Zero>.InvokeFast<c>((FSharpFunc<?, FSharpFunc<Zero, c>>)(object)zero2, default(c), zero5);
zero5 = null;
d item4 = FSharpFunc<?, FSharpPlus.Control.Zero>.InvokeFast<d>((FSharpFunc<?, FSharpFunc<Zero, d>>)(object)zero3, default(d), zero5);
zero5 = null;
return new Tuple<a, b, c, d, e>(item, item2, item3, item4, FSharpFunc<?, FSharpPlus.Control.Zero>.InvokeFast<e>((FSharpFunc<?, FSharpFunc<Zero, e>>)(object)zero4, default(e), zero5));
}
public static Tuple<a, b, c, d, e, f> Zero<a, b, c, d, e, f>(Tuple<a, b, c, d, e, f> _arg1, Zero _arg2)
{
Zero zero = null;
if (false)
{
a item = (a)(object)null;
zero = null;
if (false)
{
b item2 = (b)(object)null;
zero = null;
if (false)
{
c item3 = (c)(object)null;
zero = null;
if (false)
{
d item4 = (d)(object)null;
zero = null;
if (false)
{
e item5 = (e)(object)null;
zero = null;
if (0 == 0)
{
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
return new Tuple<a, b, c, d, e, f>(item, item2, item3, item4, item5, (f)(object)null);
}
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
public static Tuple<a, b, c, d, e, f> Zero$W<a, b, c, d, e, f>(FSharpFunc<a, FSharpFunc<Zero, a>> zero, FSharpFunc<b, FSharpFunc<Zero, b>> zero1, FSharpFunc<c, FSharpFunc<Zero, c>> zero2, FSharpFunc<d, FSharpFunc<Zero, d>> zero3, FSharpFunc<e, FSharpFunc<Zero, e>> zero4, FSharpFunc<f, FSharpFunc<Zero, f>> zero5, Tuple<a, b, c, d, e, f> _arg1, Zero _arg2)
{
Zero zero6 = null;
a item = FSharpFunc<a, FSharpPlus.Control.Zero>.InvokeFast<a>(zero, default(a), zero6);
zero6 = null;
b item2 = FSharpFunc<?, FSharpPlus.Control.Zero>.InvokeFast<b>((FSharpFunc<?, FSharpFunc<Zero, b>>)(object)zero1, default(b), zero6);
zero6 = null;
c item3 = FSharpFunc<?, FSharpPlus.Control.Zero>.InvokeFast<c>((FSharpFunc<?, FSharpFunc<Zero, c>>)(object)zero2, default(c), zero6);
zero6 = null;
d item4 = FSharpFunc<?, FSharpPlus.Control.Zero>.InvokeFast<d>((FSharpFunc<?, FSharpFunc<Zero, d>>)(object)zero3, default(d), zero6);
zero6 = null;
e item5 = FSharpFunc<?, FSharpPlus.Control.Zero>.InvokeFast<e>((FSharpFunc<?, FSharpFunc<Zero, e>>)(object)zero4, default(e), zero6);
zero6 = null;
return new Tuple<a, b, c, d, e, f>(item, item2, item3, item4, item5, FSharpFunc<?, FSharpPlus.Control.Zero>.InvokeFast<f>((FSharpFunc<?, FSharpFunc<Zero, f>>)(object)zero5, default(f), zero6));
}
public static Tuple<a, b, c, d, e, f, g> Zero<a, b, c, d, e, f, g>(Tuple<a, b, c, d, e, f, g> _arg1, Zero _arg2)
{
Zero zero = null;
if (false)
{
a item = (a)(object)null;
zero = null;
if (false)
{
b item2 = (b)(object)null;
zero = null;
if (false)
{
c item3 = (c)(object)null;
zero = null;
if (false)
{
d item4 = (d)(object)null;
zero = null;
if (false)
{
e item5 = (e)(object)null;
zero = null;
if (false)
{
f item6 = (f)(object)null;
zero = null;
if (0 == 0)
{
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
return new Tuple<a, b, c, d, e, f, g>(item, item2, item3, item4, item5, item6, (g)(object)null);
}
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
public static Tuple<a, b, c, d, e, f, g> Zero$W<a, b, c, d, e, f, g>(FSharpFunc<a, FSharpFunc<Zero, a>> zero, FSharpFunc<b, FSharpFunc<Zero, b>> zero1, FSharpFunc<c, FSharpFunc<Zero, c>> zero2, FSharpFunc<d, FSharpFunc<Zero, d>> zero3, FSharpFunc<e, FSharpFunc<Zero, e>> zero4, FSharpFunc<f, FSharpFunc<Zero, f>> zero5, FSharpFunc<g, FSharpFunc<Zero, g>> zero6, Tuple<a, b, c, d, e, f, g> _arg1, Zero _arg2)
{
Zero zero7 = null;
a item = FSharpFunc<a, FSharpPlus.Control.Zero>.InvokeFast<a>(zero, default(a), zero7);
zero7 = null;
b item2 = FSharpFunc<?, FSharpPlus.Control.Zero>.InvokeFast<b>((FSharpFunc<?, FSharpFunc<Zero, b>>)(object)zero1, default(b), zero7);
zero7 = null;
c item3 = FSharpFunc<?, FSharpPlus.Control.Zero>.InvokeFast<c>((FSharpFunc<?, FSharpFunc<Zero, c>>)(object)zero2, default(c), zero7);
zero7 = null;
d item4 = FSharpFunc<?, FSharpPlus.Control.Zero>.InvokeFast<d>((FSharpFunc<?, FSharpFunc<Zero, d>>)(object)zero3, default(d), zero7);
zero7 = null;
e item5 = FSharpFunc<?, FSharpPlus.Control.Zero>.InvokeFast<e>((FSharpFunc<?, FSharpFunc<Zero, e>>)(object)zero4, default(e), zero7);
zero7 = null;
f item6 = FSharpFunc<?, FSharpPlus.Control.Zero>.InvokeFast<f>((FSharpFunc<?, FSharpFunc<Zero, f>>)(object)zero5, default(f), zero7);
zero7 = null;
return new Tuple<a, b, c, d, e, f, g>(item, item2, item3, item4, item5, item6, FSharpFunc<?, FSharpPlus.Control.Zero>.InvokeFast<g>((FSharpFunc<?, FSharpFunc<Zero, g>>)(object)zero6, default(g), zero7));
}
public static (a, b) Zero<a, b>((a, b) _arg1, Zero _arg2)
{
Zero zero = null;
if (false)
{
a item = (a)(object)null;
zero = null;
if (0 == 0)
{
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
return ValueTuple.Create(item, (b)(object)null);
}
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
public static (a, b) Zero$W<a, b>(FSharpFunc<a, FSharpFunc<Zero, a>> zero, FSharpFunc<b, FSharpFunc<Zero, b>> zero1, (a, b) _arg1, Zero _arg2)
{
Zero zero2 = null;
a item = FSharpFunc<a, FSharpPlus.Control.Zero>.InvokeFast<a>(zero, default(a), zero2);
zero2 = null;
return ValueTuple.Create(item, FSharpFunc<?, FSharpPlus.Control.Zero>.InvokeFast<b>((FSharpFunc<?, FSharpFunc<Zero, b>>)(object)zero1, default(b), zero2));
}
public static (a, b, c) Zero<a, b, c>((a, b, c) _arg1, Zero _arg2)
{
Zero zero = null;
if (false)
{
a item = (a)(object)null;
zero = null;
if (false)
{
b item2 = (b)(object)null;
zero = null;
if (0 == 0)
{
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
return ValueTuple.Create(item, item2, (c)(object)null);
}
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
public static (a, b, c) Zero$W<a, b, c>(FSharpFunc<a, FSharpFunc<Zero, a>> zero, FSharpFunc<b, FSharpFunc<Zero, b>> zero1, FSharpFunc<c, FSharpFunc<Zero, c>> zero2, (a, b, c) _arg1, Zero _arg2)
{
Zero zero3 = null;
a item = FSharpFunc<a, FSharpPlus.Control.Zero>.InvokeFast<a>(zero, default(a), zero3);
zero3 = null;
b item2 = FSharpFunc<?, FSharpPlus.Control.Zero>.InvokeFast<b>((FSharpFunc<?, FSharpFunc<Zero, b>>)(object)zero1, default(b), zero3);
zero3 = null;
return ValueTuple.Create(item, item2, FSharpFunc<?, FSharpPlus.Control.Zero>.InvokeFast<c>((FSharpFunc<?, FSharpFunc<Zero, c>>)(object)zero2, default(c), zero3));
}
public static (a, b, c, d) Zero<a, b, c, d>((a, b, c, d) _arg1, Zero _arg2)
{
Zero zero = null;
if (false)
{
a item = (a)(object)null;
zero = null;
if (false)
{
b item2 = (b)(object)null;
zero = null;
if (false)
{
c item3 = (c)(object)null;
zero = null;
if (0 == 0)
{
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
return ValueTuple.Create(item, item2, item3, (d)(object)null);
}
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
public static (a, b, c, d) Zero$W<a, b, c, d>(FSharpFunc<a, FSharpFunc<Zero, a>> zero, FSharpFunc<b, FSharpFunc<Zero, b>> zero1, FSharpFunc<c, FSharpFunc<Zero, c>> zero2, FSharpFunc<d, FSharpFunc<Zero, d>> zero3, (a, b, c, d) _arg1, Zero _arg2)
{
Zero zero4 = null;
a item = FSharpFunc<a, FSharpPlus.Control.Zero>.InvokeFast<a>(zero, default(a), zero4);
zero4 = null;
b item2 = FSharpFunc<?, FSharpPlus.Control.Zero>.InvokeFast<b>((FSharpFunc<?, FSharpFunc<Zero, b>>)(object)zero1, default(b), zero4);
zero4 = null;
c item3 = FSharpFunc<?, FSharpPlus.Control.Zero>.InvokeFast<c>((FSharpFunc<?, FSharpFunc<Zero, c>>)(object)zero2, default(c), zero4);
zero4 = null;
return ValueTuple.Create(item, item2, item3, FSharpFunc<?, FSharpPlus.Control.Zero>.InvokeFast<d>((FSharpFunc<?, FSharpFunc<Zero, d>>)(object)zero3, default(d), zero4));
}
public static (a, b, c, d, e) Zero<a, b, c, d, e>((a, b, c, d, e) _arg1, Zero _arg2)
{
Zero zero = null;
if (false)
{
a item = (a)(object)null;
zero = null;
if (false)
{
b item2 = (b)(object)null;
zero = null;
if (false)
{
c item3 = (c)(object)null;
zero = null;
if (false)
{
d item4 = (d)(object)null;
zero = null;
if (0 == 0)
{
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
return ValueTuple.Create(item, item2, item3, item4, (e)(object)null);
}
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
public static (a, b, c, d, e) Zero$W<a, b, c, d, e>(FSharpFunc<a, FSharpFunc<Zero, a>> zero, FSharpFunc<b, FSharpFunc<Zero, b>> zero1, FSharpFunc<c, FSharpFunc<Zero, c>> zero2, FSharpFunc<d, FSharpFunc<Zero, d>> zero3, FSharpFunc<e, FSharpFunc<Zero, e>> zero4, (a, b, c, d, e) _arg1, Zero _arg2)
{
Zero zero5 = null;
a item = FSharpFunc<a, FSharpPlus.Control.Zero>.InvokeFast<a>(zero, default(a), zero5);
zero5 = null;
b item2 = FSharpFunc<?, FSharpPlus.Control.Zero>.InvokeFast<b>((FSharpFunc<?, FSharpFunc<Zero, b>>)(object)zero1, default(b), zero5);
zero5 = null;
c item3 = FSharpFunc<?, FSharpPlus.Control.Zero>.InvokeFast<c>((FSharpFunc<?, FSharpFunc<Zero, c>>)(object)zero2, default(c), zero5);
zero5 = null;
d item4 = FSharpFunc<?, FSharpPlus.Control.Zero>.InvokeFast<d>((FSharpFunc<?, FSharpFunc<Zero, d>>)(object)zero3, default(d), zero5);
zero5 = null;
return ValueTuple.Create(item, item2, item3, item4, FSharpFunc<?, FSharpPlus.Control.Zero>.InvokeFast<e>((FSharpFunc<?, FSharpFunc<Zero, e>>)(object)zero4, default(e), zero5));
}
public static (a, b, c, d, e, f) Zero<a, b, c, d, e, f>((a, b, c, d, e, f) _arg1, Zero _arg2)
{
Zero zero = null;
if (false)
{
a item = (a)(object)null;
zero = null;
if (false)
{
b item2 = (b)(object)null;
zero = null;
if (false)
{
c item3 = (c)(object)null;
zero = null;
if (false)
{
d item4 = (d)(object)null;
zero = null;
if (false)
{
e item5 = (e)(object)null;
zero = null;
if (0 == 0)
{
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
return ValueTuple.Create(item, item2, item3, item4, item5, (f)(object)null);
}
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
public static (a, b, c, d, e, f) Zero$W<a, b, c, d, e, f>(FSharpFunc<a, FSharpFunc<Zero, a>> zero, FSharpFunc<b, FSharpFunc<Zero, b>> zero1, FSharpFunc<c, FSharpFunc<Zero, c>> zero2, FSharpFunc<d, FSharpFunc<Zero, d>> zero3, FSharpFunc<e, FSharpFunc<Zero, e>> zero4, FSharpFunc<f, FSharpFunc<Zero, f>> zero5, (a, b, c, d, e, f) _arg1, Zero _arg2)
{
Zero zero6 = null;
a item = FSharpFunc<a, FSharpPlus.Control.Zero>.InvokeFast<a>(zero, default(a), zero6);
zero6 = null;
b item2 = FSharpFunc<?, FSharpPlus.Control.Zero>.InvokeFast<b>((FSharpFunc<?, FSharpFunc<Zero, b>>)(object)zero1, default(b), zero6);
zero6 = null;
c item3 = FSharpFunc<?, FSharpPlus.Control.Zero>.InvokeFast<c>((FSharpFunc<?, FSharpFunc<Zero, c>>)(object)zero2, default(c), zero6);
zero6 = null;
d item4 = FSharpFunc<?, FSharpPlus.Control.Zero>.InvokeFast<d>((FSharpFunc<?, FSharpFunc<Zero, d>>)(object)zero3, default(d), zero6);
zero6 = null;
e item5 = FSharpFunc<?, FSharpPlus.Control.Zero>.InvokeFast<e>((FSharpFunc<?, FSharpFunc<Zero, e>>)(object)zero4, default(e), zero6);
zero6 = null;
return ValueTuple.Create(item, item2, item3, item4, item5, FSharpFunc<?, FSharpPlus.Control.Zero>.InvokeFast<f>((FSharpFunc<?, FSharpFunc<Zero, f>>)(object)zero5, default(f), zero6));
}
public static (a, b, c, d, e, f, g) Zero<a, b, c, d, e, f, g>((a, b, c, d, e, f, g) _arg1, Zero _arg2)
{
Zero zero = null;
if (false)
{
a item = (a)(object)null;
zero = null;
if (false)
{
b item2 = (b)(object)null;
zero = null;
if (false)
{
c item3 = (c)(object)null;
zero = null;
if (false)
{
d item4 = (d)(object)null;
zero = null;
if (false)
{
e item5 = (e)(object)null;
zero = null;
if (false)
{
f item6 = (f)(object)null;
zero = null;
if (0 == 0)
{
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
return ValueTuple.Create(item, item2, item3, item4, item5, item6, (g)(object)null);
}
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
public static (a, b, c, d, e, f, g) Zero$W<a, b, c, d, e, f, g>(FSharpFunc<a, FSharpFunc<Zero, a>> zero, FSharpFunc<b, FSharpFunc<Zero, b>> zero1, FSharpFunc<c, FSharpFunc<Zero, c>> zero2, FSharpFunc<d, FSharpFunc<Zero, d>> zero3, FSharpFunc<e, FSharpFunc<Zero, e>> zero4, FSharpFunc<f, FSharpFunc<Zero, f>> zero5, FSharpFunc<g, FSharpFunc<Zero, g>> zero6, (a, b, c, d, e, f, g) _arg1, Zero _arg2)
{
Zero zero7 = null;
a item = FSharpFunc<a, FSharpPlus.Control.Zero>.InvokeFast<a>(zero, default(a), zero7);
zero7 = null;
b item2 = FSharpFunc<?, FSharpPlus.Control.Zero>.InvokeFast<b>((FSharpFunc<?, FSharpFunc<Zero, b>>)(object)zero1, default(b), zero7);
zero7 = null;
c item3 = FSharpFunc<?, FSharpPlus.Control.Zero>.InvokeFast<c>((FSharpFunc<?, FSharpFunc<Zero, c>>)(object)zero2, default(c), zero7);
zero7 = null;
d item4 = FSharpFunc<?, FSharpPlus.Control.Zero>.InvokeFast<d>((FSharpFunc<?, FSharpFunc<Zero, d>>)(object)zero3, default(d), zero7);
zero7 = null;
e item5 = FSharpFunc<?, FSharpPlus.Control.Zero>.InvokeFast<e>((FSharpFunc<?, FSharpFunc<Zero, e>>)(object)zero4, default(e), zero7);
zero7 = null;
f item6 = FSharpFunc<?, FSharpPlus.Control.Zero>.InvokeFast<f>((FSharpFunc<?, FSharpFunc<Zero, f>>)(object)zero5, default(f), zero7);
zero7 = null;
return ValueTuple.Create(item, item2, item3, item4, item5, item6, FSharpFunc<?, FSharpPlus.Control.Zero>.InvokeFast<g>((FSharpFunc<?, FSharpFunc<Zero, g>>)(object)zero6, default(g), zero7));
}
public static Task<a> Zero<a>(Task<a> _arg1, Zero _arg2)
{
Zero zero = null;
if (0 == 0)
{
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
a result = (a)(object)null;
TaskCompletionSource<a> taskCompletionSource = new TaskCompletionSource<a>();
taskCompletionSource.SetResult(result);
return taskCompletionSource.Task;
}
public static Task<a> Zero$W<a>(FSharpFunc<a, FSharpFunc<Zero, a>> zero, Task<a> _arg1, Zero _arg2)
{
Zero zero2 = null;
a result = FSharpFunc<a, FSharpPlus.Control.Zero>.InvokeFast<a>(zero, default(a), zero2);
TaskCompletionSource<a> taskCompletionSource = new TaskCompletionSource<a>();
taskCompletionSource.SetResult(result);
return taskCompletionSource.Task;
}
public static ValueTask<a> Zero<a>(ValueTask<a> _arg3, Zero _arg4)
{
Zero zero = null;
if (0 == 0)
{
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
a result = (a)(object)null;
return new ValueTask<a>(result);
}
public static ValueTask<a> Zero$W<a>(FSharpFunc<a, FSharpFunc<Zero, a>> zero, ValueTask<a> _arg3, Zero _arg4)
{
Zero zero2 = null;
a result = FSharpFunc<a, FSharpPlus.Control.Zero>.InvokeFast<a>(zero, default(a), zero2);
return new ValueTask<a>(result);
}
public static FSharpFunc<T, Monoid> Zero<T, Monoid>(FSharpFunc<T, Monoid> _arg5, Zero _arg6)
{
return $Numeric.Zero@201<T, Monoid>.@_instance;
}
public static FSharpFunc<T, Monoid> Zero$W<T, Monoid>(FSharpFunc<Monoid, FSharpFunc<Zero, Monoid>> zero, FSharpFunc<T, Monoid> _arg5, Zero _arg6)
{
return new $Numeric.Zero@201-1<T, Monoid>(zero);
}
public static FSharpAsync<a> Zero<a>(FSharpAsync<a> _arg7, Zero _arg8)
{
Zero zero = null;
if (0 == 0)
{
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
a v = (a)(object)null;
return AsyncPrimitives.MakeAsync<a>((FSharpFunc<AsyncActivation<a>, AsyncReturn>)new $Numeric.Zero@202-2<a>(v));
}
public static FSharpAsync<a> Zero$W<a>(FSharpFunc<a, FSharpFunc<Zero, a>> zero, FSharpAsync<a> _arg7, Zero _arg8)
{
Zero zero2 = null;
a v = FSharpFunc<a, FSharpPlus.Control.Zero>.InvokeFast<a>(zero, default(a), zero2);
return AsyncPrimitives.MakeAsync<a>((FSharpFunc<AsyncActivation<a>, AsyncReturn>)new $Numeric.Zero@202-3<a>(zero, v));
}
public static FSharpExpr<a> Zero<a>(FSharpExpr<a> _arg9, Zero _arg10)
{
Zero zero = null;
if (0 == 0)
{
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
a val = (a)(object)null;
return FSharpExpr.Cast<a>(FSharpExpr.Value<a>(val));
}
public static FSharpExpr<a> Zero$W<a>(FSharpFunc<a, FSharpFunc<Zero, a>> zero, FSharpExpr<a> _arg9, Zero _arg10)
{
Zero zero2 = null;
a val = FSharpFunc<a, FSharpPlus.Control.Zero>.InvokeFast<a>(zero, default(a), zero2);
return FSharpExpr.Cast<a>(FSharpExpr.Value<a>(val));
}
public static Lazy<a> Zero<a>(Lazy<a> _arg11, Zero _arg12)
{
Zero zero = null;
if (0 == 0)
{
throw new NotSupportedException("Dynamic invocation of Zero is not supported");
}
a v = (a)(object)null;
return LazyExtensions.Create<a>((FSharpFunc<Unit, a>)new $Numeric.Zero@206-4<a>(v));
}
public static Lazy<a> Zero$W<a>(FSharpFunc<a, FSharpFunc<Zero, a>> zero, Lazy<a> _arg11, Zero _arg12)
{
Zero zero2 = null;
a v = FSharpFunc<a, FSharpPlus.Control.Zero>.InvokeFast<a>(zero, default(a), zero2);
return LazyExtensions.Create<a>((FSharpFunc<Unit, a>)new $Numeric.Zero@206-5<a>(zero, v));
}
public static Dictionary<a, b> Zero<a, b>(Dictionary<a, b> _arg13, Zero _arg14)
{
return new Dictionary<a, b>();
}
public static List<a> Zero<a>(List<a> _arg15, Zero _arg16)
{
return new List<a>();
}
public static R Zero<R>(R _arg1, Default6 _arg2)
{
FromInt64 item = null;
return FSharpFunc<Tuple<FromInt64, R>, long>.InvokeFast<R>((FSharpFunc<Tuple<FromInt64, R>, FSharpFunc<long, R>>)$Numeric.Zero@211-6<R>.@_instance, new Tuple<FromInt64, R>(item, default(R)), 0L);
}
public static R Zero$W<R>(FSharpFunc<R, FSharpFunc<FromInt64, FSharpFunc<long, R>>> fromInt64, R _arg1, Default6 _arg2)
{
FromInt64 item = null;
return FSharpFunc<Tuple<FromInt64, R>, long>.InvokeFast<R>((FSharpFunc<Tuple<FromInt64, R>, FSharpFunc<long, R>>)new $Numeric.Zero@211-7<R>(fromInt64), new Tuple<FromInt64, R>(item, default(R)), 0L);
}
public static R Zero<R>(R _arg3, Default5 _arg4)
{
throw new NotSupportedException("Dynamic invocation of op_Implicit is not supported");
}
public static R Zero$W<R>(FSharpFunc<int, R> op_Implicit, R _arg3, Default5 _arg4)
{
return op_Implicit.Invoke(0);
}
public static IEnumerable<a> Zero<a>(IEnumerable<a> _arg5, Default4 _arg6)
{
return SeqModule.Empty<a>();
}
public static IEnumerator<a> Zero<a>(IEnumerator<a> _arg7, Default4 _arg8)
{
return new Enumerator.EmptyEnumerator<a>();
}
public static IDictionary<a, b> Zero<a, b>(IDictionary<a, b> _arg9, Default4 _arg10)
{
return new Dictionary<a, b>();
}
public static IReadOnlyDictionary<a, b> Zero<a, b>(IReadOnlyDictionary<a, b> _arg11, Default4 _arg12)
{
return new Dictionary<a, b>();
}
public static t Zero<t>(t _arg13, Default3 _arg14)
{
throw new NotSupportedException("Dynamic invocation of get_Empty is not supported");
}
public static t Zero$W<t>(FSharpFunc<Unit, t> get_Empty, t _arg13, Default3 _arg14)
{
return get_Empty.Invoke((Unit)null);
}
public static t Zero<t>(t _arg15, Default2 _arg16)
{
throw new NotSupportedException("Dynamic invocation of FromInt32 is not supported");
}
public static t Zero$W<t>(FSharpFunc<int, t> fromInt32, t _arg15, Default2 _arg16)
{
return fromInt32.Invoke(0);
}
public static FSharpFunc<a, a> Zero<t, a>(t _arg17, Default2 _arg18) where t : class
{
return $Numeric.Zero@222-8<a>.@_instance;
}
public static t Zero<t>(t _arg19, Default1 _arg20)
{
return LanguagePrimitives.GenericZeroDynamic<t>();
}
public static t Zero$W<t>(FSharpFunc<Unit, t> get_Zero, t _arg19, Default1 _arg20)
{
return get_Zero.Invoke((Unit)null);
}
public static FSharpFunc<a, a> Zero<t, a>(t _arg21, Default1 _arg22) where t : class
{
return $Numeric.Zero@225-9<a>.@_instance;
}
}
[Serializable]
[CompilationMapping(/*Could not decode attribute arguments.*/)]
public class Abs : Default1
{
public static t Abs<t, u>(t x, Default2 _arg1)
{
if (0 == 0)
{
throw new NotSupportedException("Dynamic invocation of Abs is not supported");
}
u val = (u)(object)null;
Explicit item = null;
return FSharpFunc<Tuple<Explicit, t>, ?>.InvokeFast<t>((FSharpFunc<Tuple<Explicit, t>, FSharpFunc<?, t>>)(object)$Numeric.Abs@231<t, u>.@_instance, new Tuple<Explicit, t>(item, default(t)), val);
}
public static t Abs$W<t,