diff options
author | Zoltan Varga <vargaz@gmail.com> | 2020-09-09 00:52:33 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-09 00:52:33 +0300 |
commit | 6e103e7191dcb17120032f2516cc7f8e9e04c32e (patch) | |
tree | a3ee2ea7450809dac229fc084683df3f335942ad /netcore/System.Private.CoreLib/shared/System/Reflection | |
parent | 427395f4c6a18466c26d0cf782bed106d05e77ae (diff) |
Remove netcore/ directory from the mono/mono repository. (#20361)
Diffstat (limited to 'netcore/System.Private.CoreLib/shared/System/Reflection')
112 files changed, 0 insertions, 7906 deletions
diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/AmbiguousMatchException.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/AmbiguousMatchException.cs deleted file mode 100644 index f6472c9953a..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/AmbiguousMatchException.cs +++ /dev/null @@ -1,35 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Runtime.Serialization; - -namespace System.Reflection -{ - [Serializable] - [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] - public sealed class AmbiguousMatchException : SystemException - { - public AmbiguousMatchException() - : base(SR.RFLCT_Ambiguous) - { - HResult = HResults.COR_E_AMBIGUOUSMATCH; - } - - public AmbiguousMatchException(string? message) - : base(message) - { - HResult = HResults.COR_E_AMBIGUOUSMATCH; - } - - public AmbiguousMatchException(string? message, Exception? inner) - : base(message, inner) - { - HResult = HResults.COR_E_AMBIGUOUSMATCH; - } - - private AmbiguousMatchException(SerializationInfo info, StreamingContext context) : base(info, context) - { - } - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/Assembly.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/Assembly.cs deleted file mode 100644 index 6e344ff052a..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/Assembly.cs +++ /dev/null @@ -1,354 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.IO; -using System.Globalization; -using System.Collections.Generic; -using System.Configuration.Assemblies; -using System.Runtime.Serialization; -using System.Security; -using System.Runtime.CompilerServices; -using System.Runtime.Loader; - -namespace System.Reflection -{ - public abstract partial class Assembly : ICustomAttributeProvider, ISerializable - { - private static readonly Dictionary<string, Assembly> s_loadfile = new Dictionary<string, Assembly>(); - private static readonly List<string> s_loadFromAssemblyList = new List<string>(); - private static bool s_loadFromHandlerSet; - private static int s_cachedSerializationSwitch; - - protected Assembly() { } - - public virtual IEnumerable<TypeInfo> DefinedTypes - { - get - { - Type[] types = GetTypes(); - TypeInfo[] typeinfos = new TypeInfo[types.Length]; - for (int i = 0; i < types.Length; i++) - { - TypeInfo typeinfo = types[i].GetTypeInfo(); - if (typeinfo == null) - throw new NotSupportedException(SR.Format(SR.NotSupported_NoTypeInfo, types[i].FullName)); - - typeinfos[i] = typeinfo; - } - return typeinfos; - } - } - - public virtual Type[] GetTypes() - { - Module[] m = GetModules(false); - if (m.Length == 1) - { - return m[0].GetTypes(); - } - - int finalLength = 0; - Type[][] moduleTypes = new Type[m.Length][]; - - for (int i = 0; i < moduleTypes.Length; i++) - { - moduleTypes[i] = m[i].GetTypes(); - finalLength += moduleTypes[i].Length; - } - - int current = 0; - Type[] ret = new Type[finalLength]; - for (int i = 0; i < moduleTypes.Length; i++) - { - int length = moduleTypes[i].Length; - Array.Copy(moduleTypes[i], 0, ret, current, length); - current += length; - } - - return ret; - } - - public virtual IEnumerable<Type> ExportedTypes => GetExportedTypes(); - public virtual Type[] GetExportedTypes() { throw NotImplemented.ByDesign; } - public virtual Type[] GetForwardedTypes() { throw NotImplemented.ByDesign; } - - public virtual string? CodeBase => throw NotImplemented.ByDesign; - public virtual MethodInfo? EntryPoint => throw NotImplemented.ByDesign; - public virtual string? FullName => throw NotImplemented.ByDesign; - public virtual string ImageRuntimeVersion => throw NotImplemented.ByDesign; - public virtual bool IsDynamic => false; - public virtual string Location => throw NotImplemented.ByDesign; - public virtual bool ReflectionOnly => throw NotImplemented.ByDesign; - public virtual bool IsCollectible => true; - - public virtual ManifestResourceInfo? GetManifestResourceInfo(string resourceName) { throw NotImplemented.ByDesign; } - public virtual string[] GetManifestResourceNames() { throw NotImplemented.ByDesign; } - public virtual Stream? GetManifestResourceStream(string name) { throw NotImplemented.ByDesign; } - public virtual Stream? GetManifestResourceStream(Type type, string name) { throw NotImplemented.ByDesign; } - - public bool IsFullyTrusted => true; - - public virtual AssemblyName GetName() => GetName(copiedName: false); - public virtual AssemblyName GetName(bool copiedName) { throw NotImplemented.ByDesign; } - - public virtual Type? GetType(string name) => GetType(name, throwOnError: false, ignoreCase: false); - public virtual Type? GetType(string name, bool throwOnError) => GetType(name, throwOnError: throwOnError, ignoreCase: false); - public virtual Type? GetType(string name, bool throwOnError, bool ignoreCase) { throw NotImplemented.ByDesign; } - - public virtual bool IsDefined(Type attributeType, bool inherit) { throw NotImplemented.ByDesign; } - - public virtual IEnumerable<CustomAttributeData> CustomAttributes => GetCustomAttributesData(); - public virtual IList<CustomAttributeData> GetCustomAttributesData() { throw NotImplemented.ByDesign; } - - public virtual object[] GetCustomAttributes(bool inherit) { throw NotImplemented.ByDesign; } - public virtual object[] GetCustomAttributes(Type attributeType, bool inherit) { throw NotImplemented.ByDesign; } - - public virtual string EscapedCodeBase => AssemblyName.EscapeCodeBase(CodeBase); - - public object? CreateInstance(string typeName) => CreateInstance(typeName, false, BindingFlags.Public | BindingFlags.Instance, binder: null, args: null, culture: null, activationAttributes: null); - public object? CreateInstance(string typeName, bool ignoreCase) => CreateInstance(typeName, ignoreCase, BindingFlags.Public | BindingFlags.Instance, binder: null, args: null, culture: null, activationAttributes: null); - public virtual object? CreateInstance(string typeName, bool ignoreCase, BindingFlags bindingAttr, Binder? binder, object[]? args, CultureInfo? culture, object[]? activationAttributes) - { - Type? t = GetType(typeName, throwOnError: false, ignoreCase: ignoreCase); - if (t == null) - return null; - - return Activator.CreateInstance(t, bindingAttr, binder, args, culture, activationAttributes); - } - - public virtual event ModuleResolveEventHandler? ModuleResolve { add { throw NotImplemented.ByDesign; } remove { throw NotImplemented.ByDesign; } } - - public virtual Module ManifestModule => throw NotImplemented.ByDesign; - public virtual Module? GetModule(string name) { throw NotImplemented.ByDesign; } - - public Module[] GetModules() => GetModules(getResourceModules: false); - public virtual Module[] GetModules(bool getResourceModules) { throw NotImplemented.ByDesign; } - - public virtual IEnumerable<Module> Modules => GetLoadedModules(getResourceModules: true); - public Module[] GetLoadedModules() => GetLoadedModules(getResourceModules: false); - public virtual Module[] GetLoadedModules(bool getResourceModules) { throw NotImplemented.ByDesign; } - - public virtual AssemblyName[] GetReferencedAssemblies() { throw NotImplemented.ByDesign; } - - public virtual Assembly GetSatelliteAssembly(CultureInfo culture) { throw NotImplemented.ByDesign; } - public virtual Assembly GetSatelliteAssembly(CultureInfo culture, Version? version) { throw NotImplemented.ByDesign; } - - public virtual FileStream? GetFile(string name) { throw NotImplemented.ByDesign; } - public virtual FileStream[] GetFiles() => GetFiles(getResourceModules: false); - public virtual FileStream[] GetFiles(bool getResourceModules) { throw NotImplemented.ByDesign; } - - public virtual void GetObjectData(SerializationInfo info, StreamingContext context) { throw NotImplemented.ByDesign; } - - public override string ToString() - { - return FullName ?? base.ToString()!; - } - - /* - Returns true if the assembly was loaded from the global assembly cache. - */ - public virtual bool GlobalAssemblyCache => throw NotImplemented.ByDesign; - public virtual long HostContext => throw NotImplemented.ByDesign; - - public override bool Equals(object? o) => base.Equals(o); - public override int GetHashCode() => base.GetHashCode(); - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool operator ==(Assembly? left, Assembly? right) - { - // Test "right" first to allow branch elimination when inlined for null checks (== null) - // so it can become a simple test - if (right is null) - { - // return true/false not the test result https://github.com/dotnet/coreclr/issues/914 - return (left is null) ? true : false; - } - - // Try fast reference equality and opposite null check prior to calling the slower virtual Equals - if ((object?)left == (object)right) - { - return true; - } - - return (left is null) ? false : left.Equals(right); - } - - public static bool operator !=(Assembly? left, Assembly? right) => !(left == right); - - public static string CreateQualifiedName(string? assemblyName, string? typeName) => typeName + ", " + assemblyName; - - public static Assembly? GetAssembly(Type type) - { - if (type == null) - throw new ArgumentNullException(nameof(type)); - - Module m = type.Module; - if (m == null) - return null; - else - return m.Assembly; - } - - // internal test hook - private static bool s_forceNullEntryPoint = false; - - public static Assembly? GetEntryAssembly() - { - if (s_forceNullEntryPoint) - return null; - - return GetEntryAssemblyInternal(); - } - - public static Assembly Load(byte[] rawAssembly) => Load(rawAssembly, rawSymbolStore: null); - - // Loads the assembly with a COFF based IMAGE containing - // an emitted assembly. The assembly is loaded into a fully isolated ALC with resolution fully deferred to the AssemblyLoadContext.Default. - // The second parameter is the raw bytes representing the symbol store that matches the assembly. - public static Assembly Load(byte[] rawAssembly, byte[]? rawSymbolStore) - { - if (rawAssembly == null) - throw new ArgumentNullException(nameof(rawAssembly)); - - if (rawAssembly.Length == 0) - throw new BadImageFormatException(SR.BadImageFormat_BadILFormat); - - SerializationInfo.ThrowIfDeserializationInProgress("AllowAssembliesFromByteArrays", - ref s_cachedSerializationSwitch); - - AssemblyLoadContext alc = new IndividualAssemblyLoadContext("Assembly.Load(byte[], ...)"); - return alc.InternalLoad(rawAssembly, rawSymbolStore); - } - - public static Assembly LoadFile(string path) - { - if (path == null) - throw new ArgumentNullException(nameof(path)); - - if (PathInternal.IsPartiallyQualified(path)) - { - throw new ArgumentException(SR.Format(SR.Argument_AbsolutePathRequired, path), nameof(path)); - } - - string normalizedPath = Path.GetFullPath(path); - - Assembly? result; - lock (s_loadfile) - { - if (s_loadfile.TryGetValue(normalizedPath, out result)) - return result; - - AssemblyLoadContext alc = new IndividualAssemblyLoadContext(string.Format("Assembly.LoadFile({0})", normalizedPath)); - result = alc.LoadFromAssemblyPath(normalizedPath); - s_loadfile.Add(normalizedPath, result); - } - return result; - } - - private static Assembly? LoadFromResolveHandler(object? sender, ResolveEventArgs args) - { - Assembly? requestingAssembly = args.RequestingAssembly; - if (requestingAssembly == null) - { - return null; - } - - // Requesting assembly for LoadFrom is always loaded in defaultContext - proceed only if that - // is the case. - if (AssemblyLoadContext.Default != AssemblyLoadContext.GetLoadContext(requestingAssembly)) - return null; - - // Get the path where requesting assembly lives and check if it is in the list - // of assemblies for which LoadFrom was invoked. - string requestorPath = Path.GetFullPath(requestingAssembly.Location); - if (string.IsNullOrEmpty(requestorPath)) - return null; - - lock (s_loadFromAssemblyList) - { - // If the requestor assembly was not loaded using LoadFrom, exit. - if (!s_loadFromAssemblyList.Contains(requestorPath)) - { -#if CORECLR - if (AssemblyLoadContext.IsTracingEnabled()) - { - AssemblyLoadContext.TraceAssemblyLoadFromResolveHandlerInvoked(args.Name, false, requestorPath, null); - } -#endif // CORECLR - return null; - } - } - - // Requestor assembly was loaded using loadFrom, so look for its dependencies - // in the same folder as it. - // Form the name of the assembly using the path of the assembly that requested its load. - AssemblyName requestedAssemblyName = new AssemblyName(args.Name!); - string requestedAssemblyPath = Path.Combine(Path.GetDirectoryName(requestorPath)!, requestedAssemblyName.Name + ".dll"); -#if CORECLR - if (AssemblyLoadContext.IsTracingEnabled()) - { - AssemblyLoadContext.TraceAssemblyLoadFromResolveHandlerInvoked(args.Name, true, requestorPath, requestedAssemblyPath); - } -#endif // CORECLR - try - { - // Load the dependency via LoadFrom so that it goes through the same path of being in the LoadFrom list. - return Assembly.LoadFrom(requestedAssemblyPath); - } - catch (FileNotFoundException) - { - // Catch FileNotFoundException when attempting to resolve assemblies via this handler to account for missing assemblies. - return null; - } - } - - public static Assembly LoadFrom(string assemblyFile) - { - if (assemblyFile == null) - throw new ArgumentNullException(nameof(assemblyFile)); - - string fullPath = Path.GetFullPath(assemblyFile); - - if (!s_loadFromHandlerSet) - { - lock (s_loadFromAssemblyList) - { - if (!s_loadFromHandlerSet) - { - AssemblyLoadContext.AssemblyResolve += LoadFromResolveHandler!; - s_loadFromHandlerSet = true; - } - } - } - - // Add the path to the LoadFrom path list which we will consult - // before handling the resolves in our handler. - lock (s_loadFromAssemblyList) - { - if (!s_loadFromAssemblyList.Contains(fullPath)) - { - s_loadFromAssemblyList.Add(fullPath); - } - } - - return AssemblyLoadContext.Default.LoadFromAssemblyPath(fullPath); - } - - public static Assembly LoadFrom(string assemblyFile, byte[]? hashValue, AssemblyHashAlgorithm hashAlgorithm) - { - throw new NotSupportedException(SR.NotSupported_AssemblyLoadFromHash); - } - - public static Assembly UnsafeLoadFrom(string assemblyFile) => LoadFrom(assemblyFile); - - public Module LoadModule(string moduleName, byte[]? rawModule) => LoadModule(moduleName, rawModule, null); - public virtual Module LoadModule(string moduleName, byte[]? rawModule, byte[]? rawSymbolStore) { throw NotImplemented.ByDesign; } - - public static Assembly ReflectionOnlyLoad(byte[] rawAssembly) { throw new PlatformNotSupportedException(SR.PlatformNotSupported_ReflectionOnly); } - public static Assembly ReflectionOnlyLoad(string assemblyString) { throw new PlatformNotSupportedException(SR.PlatformNotSupported_ReflectionOnly); } - public static Assembly ReflectionOnlyLoadFrom(string assemblyFile) { throw new PlatformNotSupportedException(SR.PlatformNotSupported_ReflectionOnly); } - - public virtual SecurityRuleSet SecurityRuleSet => SecurityRuleSet.None; - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblyAlgorithmIdAttribute.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblyAlgorithmIdAttribute.cs deleted file mode 100644 index 7ea8ecf6eb7..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblyAlgorithmIdAttribute.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Configuration.Assemblies; - -namespace System.Reflection -{ - [AttributeUsage(AttributeTargets.Assembly, Inherited = false)] - public sealed class AssemblyAlgorithmIdAttribute : Attribute - { - public AssemblyAlgorithmIdAttribute(AssemblyHashAlgorithm algorithmId) - { - AlgorithmId = (uint)algorithmId; - } - - [CLSCompliant(false)] - public AssemblyAlgorithmIdAttribute(uint algorithmId) - { - AlgorithmId = algorithmId; - } - - [CLSCompliant(false)] - public uint AlgorithmId { get; } - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblyCompanyAttribute.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblyCompanyAttribute.cs deleted file mode 100644 index 2c83e14624b..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblyCompanyAttribute.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Reflection -{ - [AttributeUsage(AttributeTargets.Assembly, Inherited = false)] - public sealed class AssemblyCompanyAttribute : Attribute - { - public AssemblyCompanyAttribute(string company) - { - Company = company; - } - - public string Company { get; } - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblyConfigurationAttribute.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblyConfigurationAttribute.cs deleted file mode 100644 index c86642a415c..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblyConfigurationAttribute.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Reflection -{ - [AttributeUsage(AttributeTargets.Assembly, Inherited = false)] - public sealed class AssemblyConfigurationAttribute : Attribute - { - public AssemblyConfigurationAttribute(string configuration) - { - Configuration = configuration; - } - - public string Configuration { get; } - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblyContentType.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblyContentType.cs deleted file mode 100644 index 6f6d0064efa..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblyContentType.cs +++ /dev/null @@ -1,12 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Reflection -{ - public enum AssemblyContentType - { - Default = 0, - WindowsRuntime = 1, - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblyCopyrightAttribute.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblyCopyrightAttribute.cs deleted file mode 100644 index a90068bc3fe..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblyCopyrightAttribute.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Reflection -{ - [AttributeUsage(AttributeTargets.Assembly, Inherited = false)] - public sealed class AssemblyCopyrightAttribute : Attribute - { - public AssemblyCopyrightAttribute(string copyright) - { - Copyright = copyright; - } - - public string Copyright { get; } - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblyCultureAttribute.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblyCultureAttribute.cs deleted file mode 100644 index f3af8a460c5..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblyCultureAttribute.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Reflection -{ - [AttributeUsage(AttributeTargets.Assembly, Inherited = false)] - public sealed class AssemblyCultureAttribute : Attribute - { - public AssemblyCultureAttribute(string culture) - { - Culture = culture; - } - - public string Culture { get; } - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblyDefaultAliasAttribute.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblyDefaultAliasAttribute.cs deleted file mode 100644 index ebe80d749bc..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblyDefaultAliasAttribute.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Reflection -{ - [AttributeUsage(AttributeTargets.Assembly, Inherited = false)] - public sealed class AssemblyDefaultAliasAttribute : Attribute - { - public AssemblyDefaultAliasAttribute(string defaultAlias) - { - DefaultAlias = defaultAlias; - } - - public string DefaultAlias { get; } - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblyDelaySignAttribute.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblyDelaySignAttribute.cs deleted file mode 100644 index 74256a520e4..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblyDelaySignAttribute.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Reflection -{ - [AttributeUsage(AttributeTargets.Assembly, Inherited = false)] - public sealed class AssemblyDelaySignAttribute : Attribute - { - public AssemblyDelaySignAttribute(bool delaySign) - { - DelaySign = delaySign; - } - - public bool DelaySign { get; } - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblyDescriptionAttribute.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblyDescriptionAttribute.cs deleted file mode 100644 index 6e9abc9b185..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblyDescriptionAttribute.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Reflection -{ - [AttributeUsage(AttributeTargets.Assembly, Inherited = false)] - public sealed class AssemblyDescriptionAttribute : Attribute - { - public AssemblyDescriptionAttribute(string description) - { - Description = description; - } - - public string Description { get; } - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblyFileVersionAttribute.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblyFileVersionAttribute.cs deleted file mode 100644 index 5043e4afa29..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblyFileVersionAttribute.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Reflection -{ - [AttributeUsage(AttributeTargets.Assembly, Inherited = false)] - public sealed class AssemblyFileVersionAttribute : Attribute - { - public AssemblyFileVersionAttribute(string version) - { - Version = version ?? throw new ArgumentNullException(nameof(version)); - } - - public string Version { get; } - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblyFlagsAttribute.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblyFlagsAttribute.cs deleted file mode 100644 index 523430f9cd1..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblyFlagsAttribute.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Reflection -{ - [AttributeUsage(AttributeTargets.Assembly, Inherited = false)] - public sealed class AssemblyFlagsAttribute : Attribute - { - private readonly AssemblyNameFlags _flags; - - [Obsolete("This constructor has been deprecated. Please use AssemblyFlagsAttribute(AssemblyNameFlags) instead. https://go.microsoft.com/fwlink/?linkid=14202")] - [CLSCompliant(false)] - public AssemblyFlagsAttribute(uint flags) - { - _flags = (AssemblyNameFlags)flags; - } - - [Obsolete("This property has been deprecated. Please use AssemblyFlags instead. https://go.microsoft.com/fwlink/?linkid=14202")] - [CLSCompliant(false)] - public uint Flags => (uint)_flags; - - public int AssemblyFlags => (int)_flags; - - [Obsolete("This constructor has been deprecated. Please use AssemblyFlagsAttribute(AssemblyNameFlags) instead. https://go.microsoft.com/fwlink/?linkid=14202")] - public AssemblyFlagsAttribute(int assemblyFlags) - { - _flags = (AssemblyNameFlags)assemblyFlags; - } - - public AssemblyFlagsAttribute(AssemblyNameFlags assemblyFlags) - { - _flags = assemblyFlags; - } - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblyInformationalVersionAttribute.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblyInformationalVersionAttribute.cs deleted file mode 100644 index afd08343ee4..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblyInformationalVersionAttribute.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Reflection -{ - [AttributeUsage(AttributeTargets.Assembly, Inherited = false)] - public sealed class AssemblyInformationalVersionAttribute : Attribute - { - public AssemblyInformationalVersionAttribute(string informationalVersion) - { - InformationalVersion = informationalVersion; - } - - public string InformationalVersion { get; } - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblyKeyFileAttribute.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblyKeyFileAttribute.cs deleted file mode 100644 index 58157574b83..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblyKeyFileAttribute.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Reflection -{ - [AttributeUsage(AttributeTargets.Assembly, Inherited = false)] - public sealed class AssemblyKeyFileAttribute : Attribute - { - public AssemblyKeyFileAttribute(string keyFile) - { - KeyFile = keyFile; - } - - public string KeyFile { get; } - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblyKeyNameAttribute.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblyKeyNameAttribute.cs deleted file mode 100644 index 3852a9bac77..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblyKeyNameAttribute.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Reflection -{ - [AttributeUsage(AttributeTargets.Assembly, Inherited = false)] - public sealed class AssemblyKeyNameAttribute : Attribute - { - public AssemblyKeyNameAttribute(string keyName) - { - KeyName = keyName; - } - - public string KeyName { get; } - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblyMetadataAttribute.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblyMetadataAttribute.cs deleted file mode 100644 index 42ae3cab1b8..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblyMetadataAttribute.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Reflection -{ - [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true, Inherited = false)] - public sealed class AssemblyMetadataAttribute : Attribute - { - public AssemblyMetadataAttribute(string key, string? value) - { - Key = key; - Value = value; - } - - public string Key { get; } - - public string? Value { get; } - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblyName.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblyName.cs deleted file mode 100644 index 7b5f6f15222..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblyName.cs +++ /dev/null @@ -1,478 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Configuration.Assemblies; -using System.Runtime.Serialization; -using System.Text; -using CultureInfo = System.Globalization.CultureInfo; - -namespace System.Reflection -{ - public sealed partial class AssemblyName : ICloneable, IDeserializationCallback, ISerializable - { - // If you modify any of these fields, you must also update the - // AssemblyBaseObject structure in object.h - private string? _name; - private byte[]? _publicKey; - private byte[]? _publicKeyToken; - private CultureInfo? _cultureInfo; - private string? _codeBase; - private Version? _version; - - private StrongNameKeyPair? _strongNameKeyPair; - - private AssemblyHashAlgorithm _hashAlgorithm; - - private AssemblyVersionCompatibility _versionCompatibility; - private AssemblyNameFlags _flags; - - public AssemblyName() - { - _versionCompatibility = AssemblyVersionCompatibility.SameMachine; - } - - // Set and get the name of the assembly. If this is a weak Name - // then it optionally contains a site. For strong assembly names, - // the name partitions up the strong name's namespace - public string? Name - { - get => _name; - set => _name = value; - } - - public Version? Version - { - get => _version; - set => _version = value; - } - - // Locales, internally the LCID is used for the match. - public CultureInfo? CultureInfo - { - get => _cultureInfo; - set => _cultureInfo = value; - } - - public string? CultureName - { - get => _cultureInfo?.Name; - set => _cultureInfo = (value == null) ? null : new CultureInfo(value); - } - - public string? CodeBase - { - get => _codeBase; - set => _codeBase = value; - } - - public string? EscapedCodeBase - { - get - { - if (_codeBase == null) - return null; - else - return EscapeCodeBase(_codeBase); - } - } - - public ProcessorArchitecture ProcessorArchitecture - { - get - { - int x = (((int)_flags) & 0x70) >> 4; - if (x > 5) - x = 0; - return (ProcessorArchitecture)x; - } - set - { - int x = ((int)value) & 0x07; - if (x <= 5) - { - _flags = (AssemblyNameFlags)((int)_flags & 0xFFFFFF0F); - _flags |= (AssemblyNameFlags)(x << 4); - } - } - } - - public AssemblyContentType ContentType - { - get - { - int x = (((int)_flags) & 0x00000E00) >> 9; - if (x > 1) - x = 0; - return (AssemblyContentType)x; - } - set - { - int x = ((int)value) & 0x07; - if (x <= 1) - { - _flags = (AssemblyNameFlags)((int)_flags & 0xFFFFF1FF); - _flags |= (AssemblyNameFlags)(x << 9); - } - } - } - - // Make a copy of this assembly name. - public object Clone() - { - var name = new AssemblyName - { - _name = _name, - _publicKey = (byte[]?)_publicKey?.Clone(), - _publicKeyToken = (byte[]?)_publicKeyToken?.Clone(), - _cultureInfo = _cultureInfo, - _version = (Version?)_version?.Clone(), - _flags = _flags, - _codeBase = _codeBase, - _hashAlgorithm = _hashAlgorithm, - _versionCompatibility = _versionCompatibility, - }; - return name; - } - - /* - * Get the AssemblyName for a given file. This will only work - * if the file contains an assembly manifest. This method causes - * the file to be opened and closed. - */ - public static AssemblyName GetAssemblyName(string assemblyFile) - { - if (assemblyFile == null) - throw new ArgumentNullException(nameof(assemblyFile)); - - return GetFileInformationCore(assemblyFile); - } - - public byte[]? GetPublicKey() - { - return _publicKey; - } - - public void SetPublicKey(byte[]? publicKey) - { - _publicKey = publicKey; - - if (publicKey == null) - _flags &= ~AssemblyNameFlags.PublicKey; - else - _flags |= AssemblyNameFlags.PublicKey; - } - - // The compressed version of the public key formed from a truncated hash. - // Will throw a SecurityException if _publicKey is invalid - public byte[]? GetPublicKeyToken() => _publicKeyToken ??= ComputePublicKeyToken(); - - public void SetPublicKeyToken(byte[]? publicKeyToken) - { - _publicKeyToken = publicKeyToken; - } - - // Flags modifying the name. So far the only flag is PublicKey, which - // indicates that a full public key and not the compressed version is - // present. - // Processor Architecture flags are set only through ProcessorArchitecture - // property and can't be set or retrieved directly - // Content Type flags are set only through ContentType property and can't be - // set or retrieved directly - public AssemblyNameFlags Flags - { - get => (AssemblyNameFlags)((uint)_flags & 0xFFFFF10F); - set - { - _flags &= unchecked((AssemblyNameFlags)0x00000EF0); - _flags |= (value & unchecked((AssemblyNameFlags)0xFFFFF10F)); - } - } - - public AssemblyHashAlgorithm HashAlgorithm - { - get => _hashAlgorithm; - set => _hashAlgorithm = value; - } - - public AssemblyVersionCompatibility VersionCompatibility - { - get => _versionCompatibility; - set => _versionCompatibility = value; - } - - public StrongNameKeyPair? KeyPair - { - get => _strongNameKeyPair; - set => _strongNameKeyPair = value; - } - - public string FullName - { - get - { - if (this.Name == null) - return string.Empty; - // Do not call GetPublicKeyToken() here - that latches the result into AssemblyName which isn't a side effect we want. - byte[]? pkt = _publicKeyToken ?? ComputePublicKeyToken(); - return AssemblyNameFormatter.ComputeDisplayName(Name, Version, CultureName, pkt, Flags, ContentType); - } - } - - public override string ToString() - { - string s = FullName; - if (s == null) - return base.ToString()!; - else - return s; - } - - public void GetObjectData(SerializationInfo info, StreamingContext context) - { - throw new PlatformNotSupportedException(); - } - - public void OnDeserialization(object? sender) - { - throw new PlatformNotSupportedException(); - } - - /// <summary> - /// Compares the simple names disregarding Version, Culture and PKT. While this clearly does not - /// match the intent of this api, this api has been broken this way since its debut and we cannot - /// change its behavior now. - /// </summary> - public static bool ReferenceMatchesDefinition(AssemblyName? reference, AssemblyName? definition) - { - if (object.ReferenceEquals(reference, definition)) - return true; - - if (reference == null) - throw new ArgumentNullException(nameof(reference)); - - if (definition == null) - throw new ArgumentNullException(nameof(definition)); - - string refName = reference.Name ?? string.Empty; - string defName = definition.Name ?? string.Empty; - return refName.Equals(defName, StringComparison.OrdinalIgnoreCase); - } - - internal static string EscapeCodeBase(string? codebase) - { - if (codebase == null) - return string.Empty; - - int position = 0; - char[]? dest = EscapeString(codebase, 0, codebase.Length, null, ref position, true, c_DummyChar, c_DummyChar, c_DummyChar); - if (dest == null) - return codebase; - - return new string(dest, 0, position); - } - - // This implementation of EscapeString has been copied from System.Private.Uri from corefx repo - // - forceX characters are always escaped if found - // - rsvd character will remain unescaped - // - // start - starting offset from input - // end - the exclusive ending offset in input - // destPos - starting offset in dest for output, on return this will be an exclusive "end" in the output. - // - // In case "dest" has lack of space it will be reallocated by preserving the _whole_ content up to current destPos - // - // Returns null if nothing has to be escaped AND passed dest was null, otherwise the resulting array with the updated destPos - // - internal static unsafe char[]? EscapeString(string input, int start, int end, char[]? dest, ref int destPos, - bool isUriString, char force1, char force2, char rsvd) - { - int i = start; - int prevInputPos = start; - byte* bytes = stackalloc byte[c_MaxUnicodeCharsReallocate * c_MaxUTF_8BytesPerUnicodeChar]; // 40*4=160 - - fixed (char* pStr = input) - { - for (; i < end; ++i) - { - char ch = pStr[i]; - - // a Unicode ? - if (ch > '\x7F') - { - short maxSize = (short)Math.Min(end - i, (int)c_MaxUnicodeCharsReallocate - 1); - - short count = 1; - for (; count < maxSize && pStr[i + count] > '\x7f'; ++count) ; - - // Is the last a high surrogate? - if (pStr[i + count - 1] >= 0xD800 && pStr[i + count - 1] <= 0xDBFF) - { - // Should be a rare case where the app tries to feed an invalid Unicode surrogates pair - if (count == 1 || count == end - i) - throw new FormatException(SR.Arg_FormatException); - // need to grab one more char as a Surrogate except when it's a bogus input - ++count; - } - - dest = EnsureDestinationSize(pStr, dest, i, - (short)(count * c_MaxUTF_8BytesPerUnicodeChar * c_EncodedCharsPerByte), - c_MaxUnicodeCharsReallocate * c_MaxUTF_8BytesPerUnicodeChar * c_EncodedCharsPerByte, - ref destPos, prevInputPos); - - short numberOfBytes = (short)Encoding.UTF8.GetBytes(pStr + i, count, bytes, - c_MaxUnicodeCharsReallocate * c_MaxUTF_8BytesPerUnicodeChar); - - // This is the only exception that built in UriParser can throw after a Uri ctor. - // Should not happen unless the app tries to feed an invalid Unicode string - if (numberOfBytes == 0) - throw new FormatException(SR.Arg_FormatException); - - i += (count - 1); - - for (count = 0; count < numberOfBytes; ++count) - EscapeAsciiChar((char)bytes[count], dest, ref destPos); - - prevInputPos = i + 1; - } - else if (ch == '%' && rsvd == '%') - { - // Means we don't reEncode '%' but check for the possible escaped sequence - dest = EnsureDestinationSize(pStr, dest, i, c_EncodedCharsPerByte, - c_MaxAsciiCharsReallocate * c_EncodedCharsPerByte, ref destPos, prevInputPos); - if (i + 2 < end && EscapedAscii(pStr[i + 1], pStr[i + 2]) != c_DummyChar) - { - // leave it escaped - dest[destPos++] = '%'; - dest[destPos++] = pStr[i + 1]; - dest[destPos++] = pStr[i + 2]; - i += 2; - } - else - { - EscapeAsciiChar('%', dest, ref destPos); - } - prevInputPos = i + 1; - } - else if (ch == force1 || ch == force2 || (ch != rsvd && (isUriString ? !IsReservedUnreservedOrHash(ch) : !IsUnreserved(ch)))) - { - dest = EnsureDestinationSize(pStr, dest, i, c_EncodedCharsPerByte, - c_MaxAsciiCharsReallocate * c_EncodedCharsPerByte, ref destPos, prevInputPos); - EscapeAsciiChar(ch, dest, ref destPos); - prevInputPos = i + 1; - } - } - - if (prevInputPos != i) - { - // need to fill up the dest array ? - if (prevInputPos != start || dest != null) - dest = EnsureDestinationSize(pStr, dest, i, 0, 0, ref destPos, prevInputPos); - } - } - - return dest; - } - - // - // ensure destination array has enough space and contains all the needed input stuff - // - private static unsafe char[] EnsureDestinationSize(char* pStr, char[]? dest, int currentInputPos, - short charsToAdd, short minReallocateChars, ref int destPos, int prevInputPos) - { - if (dest is null || dest.Length < destPos + (currentInputPos - prevInputPos) + charsToAdd) - { - // allocating or reallocating array by ensuring enough space based on maxCharsToAdd. - char[] newresult = new char[destPos + (currentInputPos - prevInputPos) + minReallocateChars]; - - if (!(dest is null) && destPos != 0) - Buffer.BlockCopy(dest, 0, newresult, 0, destPos << 1); - dest = newresult; - } - - // ensuring we copied everything form the input string left before last escaping - while (prevInputPos != currentInputPos) - dest[destPos++] = pStr[prevInputPos++]; - return dest; - } - - internal static void EscapeAsciiChar(char ch, char[] to, ref int pos) - { - to[pos++] = '%'; - to[pos++] = s_hexUpperChars[(ch & 0xf0) >> 4]; - to[pos++] = s_hexUpperChars[ch & 0xf]; - } - - internal static char EscapedAscii(char digit, char next) - { - if (!(((digit >= '0') && (digit <= '9')) - || ((digit >= 'A') && (digit <= 'F')) - || ((digit >= 'a') && (digit <= 'f')))) - { - return c_DummyChar; - } - - int res = (digit <= '9') - ? ((int)digit - (int)'0') - : (((digit <= 'F') - ? ((int)digit - (int)'A') - : ((int)digit - (int)'a')) - + 10); - - if (!(((next >= '0') && (next <= '9')) - || ((next >= 'A') && (next <= 'F')) - || ((next >= 'a') && (next <= 'f')))) - { - return c_DummyChar; - } - - return (char)((res << 4) + ((next <= '9') - ? ((int)next - (int)'0') - : (((next <= 'F') - ? ((int)next - (int)'A') - : ((int)next - (int)'a')) - + 10))); - } - - private static bool IsReservedUnreservedOrHash(char c) - { - if (IsUnreserved(c)) - { - return true; - } - return RFC3986ReservedMarks.Contains(c); - } - - internal static bool IsUnreserved(char c) - { - if (IsAsciiLetterOrDigit(c)) - { - return true; - } - return RFC3986UnreservedMarks.Contains(c); - } - - // Only consider ASCII characters - internal static bool IsAsciiLetter(char character) - { - return (character >= 'a' && character <= 'z') || - (character >= 'A' && character <= 'Z'); - } - - internal static bool IsAsciiLetterOrDigit(char character) - { - return IsAsciiLetter(character) || (character >= '0' && character <= '9'); - } - - private static readonly char[] s_hexUpperChars = { - '0', '1', '2', '3', '4', '5', '6', '7', - '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; - internal const char c_DummyChar = (char)0xFFFF; // An Invalid Unicode character used as a dummy char passed into the parameter - private const short c_MaxAsciiCharsReallocate = 40; - private const short c_MaxUnicodeCharsReallocate = 40; - private const short c_MaxUTF_8BytesPerUnicodeChar = 4; - private const short c_EncodedCharsPerByte = 3; - private const string RFC3986ReservedMarks = ":/?#[]@!$&'()*+,;="; - private const string RFC3986UnreservedMarks = "-._~"; - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblyNameFlags.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblyNameFlags.cs deleted file mode 100644 index f32f4af01c4..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblyNameFlags.cs +++ /dev/null @@ -1,21 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Reflection -{ - [Flags] - public enum AssemblyNameFlags - { - None = 0x0000, - // Flag used to indicate that an assembly ref contains the full public key, not the compressed token. - // Must match afPublicKey in CorHdr.h. - PublicKey = 0x0001, - // ProcArchMask = 0x00F0, // Bits describing the processor architecture - // Accessible via AssemblyName.ProcessorArchitecture - EnableJITcompileOptimizer = 0x4000, - EnableJITcompileTracking = 0x8000, - Retargetable = 0x0100, - // ContentType = 0x0E00, // Bits describing the ContentType are accessible via AssemblyName.ContentType - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblyNameFormatter.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblyNameFormatter.cs deleted file mode 100644 index 09585f8d58f..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblyNameFormatter.cs +++ /dev/null @@ -1,154 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.IO; -using System.Text; -using System.Globalization; -using System.Collections.Generic; - -namespace System.Reflection -{ - internal static class AssemblyNameFormatter - { - public static string ComputeDisplayName(string? name, Version? version, string? cultureName, byte[]? pkt, AssemblyNameFlags flags, AssemblyContentType contentType) - { - const int PUBLIC_KEY_TOKEN_LEN = 8; - - if (name == string.Empty) - throw new FileLoadException(); - - StringBuilder sb = new StringBuilder(); - if (name != null) - { - sb.AppendQuoted(name); - } - - if (version != null) - { - Version canonicalizedVersion = version.CanonicalizeVersion(); - if (canonicalizedVersion.Major != ushort.MaxValue) - { - sb.Append(", Version="); - sb.Append(canonicalizedVersion.Major); - - if (canonicalizedVersion.Minor != ushort.MaxValue) - { - sb.Append('.'); - sb.Append(canonicalizedVersion.Minor); - - if (canonicalizedVersion.Build != ushort.MaxValue) - { - sb.Append('.'); - sb.Append(canonicalizedVersion.Build); - - if (canonicalizedVersion.Revision != ushort.MaxValue) - { - sb.Append('.'); - sb.Append(canonicalizedVersion.Revision); - } - } - } - } - } - - if (cultureName != null) - { - if (cultureName == string.Empty) - cultureName = "neutral"; - sb.Append(", Culture="); - sb.AppendQuoted(cultureName); - } - - if (pkt != null) - { - if (pkt.Length > PUBLIC_KEY_TOKEN_LEN) - throw new ArgumentException(); - - sb.Append(", PublicKeyToken="); - if (pkt.Length == 0) - sb.Append("null"); - else - { - foreach (byte b in pkt) - { - sb.Append(b.ToString("x2", CultureInfo.InvariantCulture)); - } - } - } - - if (0 != (flags & AssemblyNameFlags.Retargetable)) - sb.Append(", Retargetable=Yes"); - - if (contentType == AssemblyContentType.WindowsRuntime) - sb.Append(", ContentType=WindowsRuntime"); - - // NOTE: By design (desktop compat) AssemblyName.FullName and ToString() do not include ProcessorArchitecture. - - return sb.ToString(); - } - - private static void AppendQuoted(this StringBuilder sb, string s) - { - bool needsQuoting = false; - const char quoteChar = '\"'; - - // App-compat: You can use double or single quotes to quote a name, and Fusion (or rather the IdentityAuthority) picks one - // by some algorithm. Rather than guess at it, we use double quotes consistently. - if (s != s.Trim() || s.Contains('\"') || s.Contains('\'')) - needsQuoting = true; - - if (needsQuoting) - sb.Append(quoteChar); - - for (int i = 0; i < s.Length; i++) - { - bool addedEscape = false; - foreach (KeyValuePair<char, string> kv in EscapeSequences) - { - string escapeReplacement = kv.Value; - if (!(s[i] == escapeReplacement[0])) - continue; - if ((s.Length - i) < escapeReplacement.Length) - continue; - if (s.AsSpan(i, escapeReplacement.Length).SequenceEqual(escapeReplacement)) - { - sb.Append('\\'); - sb.Append(kv.Key); - addedEscape = true; - } - } - - if (!addedEscape) - sb.Append(s[i]); - } - - if (needsQuoting) - sb.Append(quoteChar); - } - - private static Version CanonicalizeVersion(this Version version) - { - ushort major = (ushort)version.Major; - ushort minor = (ushort)version.Minor; - ushort build = (ushort)version.Build; - ushort revision = (ushort)version.Revision; - - if (major == version.Major && minor == version.Minor && build == version.Build && revision == version.Revision) - return version; - - return new Version(major, minor, build, revision); - } - - public static KeyValuePair<char, string>[] EscapeSequences = - { - new KeyValuePair<char, string>('\\', "\\"), - new KeyValuePair<char, string>(',', ","), - new KeyValuePair<char, string>('=', "="), - new KeyValuePair<char, string>('\'', "'"), - new KeyValuePair<char, string>('\"', "\""), - new KeyValuePair<char, string>('n', Environment.NewLineConst), - new KeyValuePair<char, string>('t', "\t"), - }; - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblyProductAttribute.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblyProductAttribute.cs deleted file mode 100644 index acff50797f3..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblyProductAttribute.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Reflection -{ - [AttributeUsage(AttributeTargets.Assembly, Inherited = false)] - public sealed class AssemblyProductAttribute : Attribute - { - public AssemblyProductAttribute(string product) - { - Product = product; - } - - public string Product { get; } - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblySignatureKeyAttribute.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblySignatureKeyAttribute.cs deleted file mode 100644 index cf48f95f48e..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblySignatureKeyAttribute.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Reflection -{ - [AttributeUsage(AttributeTargets.Assembly, Inherited = false, AllowMultiple = false)] - public sealed class AssemblySignatureKeyAttribute : Attribute - { - public AssemblySignatureKeyAttribute(string publicKey, string countersignature) - { - PublicKey = publicKey; - Countersignature = countersignature; - } - - public string PublicKey { get; } - - public string Countersignature { get; } - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblyTitleAttribute.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblyTitleAttribute.cs deleted file mode 100644 index bc588dfbf34..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblyTitleAttribute.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Reflection -{ - [AttributeUsage(AttributeTargets.Assembly, Inherited = false)] - public sealed class AssemblyTitleAttribute : Attribute - { - public AssemblyTitleAttribute(string title) - { - Title = title; - } - - public string Title { get; } - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblyTrademarkAttribute.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblyTrademarkAttribute.cs deleted file mode 100644 index 3f3c9a2dd95..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblyTrademarkAttribute.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Reflection -{ - [AttributeUsage(AttributeTargets.Assembly, Inherited = false)] - public sealed class AssemblyTrademarkAttribute : Attribute - { - public AssemblyTrademarkAttribute(string trademark) - { - Trademark = trademark; - } - - public string Trademark { get; } - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblyVersionAttribute.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblyVersionAttribute.cs deleted file mode 100644 index 1f78fc19f77..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/AssemblyVersionAttribute.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Reflection -{ - [AttributeUsage(AttributeTargets.Assembly, Inherited = false)] - public sealed class AssemblyVersionAttribute : Attribute - { - public AssemblyVersionAttribute(string version) - { - Version = version; - } - - public string Version { get; } - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/Binder.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/Binder.cs deleted file mode 100644 index 10b6f7de1bc..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/Binder.cs +++ /dev/null @@ -1,19 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Globalization; - -namespace System.Reflection -{ - public abstract class Binder - { - protected Binder() { } - public abstract FieldInfo BindToField(BindingFlags bindingAttr, FieldInfo[] match, object value, CultureInfo? culture); - public abstract MethodBase BindToMethod(BindingFlags bindingAttr, MethodBase[] match, ref object?[] args, ParameterModifier[]? modifiers, CultureInfo? culture, string[]? names, out object? state); - public abstract object ChangeType(object value, Type type, CultureInfo? culture); - public abstract void ReorderArgumentArray(ref object?[] args, object state); - public abstract MethodBase? SelectMethod(BindingFlags bindingAttr, MethodBase[] match, Type[] types, ParameterModifier[]? modifiers); - public abstract PropertyInfo? SelectProperty(BindingFlags bindingAttr, PropertyInfo[] match, Type? returnType, Type[]? indexes, ParameterModifier[]? modifiers); - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/BindingFlags.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/BindingFlags.cs deleted file mode 100644 index 054ee6401a8..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/BindingFlags.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Reflection -{ - [Flags] - public enum BindingFlags - { - // NOTES: We have lookup masks defined in RuntimeType and Activator. If we - // change the lookup values then these masks may need to change also. - - // a place holder for no flag specifed - Default = 0x00, - - // These flags indicate what to search for when binding - IgnoreCase = 0x01, // Ignore the case of Names while searching - DeclaredOnly = 0x02, // Only look at the members declared on the Type - Instance = 0x04, // Include Instance members in search - Static = 0x08, // Include Static members in search - Public = 0x10, // Include Public members in search - NonPublic = 0x20, // Include Non-Public members in search - FlattenHierarchy = 0x40, // Rollup the statics into the class. - - // These flags are used by InvokeMember to determine - // what type of member we are trying to Invoke. - // BindingAccess = 0xFF00; - InvokeMethod = 0x0100, - CreateInstance = 0x0200, - GetField = 0x0400, - SetField = 0x0800, - GetProperty = 0x1000, - SetProperty = 0x2000, - - // These flags are also used by InvokeMember but they should only - // be used when calling InvokeMember on a COM object. - PutDispProperty = 0x4000, - PutRefDispProperty = 0x8000, - - ExactBinding = 0x010000, // Bind with Exact Type matching, No Change type - SuppressChangeType = 0x020000, - - // DefaultValueBinding will return the set of methods having ArgCount or - // more parameters. This is used for default values, etc. - OptionalParamBinding = 0x040000, - - // These are a couple of misc attributes used - IgnoreReturn = 0x01000000, // This is used in COM Interop - DoNotWrapExceptions = 0x02000000, // Disables wrapping exceptions in TargetInvocationException - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/CallingConventions.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/CallingConventions.cs deleted file mode 100644 index 1f159658970..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/CallingConventions.cs +++ /dev/null @@ -1,19 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -// CallingConventions is a set of Bits representing the calling conventions in the system. - -namespace System.Reflection -{ - [Flags] - public enum CallingConventions - { - // Keep in sync with COMMember.cpp. - Standard = 0x0001, - VarArgs = 0x0002, - Any = Standard | VarArgs, - HasThis = 0x0020, - ExplicitThis = 0x0040, - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/ConstructorInfo.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/ConstructorInfo.cs deleted file mode 100644 index 8b376025659..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/ConstructorInfo.cs +++ /dev/null @@ -1,50 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Diagnostics; -using System.Globalization; -using System.Runtime.CompilerServices; - -namespace System.Reflection -{ - public abstract partial class ConstructorInfo : MethodBase - { - protected ConstructorInfo() { } - - public override MemberTypes MemberType => MemberTypes.Constructor; - - [DebuggerHidden] - [DebuggerStepThrough] - public object Invoke(object?[]? parameters) => Invoke(BindingFlags.Default, binder: null, parameters: parameters, culture: null); - public abstract object Invoke(BindingFlags invokeAttr, Binder? binder, object?[]? parameters, CultureInfo? culture); - - public override bool Equals(object? obj) => base.Equals(obj); - public override int GetHashCode() => base.GetHashCode(); - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool operator ==(ConstructorInfo? left, ConstructorInfo? right) - { - // Test "right" first to allow branch elimination when inlined for null checks (== null) - // so it can become a simple test - if (right is null) - { - // return true/false not the test result https://github.com/dotnet/coreclr/issues/914 - return (left is null) ? true : false; - } - - // Try fast reference equality and opposite null check prior to calling the slower virtual Equals - if ((object?)left == (object)right) - { - return true; - } - - return (left is null) ? false : left.Equals(right); - } - - public static bool operator !=(ConstructorInfo? left, ConstructorInfo? right) => !(left == right); - - public static readonly string ConstructorName = ".ctor"; - public static readonly string TypeConstructorName = ".cctor"; - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/CorElementType.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/CorElementType.cs deleted file mode 100644 index 37ffcfa1e25..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/CorElementType.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Reflection -{ - internal enum CorElementType : byte - { - ELEMENT_TYPE_END = 0x00, - ELEMENT_TYPE_VOID = 0x01, - ELEMENT_TYPE_BOOLEAN = 0x02, - ELEMENT_TYPE_CHAR = 0x03, - ELEMENT_TYPE_I1 = 0x04, - ELEMENT_TYPE_U1 = 0x05, - ELEMENT_TYPE_I2 = 0x06, - ELEMENT_TYPE_U2 = 0x07, - ELEMENT_TYPE_I4 = 0x08, - ELEMENT_TYPE_U4 = 0x09, - ELEMENT_TYPE_I8 = 0x0A, - ELEMENT_TYPE_U8 = 0x0B, - ELEMENT_TYPE_R4 = 0x0C, - ELEMENT_TYPE_R8 = 0x0D, - ELEMENT_TYPE_STRING = 0x0E, - ELEMENT_TYPE_PTR = 0x0F, - ELEMENT_TYPE_BYREF = 0x10, - ELEMENT_TYPE_VALUETYPE = 0x11, - ELEMENT_TYPE_CLASS = 0x12, - ELEMENT_TYPE_VAR = 0x13, - ELEMENT_TYPE_ARRAY = 0x14, - ELEMENT_TYPE_GENERICINST = 0x15, - ELEMENT_TYPE_TYPEDBYREF = 0x16, - ELEMENT_TYPE_I = 0x18, - ELEMENT_TYPE_U = 0x19, - ELEMENT_TYPE_FNPTR = 0x1B, - ELEMENT_TYPE_OBJECT = 0x1C, - ELEMENT_TYPE_SZARRAY = 0x1D, - ELEMENT_TYPE_MVAR = 0x1E, - ELEMENT_TYPE_CMOD_REQD = 0x1F, - ELEMENT_TYPE_CMOD_OPT = 0x20, - ELEMENT_TYPE_INTERNAL = 0x21, - ELEMENT_TYPE_MAX = 0x22, - ELEMENT_TYPE_MODIFIER = 0x40, - ELEMENT_TYPE_SENTINEL = 0x41, - ELEMENT_TYPE_PINNED = 0x45, - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/CustomAttributeExtensions.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/CustomAttributeExtensions.cs deleted file mode 100644 index d2c2d454d96..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/CustomAttributeExtensions.cs +++ /dev/null @@ -1,175 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Collections.Generic; - -namespace System.Reflection -{ - public static class CustomAttributeExtensions - { - #region APIs that return a single attribute - public static Attribute? GetCustomAttribute(this Assembly element, Type attributeType) - { - return Attribute.GetCustomAttribute(element, attributeType); - } - public static Attribute? GetCustomAttribute(this Module element, Type attributeType) - { - return Attribute.GetCustomAttribute(element, attributeType); - } - public static Attribute? GetCustomAttribute(this MemberInfo element, Type attributeType) - { - return Attribute.GetCustomAttribute(element, attributeType); - } - public static Attribute? GetCustomAttribute(this ParameterInfo element, Type attributeType) - { - return Attribute.GetCustomAttribute(element, attributeType); - } - - public static T? GetCustomAttribute<T>(this Assembly element) where T : Attribute - { - return (T?)GetCustomAttribute(element, typeof(T)); - } - public static T? GetCustomAttribute<T>(this Module element) where T : Attribute - { - return (T?)GetCustomAttribute(element, typeof(T)); - } - public static T? GetCustomAttribute<T>(this MemberInfo element) where T : Attribute - { - return (T?)GetCustomAttribute(element, typeof(T)); - } - public static T? GetCustomAttribute<T>(this ParameterInfo element) where T : Attribute - { - return (T?)GetCustomAttribute(element, typeof(T)); - } - - public static Attribute? GetCustomAttribute(this MemberInfo element, Type attributeType, bool inherit) - { - return Attribute.GetCustomAttribute(element, attributeType, inherit); - } - public static Attribute? GetCustomAttribute(this ParameterInfo element, Type attributeType, bool inherit) - { - return Attribute.GetCustomAttribute(element, attributeType, inherit); - } - - public static T? GetCustomAttribute<T>(this MemberInfo element, bool inherit) where T : Attribute - { - return (T?)GetCustomAttribute(element, typeof(T), inherit); - } - public static T? GetCustomAttribute<T>(this ParameterInfo element, bool inherit) where T : Attribute - { - return (T?)GetCustomAttribute(element, typeof(T), inherit); - } - #endregion - - #region APIs that return all attributes - public static IEnumerable<Attribute> GetCustomAttributes(this Assembly element) - { - return Attribute.GetCustomAttributes(element); - } - public static IEnumerable<Attribute> GetCustomAttributes(this Module element) - { - return Attribute.GetCustomAttributes(element); - } - public static IEnumerable<Attribute> GetCustomAttributes(this MemberInfo element) - { - return Attribute.GetCustomAttributes(element); - } - public static IEnumerable<Attribute> GetCustomAttributes(this ParameterInfo element) - { - return Attribute.GetCustomAttributes(element); - } - - public static IEnumerable<Attribute> GetCustomAttributes(this MemberInfo element, bool inherit) - { - return Attribute.GetCustomAttributes(element, inherit); - } - public static IEnumerable<Attribute> GetCustomAttributes(this ParameterInfo element, bool inherit) - { - return Attribute.GetCustomAttributes(element, inherit); - } - #endregion - - #region APIs that return all attributes of a particular type - public static IEnumerable<Attribute> GetCustomAttributes(this Assembly element, Type attributeType) - { - return Attribute.GetCustomAttributes(element, attributeType); - } - public static IEnumerable<Attribute> GetCustomAttributes(this Module element, Type attributeType) - { - return Attribute.GetCustomAttributes(element, attributeType); - } - public static IEnumerable<Attribute> GetCustomAttributes(this MemberInfo element, Type attributeType) - { - return Attribute.GetCustomAttributes(element, attributeType); - } - public static IEnumerable<Attribute> GetCustomAttributes(this ParameterInfo element, Type attributeType) - { - return Attribute.GetCustomAttributes(element, attributeType); - } - - public static IEnumerable<T> GetCustomAttributes<T>(this Assembly element) where T : Attribute - { - return (IEnumerable<T>)GetCustomAttributes(element, typeof(T)); - } - public static IEnumerable<T> GetCustomAttributes<T>(this Module element) where T : Attribute - { - return (IEnumerable<T>)GetCustomAttributes(element, typeof(T)); - } - public static IEnumerable<T> GetCustomAttributes<T>(this MemberInfo element) where T : Attribute - { - return (IEnumerable<T>)GetCustomAttributes(element, typeof(T)); - } - public static IEnumerable<T> GetCustomAttributes<T>(this ParameterInfo element) where T : Attribute - { - return (IEnumerable<T>)GetCustomAttributes(element, typeof(T)); - } - - public static IEnumerable<Attribute> GetCustomAttributes(this MemberInfo element, Type attributeType, bool inherit) - { - return Attribute.GetCustomAttributes(element, attributeType, inherit); - } - public static IEnumerable<Attribute> GetCustomAttributes(this ParameterInfo element, Type attributeType, bool inherit) - { - return Attribute.GetCustomAttributes(element, attributeType, inherit); - } - - public static IEnumerable<T> GetCustomAttributes<T>(this MemberInfo element, bool inherit) where T : Attribute - { - return (IEnumerable<T>)GetCustomAttributes(element, typeof(T), inherit); - } - public static IEnumerable<T> GetCustomAttributes<T>(this ParameterInfo element, bool inherit) where T : Attribute - { - return (IEnumerable<T>)GetCustomAttributes(element, typeof(T), inherit); - } - #endregion - - #region IsDefined - public static bool IsDefined(this Assembly element, Type attributeType) - { - return Attribute.IsDefined(element, attributeType); - } - public static bool IsDefined(this Module element, Type attributeType) - { - return Attribute.IsDefined(element, attributeType); - } - public static bool IsDefined(this MemberInfo element, Type attributeType) - { - return Attribute.IsDefined(element, attributeType); - } - public static bool IsDefined(this ParameterInfo element, Type attributeType) - { - return Attribute.IsDefined(element, attributeType); - } - - public static bool IsDefined(this MemberInfo element, Type attributeType, bool inherit) - { - return Attribute.IsDefined(element, attributeType, inherit); - } - public static bool IsDefined(this ParameterInfo element, Type attributeType, bool inherit) - { - return Attribute.IsDefined(element, attributeType, inherit); - } - #endregion - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/CustomAttributeFormatException.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/CustomAttributeFormatException.cs deleted file mode 100644 index 8bdfb3e5d50..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/CustomAttributeFormatException.cs +++ /dev/null @@ -1,34 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Runtime.Serialization; - -namespace System.Reflection -{ - [Serializable] - [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] - public class CustomAttributeFormatException : FormatException - { - public CustomAttributeFormatException() - : this(SR.Arg_CustomAttributeFormatException) - { - } - - public CustomAttributeFormatException(string? message) - : this(message, null) - { - } - - public CustomAttributeFormatException(string? message, Exception? inner) - : base(message, inner) - { - HResult = HResults.COR_E_CUSTOMATTRIBUTEFORMAT; - } - - protected CustomAttributeFormatException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/CustomAttributeNamedArgument.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/CustomAttributeNamedArgument.cs deleted file mode 100644 index 8aa4d8fa72d..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/CustomAttributeNamedArgument.cs +++ /dev/null @@ -1,75 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Reflection -{ - public readonly partial struct CustomAttributeNamedArgument - { - public static bool operator ==(CustomAttributeNamedArgument left, CustomAttributeNamedArgument right) => left.Equals(right); - public static bool operator !=(CustomAttributeNamedArgument left, CustomAttributeNamedArgument right) => !left.Equals(right); - - private readonly MemberInfo m_memberInfo; - private readonly CustomAttributeTypedArgument m_value; - - public CustomAttributeNamedArgument(MemberInfo memberInfo, object? value) - { - if (memberInfo == null) - throw new ArgumentNullException(nameof(memberInfo)); - - Type type; - if (memberInfo is FieldInfo field) - { - type = field.FieldType; - } - else if (memberInfo is PropertyInfo property) - { - type = property.PropertyType; - } - else - { - throw new ArgumentException(SR.Argument_InvalidMemberForNamedArgument); - } - - m_memberInfo = memberInfo; - m_value = new CustomAttributeTypedArgument(type, value); - } - - public CustomAttributeNamedArgument(MemberInfo memberInfo, CustomAttributeTypedArgument typedArgument) - { - if (memberInfo == null) - throw new ArgumentNullException(nameof(memberInfo)); - - m_memberInfo = memberInfo; - m_value = typedArgument; - } - - public override string ToString() - { - if (m_memberInfo == null) - return base.ToString()!; - - return string.Format("{0} = {1}", MemberInfo.Name, TypedValue.ToString(ArgumentType != typeof(object))); - } - - public override int GetHashCode() - { - return base.GetHashCode(); - } - - public override bool Equals(object? obj) - { - return obj == (object)this; - } - - internal Type ArgumentType => - m_memberInfo is FieldInfo ? - ((FieldInfo)m_memberInfo).FieldType : - ((PropertyInfo)m_memberInfo).PropertyType; - - public MemberInfo MemberInfo => m_memberInfo; - public CustomAttributeTypedArgument TypedValue => m_value; - public string MemberName => MemberInfo.Name; - public bool IsField => MemberInfo is FieldInfo; - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/CustomAttributeTypedArgument.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/CustomAttributeTypedArgument.cs deleted file mode 100644 index 4bee6bd3cd8..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/CustomAttributeTypedArgument.cs +++ /dev/null @@ -1,82 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Collections.Generic; - -namespace System.Reflection -{ - public readonly partial struct CustomAttributeTypedArgument - { - public static bool operator ==(CustomAttributeTypedArgument left, CustomAttributeTypedArgument right) => left.Equals(right); - - public static bool operator !=(CustomAttributeTypedArgument left, CustomAttributeTypedArgument right) => !left.Equals(right); - - private readonly object? m_value; - private readonly Type m_argumentType; - - public CustomAttributeTypedArgument(Type argumentType, object? value) - { - // value can be null. - if (argumentType == null) - throw new ArgumentNullException(nameof(argumentType)); - - m_value = (value is null) ? null : CanonicalizeValue(value); - m_argumentType = argumentType; - } - - public CustomAttributeTypedArgument(object value) - { - // value cannot be null. - if (value == null) - throw new ArgumentNullException(nameof(value)); - - m_value = CanonicalizeValue(value); - m_argumentType = value.GetType(); - } - - - public override string ToString() => ToString(false); - - internal string ToString(bool typed) - { - if (m_argumentType == null) - return base.ToString()!; - - if (ArgumentType.IsEnum) - return string.Format(typed ? "{0}" : "({1}){0}", Value, ArgumentType.FullName); - else if (Value == null) - return string.Format(typed ? "null" : "({0})null", ArgumentType.Name); - else if (ArgumentType == typeof(string)) - return string.Format("\"{0}\"", Value); - else if (ArgumentType == typeof(char)) - return string.Format("'{0}'", Value); - else if (ArgumentType == typeof(Type)) - return string.Format("typeof({0})", ((Type)Value!).FullName); - else if (ArgumentType.IsArray) - { - IList<CustomAttributeTypedArgument> array = (IList<CustomAttributeTypedArgument>)Value!; - - Type elementType = ArgumentType.GetElementType()!; - string result = string.Format("new {0}[{1}] {{ ", elementType.IsEnum ? elementType.FullName : elementType.Name, array.Count); - - for (int i = 0; i < array.Count; i++) - { - result += string.Format(i == 0 ? "{0}" : ", {0}", array[i].ToString(elementType != typeof(object))); - } - - result += " }"; - - return result; - } - - return string.Format(typed ? "{0}" : "({1}){0}", Value, ArgumentType.Name); - } - - public override int GetHashCode() => base.GetHashCode(); - public override bool Equals(object? obj) => obj == (object)this; - - public Type ArgumentType => m_argumentType; - public object? Value => m_value; - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/DefaultMemberAttribute.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/DefaultMemberAttribute.cs deleted file mode 100644 index 585fdb07cd0..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/DefaultMemberAttribute.cs +++ /dev/null @@ -1,21 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Reflection -{ - [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface)] - public sealed class DefaultMemberAttribute : Attribute - { - // You must provide the name of the member, this is required - public DefaultMemberAttribute(string memberName) - { - MemberName = memberName; - } - - // A get accessor to return the name from the attribute. - // NOTE: There is no setter because the name must be provided - // to the constructor. The name is not optional. - public string MemberName { get; } - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/Emit/AssemblyBuilderAccess.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/Emit/AssemblyBuilderAccess.cs deleted file mode 100644 index 8527463eec8..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/Emit/AssemblyBuilderAccess.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -// This enumeration defines the access modes for a dynamic assembly. -// EE uses these enum values..look for m_dwDynamicAssemblyAccess in Assembly.hpp - -namespace System.Reflection.Emit -{ - [Flags] - public enum AssemblyBuilderAccess - { - Run = 1, - RunAndCollect = 8 | Run - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/Emit/EventToken.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/Emit/EventToken.cs deleted file mode 100644 index 2342f6edeb0..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/Emit/EventToken.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Reflection.Emit -{ - public struct EventToken - { - public static readonly EventToken Empty = default; - - internal EventToken(int eventToken) - { - Token = eventToken; - } - - public int Token { get; } - - public override int GetHashCode() => Token; - - public override bool Equals(object? obj) => obj is EventToken et && Equals(et); - - public bool Equals(EventToken obj) => obj.Token == Token; - - public static bool operator ==(EventToken a, EventToken b) => a.Equals(b); - - public static bool operator !=(EventToken a, EventToken b) => !(a == b); - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/Emit/FieldToken.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/Emit/FieldToken.cs deleted file mode 100644 index e695c021528..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/Emit/FieldToken.cs +++ /dev/null @@ -1,37 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Reflection.Emit -{ - /// <summary> - /// The FieldToken class is an opaque representation of the Token returned - /// by the Metadata to represent the field. FieldTokens are generated by - /// Module.GetFieldToken(). There are no meaningful accessors on this class, - /// but it can be passed to ILGenerator which understands it's internals. - /// </summary> - public struct FieldToken - { - public static readonly FieldToken Empty = default; - - private readonly object _class; - - internal FieldToken(int fieldToken, Type fieldClass) - { - Token = fieldToken; - _class = fieldClass; - } - - public int Token { get; } - - public override int GetHashCode() => Token; - - public override bool Equals(object? obj) => obj is FieldToken ft && Equals(ft); - - public bool Equals(FieldToken obj) => obj.Token == Token && obj._class == _class; - - public static bool operator ==(FieldToken a, FieldToken b) => a.Equals(b); - - public static bool operator !=(FieldToken a, FieldToken b) => !(a == b); - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/Emit/FlowControl.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/Emit/FlowControl.cs deleted file mode 100644 index 9cb947ce5a9..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/Emit/FlowControl.cs +++ /dev/null @@ -1,30 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*============================================================ -** -** Enumeration: FlowControl -** -** Purpose: Exposes FlowControl Attribute of IL. -** -** THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT BY HAND! -** See $(RepoRoot)\src\inc\OpCodeGen.pl for more information.** -==============================================================*/ - -namespace System.Reflection.Emit -{ - public enum FlowControl - { - Branch = 0, - Break = 1, - Call = 2, - Cond_Branch = 3, - Meta = 4, - Next = 5, - [Obsolete("This API has been deprecated. https://go.microsoft.com/fwlink/?linkid=14202")] - Phi = 6, - Return = 7, - Throw = 8, - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/Emit/Label.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/Emit/Label.cs deleted file mode 100644 index 5f47910a05e..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/Emit/Label.cs +++ /dev/null @@ -1,45 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*============================================================ -** -** -** -** -** -** -** Purpose: Represents a Label to the ILGenerator class. -** -** -===========================================================*/ - -namespace System.Reflection.Emit -{ - // The Label class is an opaque representation of a label used by the - // ILGenerator class. The token is used to mark where labels occur in the IL - // stream and then the necessary offsets are put back in the code when the ILGenerator - // is passed to the MethodWriter. - // Labels are created by using ILGenerator.CreateLabel and their position is set - // by using ILGenerator.MarkLabel. - public readonly struct Label : IEquatable<Label> - { - internal readonly int m_label; - - internal Label(int label) => m_label = label; - - internal int GetLabelValue() => m_label; - - public override int GetHashCode() => m_label; - - public override bool Equals(object? obj) => - obj is Label other && Equals(other); - - public bool Equals(Label obj) => - obj.m_label == m_label; - - public static bool operator ==(Label a, Label b) => a.Equals(b); - - public static bool operator !=(Label a, Label b) => !(a == b); - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/Emit/MethodToken.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/Emit/MethodToken.cs deleted file mode 100644 index eb8c15a9b31..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/Emit/MethodToken.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Reflection.Emit -{ - public struct MethodToken - { - public static readonly MethodToken Empty = default; - - internal MethodToken(int methodToken) - { - Token = methodToken; - } - - public int Token { get; } - - public override int GetHashCode() => Token; - - public override bool Equals(object? obj) => obj is MethodToken mt && Equals(mt); - - public bool Equals(MethodToken obj) => obj.Token == Token; - - public static bool operator ==(MethodToken a, MethodToken b) => a.Equals(b); - - public static bool operator !=(MethodToken a, MethodToken b) => !(a == b); - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/Emit/OpCodeType.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/Emit/OpCodeType.cs deleted file mode 100644 index 914b0374d55..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/Emit/OpCodeType.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*============================================================ -** -** Enumeration: OpCodeType -** -** Purpose: Exposes OpCodeType Attribute of IL. -** -** THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT BY HAND! -** See $(RepoRoot)\src\inc\OpCodeGen.pl for more information.** -==============================================================*/ - -namespace System.Reflection.Emit -{ - public enum OpCodeType - { - [Obsolete("This API has been deprecated. https://go.microsoft.com/fwlink/?linkid=14202")] - Annotation = 0, - Macro = 1, - Nternal = 2, - Objmodel = 3, - Prefix = 4, - Primitive = 5, - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/Emit/OpCodes.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/Emit/OpCodes.cs deleted file mode 100644 index 07c4b1ceb7e..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/Emit/OpCodes.cs +++ /dev/null @@ -1,2549 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*============================================================ -** -** Class: OpCodes -** -** Purpose: Exposes all of the IL instructions supported by the runtime. -** -** THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT BY HAND! -** See $(RepoRoot)\src\inc\OpCodeGen.pl for more information.** -==============================================================*/ - -namespace System.Reflection.Emit -{ - // - // Internal enums for opcode values. Note that the value names are used to construct - // publicly visible ilasm-compatible opcode names, so their exact form is important! - // - internal enum OpCodeValues - { - Nop = 0x00, - Break = 0x01, - Ldarg_0 = 0x02, - Ldarg_1 = 0x03, - Ldarg_2 = 0x04, - Ldarg_3 = 0x05, - Ldloc_0 = 0x06, - Ldloc_1 = 0x07, - Ldloc_2 = 0x08, - Ldloc_3 = 0x09, - Stloc_0 = 0x0a, - Stloc_1 = 0x0b, - Stloc_2 = 0x0c, - Stloc_3 = 0x0d, - Ldarg_S = 0x0e, - Ldarga_S = 0x0f, - Starg_S = 0x10, - Ldloc_S = 0x11, - Ldloca_S = 0x12, - Stloc_S = 0x13, - Ldnull = 0x14, - Ldc_I4_M1 = 0x15, - Ldc_I4_0 = 0x16, - Ldc_I4_1 = 0x17, - Ldc_I4_2 = 0x18, - Ldc_I4_3 = 0x19, - Ldc_I4_4 = 0x1a, - Ldc_I4_5 = 0x1b, - Ldc_I4_6 = 0x1c, - Ldc_I4_7 = 0x1d, - Ldc_I4_8 = 0x1e, - Ldc_I4_S = 0x1f, - Ldc_I4 = 0x20, - Ldc_I8 = 0x21, - Ldc_R4 = 0x22, - Ldc_R8 = 0x23, - Dup = 0x25, - Pop = 0x26, - Jmp = 0x27, - Call = 0x28, - Calli = 0x29, - Ret = 0x2a, - Br_S = 0x2b, - Brfalse_S = 0x2c, - Brtrue_S = 0x2d, - Beq_S = 0x2e, - Bge_S = 0x2f, - Bgt_S = 0x30, - Ble_S = 0x31, - Blt_S = 0x32, - Bne_Un_S = 0x33, - Bge_Un_S = 0x34, - Bgt_Un_S = 0x35, - Ble_Un_S = 0x36, - Blt_Un_S = 0x37, - Br = 0x38, - Brfalse = 0x39, - Brtrue = 0x3a, - Beq = 0x3b, - Bge = 0x3c, - Bgt = 0x3d, - Ble = 0x3e, - Blt = 0x3f, - Bne_Un = 0x40, - Bge_Un = 0x41, - Bgt_Un = 0x42, - Ble_Un = 0x43, - Blt_Un = 0x44, - Switch = 0x45, - Ldind_I1 = 0x46, - Ldind_U1 = 0x47, - Ldind_I2 = 0x48, - Ldind_U2 = 0x49, - Ldind_I4 = 0x4a, - Ldind_U4 = 0x4b, - Ldind_I8 = 0x4c, - Ldind_I = 0x4d, - Ldind_R4 = 0x4e, - Ldind_R8 = 0x4f, - Ldind_Ref = 0x50, - Stind_Ref = 0x51, - Stind_I1 = 0x52, - Stind_I2 = 0x53, - Stind_I4 = 0x54, - Stind_I8 = 0x55, - Stind_R4 = 0x56, - Stind_R8 = 0x57, - Add = 0x58, - Sub = 0x59, - Mul = 0x5a, - Div = 0x5b, - Div_Un = 0x5c, - Rem = 0x5d, - Rem_Un = 0x5e, - And = 0x5f, - Or = 0x60, - Xor = 0x61, - Shl = 0x62, - Shr = 0x63, - Shr_Un = 0x64, - Neg = 0x65, - Not = 0x66, - Conv_I1 = 0x67, - Conv_I2 = 0x68, - Conv_I4 = 0x69, - Conv_I8 = 0x6a, - Conv_R4 = 0x6b, - Conv_R8 = 0x6c, - Conv_U4 = 0x6d, - Conv_U8 = 0x6e, - Callvirt = 0x6f, - Cpobj = 0x70, - Ldobj = 0x71, - Ldstr = 0x72, - Newobj = 0x73, - Castclass = 0x74, - Isinst = 0x75, - Conv_R_Un = 0x76, - Unbox = 0x79, - Throw = 0x7a, - Ldfld = 0x7b, - Ldflda = 0x7c, - Stfld = 0x7d, - Ldsfld = 0x7e, - Ldsflda = 0x7f, - Stsfld = 0x80, - Stobj = 0x81, - Conv_Ovf_I1_Un = 0x82, - Conv_Ovf_I2_Un = 0x83, - Conv_Ovf_I4_Un = 0x84, - Conv_Ovf_I8_Un = 0x85, - Conv_Ovf_U1_Un = 0x86, - Conv_Ovf_U2_Un = 0x87, - Conv_Ovf_U4_Un = 0x88, - Conv_Ovf_U8_Un = 0x89, - Conv_Ovf_I_Un = 0x8a, - Conv_Ovf_U_Un = 0x8b, - Box = 0x8c, - Newarr = 0x8d, - Ldlen = 0x8e, - Ldelema = 0x8f, - Ldelem_I1 = 0x90, - Ldelem_U1 = 0x91, - Ldelem_I2 = 0x92, - Ldelem_U2 = 0x93, - Ldelem_I4 = 0x94, - Ldelem_U4 = 0x95, - Ldelem_I8 = 0x96, - Ldelem_I = 0x97, - Ldelem_R4 = 0x98, - Ldelem_R8 = 0x99, - Ldelem_Ref = 0x9a, - Stelem_I = 0x9b, - Stelem_I1 = 0x9c, - Stelem_I2 = 0x9d, - Stelem_I4 = 0x9e, - Stelem_I8 = 0x9f, - Stelem_R4 = 0xa0, - Stelem_R8 = 0xa1, - Stelem_Ref = 0xa2, - Ldelem = 0xa3, - Stelem = 0xa4, - Unbox_Any = 0xa5, - Conv_Ovf_I1 = 0xb3, - Conv_Ovf_U1 = 0xb4, - Conv_Ovf_I2 = 0xb5, - Conv_Ovf_U2 = 0xb6, - Conv_Ovf_I4 = 0xb7, - Conv_Ovf_U4 = 0xb8, - Conv_Ovf_I8 = 0xb9, - Conv_Ovf_U8 = 0xba, - Refanyval = 0xc2, - Ckfinite = 0xc3, - Mkrefany = 0xc6, - Ldtoken = 0xd0, - Conv_U2 = 0xd1, - Conv_U1 = 0xd2, - Conv_I = 0xd3, - Conv_Ovf_I = 0xd4, - Conv_Ovf_U = 0xd5, - Add_Ovf = 0xd6, - Add_Ovf_Un = 0xd7, - Mul_Ovf = 0xd8, - Mul_Ovf_Un = 0xd9, - Sub_Ovf = 0xda, - Sub_Ovf_Un = 0xdb, - Endfinally = 0xdc, - Leave = 0xdd, - Leave_S = 0xde, - Stind_I = 0xdf, - Conv_U = 0xe0, - Prefix7 = 0xf8, - Prefix6 = 0xf9, - Prefix5 = 0xfa, - Prefix4 = 0xfb, - Prefix3 = 0xfc, - Prefix2 = 0xfd, - Prefix1 = 0xfe, - Prefixref = 0xff, - Arglist = 0xfe00, - Ceq = 0xfe01, - Cgt = 0xfe02, - Cgt_Un = 0xfe03, - Clt = 0xfe04, - Clt_Un = 0xfe05, - Ldftn = 0xfe06, - Ldvirtftn = 0xfe07, - Ldarg = 0xfe09, - Ldarga = 0xfe0a, - Starg = 0xfe0b, - Ldloc = 0xfe0c, - Ldloca = 0xfe0d, - Stloc = 0xfe0e, - Localloc = 0xfe0f, - Endfilter = 0xfe11, - Unaligned_ = 0xfe12, - Volatile_ = 0xfe13, - Tail_ = 0xfe14, - Initobj = 0xfe15, - Constrained_ = 0xfe16, - Cpblk = 0xfe17, - Initblk = 0xfe18, - Rethrow = 0xfe1a, - Sizeof = 0xfe1c, - Refanytype = 0xfe1d, - Readonly_ = 0xfe1e, - // If you add more opcodes here, modify OpCode.Name to handle them correctly - } - - /// <summary> - /// <para> - /// The IL instruction opcodes supported by the - /// runtime. The IL Instruction Specification describes each - /// Opcode. - /// </para> - /// </summary> - /// <seealso topic='IL Instruction Set Specification'/> - public class OpCodes - { - private OpCodes() - { - } - - public static readonly OpCode Nop = new OpCode(OpCodeValues.Nop, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop0 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Break = new OpCode(OpCodeValues.Break, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Break << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop0 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ldarg_0 = new OpCode(OpCodeValues.Ldarg_0, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Macro << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop0 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push1 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ldarg_1 = new OpCode(OpCodeValues.Ldarg_1, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Macro << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop0 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push1 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ldarg_2 = new OpCode(OpCodeValues.Ldarg_2, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Macro << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop0 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push1 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ldarg_3 = new OpCode(OpCodeValues.Ldarg_3, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Macro << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop0 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push1 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ldloc_0 = new OpCode(OpCodeValues.Ldloc_0, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Macro << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop0 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push1 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ldloc_1 = new OpCode(OpCodeValues.Ldloc_1, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Macro << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop0 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push1 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ldloc_2 = new OpCode(OpCodeValues.Ldloc_2, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Macro << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop0 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push1 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ldloc_3 = new OpCode(OpCodeValues.Ldloc_3, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Macro << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop0 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push1 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Stloc_0 = new OpCode(OpCodeValues.Stloc_0, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Macro << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Stloc_1 = new OpCode(OpCodeValues.Stloc_1, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Macro << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Stloc_2 = new OpCode(OpCodeValues.Stloc_2, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Macro << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Stloc_3 = new OpCode(OpCodeValues.Stloc_3, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Macro << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ldarg_S = new OpCode(OpCodeValues.Ldarg_S, - ((int)OperandType.ShortInlineVar) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Macro << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop0 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push1 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ldarga_S = new OpCode(OpCodeValues.Ldarga_S, - ((int)OperandType.ShortInlineVar) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Macro << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop0 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Starg_S = new OpCode(OpCodeValues.Starg_S, - ((int)OperandType.ShortInlineVar) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Macro << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ldloc_S = new OpCode(OpCodeValues.Ldloc_S, - ((int)OperandType.ShortInlineVar) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Macro << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop0 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push1 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ldloca_S = new OpCode(OpCodeValues.Ldloca_S, - ((int)OperandType.ShortInlineVar) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Macro << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop0 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Stloc_S = new OpCode(OpCodeValues.Stloc_S, - ((int)OperandType.ShortInlineVar) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Macro << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ldnull = new OpCode(OpCodeValues.Ldnull, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop0 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushref << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ldc_I4_M1 = new OpCode(OpCodeValues.Ldc_I4_M1, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Macro << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop0 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ldc_I4_0 = new OpCode(OpCodeValues.Ldc_I4_0, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Macro << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop0 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ldc_I4_1 = new OpCode(OpCodeValues.Ldc_I4_1, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Macro << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop0 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ldc_I4_2 = new OpCode(OpCodeValues.Ldc_I4_2, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Macro << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop0 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ldc_I4_3 = new OpCode(OpCodeValues.Ldc_I4_3, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Macro << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop0 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ldc_I4_4 = new OpCode(OpCodeValues.Ldc_I4_4, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Macro << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop0 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ldc_I4_5 = new OpCode(OpCodeValues.Ldc_I4_5, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Macro << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop0 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ldc_I4_6 = new OpCode(OpCodeValues.Ldc_I4_6, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Macro << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop0 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ldc_I4_7 = new OpCode(OpCodeValues.Ldc_I4_7, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Macro << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop0 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ldc_I4_8 = new OpCode(OpCodeValues.Ldc_I4_8, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Macro << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop0 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ldc_I4_S = new OpCode(OpCodeValues.Ldc_I4_S, - ((int)OperandType.ShortInlineI) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Macro << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop0 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ldc_I4 = new OpCode(OpCodeValues.Ldc_I4, - ((int)OperandType.InlineI) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop0 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ldc_I8 = new OpCode(OpCodeValues.Ldc_I8, - ((int)OperandType.InlineI8) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop0 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi8 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ldc_R4 = new OpCode(OpCodeValues.Ldc_R4, - ((int)OperandType.ShortInlineR) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop0 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushr4 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ldc_R8 = new OpCode(OpCodeValues.Ldc_R8, - ((int)OperandType.InlineR) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop0 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushr8 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Dup = new OpCode(OpCodeValues.Dup, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push1_push1 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Pop = new OpCode(OpCodeValues.Pop, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Jmp = new OpCode(OpCodeValues.Jmp, - ((int)OperandType.InlineMethod) | - ((int)FlowControl.Call << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop0 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - OpCode.EndsUncondJmpBlkFlag | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Call = new OpCode(OpCodeValues.Call, - ((int)OperandType.InlineMethod) | - ((int)FlowControl.Call << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Varpop << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Varpush << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Calli = new OpCode(OpCodeValues.Calli, - ((int)OperandType.InlineSig) | - ((int)FlowControl.Call << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Varpop << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Varpush << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ret = new OpCode(OpCodeValues.Ret, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Return << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Varpop << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - OpCode.EndsUncondJmpBlkFlag | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Br_S = new OpCode(OpCodeValues.Br_S, - ((int)OperandType.ShortInlineBrTarget) | - ((int)FlowControl.Branch << OpCode.FlowControlShift) | - ((int)OpCodeType.Macro << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop0 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - OpCode.EndsUncondJmpBlkFlag | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Brfalse_S = new OpCode(OpCodeValues.Brfalse_S, - ((int)OperandType.ShortInlineBrTarget) | - ((int)FlowControl.Cond_Branch << OpCode.FlowControlShift) | - ((int)OpCodeType.Macro << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Popi << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Brtrue_S = new OpCode(OpCodeValues.Brtrue_S, - ((int)OperandType.ShortInlineBrTarget) | - ((int)FlowControl.Cond_Branch << OpCode.FlowControlShift) | - ((int)OpCodeType.Macro << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Popi << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Beq_S = new OpCode(OpCodeValues.Beq_S, - ((int)OperandType.ShortInlineBrTarget) | - ((int)FlowControl.Cond_Branch << OpCode.FlowControlShift) | - ((int)OpCodeType.Macro << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1_pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-2 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Bge_S = new OpCode(OpCodeValues.Bge_S, - ((int)OperandType.ShortInlineBrTarget) | - ((int)FlowControl.Cond_Branch << OpCode.FlowControlShift) | - ((int)OpCodeType.Macro << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1_pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-2 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Bgt_S = new OpCode(OpCodeValues.Bgt_S, - ((int)OperandType.ShortInlineBrTarget) | - ((int)FlowControl.Cond_Branch << OpCode.FlowControlShift) | - ((int)OpCodeType.Macro << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1_pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-2 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ble_S = new OpCode(OpCodeValues.Ble_S, - ((int)OperandType.ShortInlineBrTarget) | - ((int)FlowControl.Cond_Branch << OpCode.FlowControlShift) | - ((int)OpCodeType.Macro << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1_pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-2 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Blt_S = new OpCode(OpCodeValues.Blt_S, - ((int)OperandType.ShortInlineBrTarget) | - ((int)FlowControl.Cond_Branch << OpCode.FlowControlShift) | - ((int)OpCodeType.Macro << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1_pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-2 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Bne_Un_S = new OpCode(OpCodeValues.Bne_Un_S, - ((int)OperandType.ShortInlineBrTarget) | - ((int)FlowControl.Cond_Branch << OpCode.FlowControlShift) | - ((int)OpCodeType.Macro << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1_pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-2 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Bge_Un_S = new OpCode(OpCodeValues.Bge_Un_S, - ((int)OperandType.ShortInlineBrTarget) | - ((int)FlowControl.Cond_Branch << OpCode.FlowControlShift) | - ((int)OpCodeType.Macro << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1_pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-2 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Bgt_Un_S = new OpCode(OpCodeValues.Bgt_Un_S, - ((int)OperandType.ShortInlineBrTarget) | - ((int)FlowControl.Cond_Branch << OpCode.FlowControlShift) | - ((int)OpCodeType.Macro << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1_pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-2 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ble_Un_S = new OpCode(OpCodeValues.Ble_Un_S, - ((int)OperandType.ShortInlineBrTarget) | - ((int)FlowControl.Cond_Branch << OpCode.FlowControlShift) | - ((int)OpCodeType.Macro << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1_pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-2 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Blt_Un_S = new OpCode(OpCodeValues.Blt_Un_S, - ((int)OperandType.ShortInlineBrTarget) | - ((int)FlowControl.Cond_Branch << OpCode.FlowControlShift) | - ((int)OpCodeType.Macro << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1_pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-2 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Br = new OpCode(OpCodeValues.Br, - ((int)OperandType.InlineBrTarget) | - ((int)FlowControl.Branch << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop0 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - OpCode.EndsUncondJmpBlkFlag | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Brfalse = new OpCode(OpCodeValues.Brfalse, - ((int)OperandType.InlineBrTarget) | - ((int)FlowControl.Cond_Branch << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Popi << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Brtrue = new OpCode(OpCodeValues.Brtrue, - ((int)OperandType.InlineBrTarget) | - ((int)FlowControl.Cond_Branch << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Popi << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Beq = new OpCode(OpCodeValues.Beq, - ((int)OperandType.InlineBrTarget) | - ((int)FlowControl.Cond_Branch << OpCode.FlowControlShift) | - ((int)OpCodeType.Macro << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1_pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-2 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Bge = new OpCode(OpCodeValues.Bge, - ((int)OperandType.InlineBrTarget) | - ((int)FlowControl.Cond_Branch << OpCode.FlowControlShift) | - ((int)OpCodeType.Macro << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1_pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-2 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Bgt = new OpCode(OpCodeValues.Bgt, - ((int)OperandType.InlineBrTarget) | - ((int)FlowControl.Cond_Branch << OpCode.FlowControlShift) | - ((int)OpCodeType.Macro << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1_pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-2 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ble = new OpCode(OpCodeValues.Ble, - ((int)OperandType.InlineBrTarget) | - ((int)FlowControl.Cond_Branch << OpCode.FlowControlShift) | - ((int)OpCodeType.Macro << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1_pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-2 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Blt = new OpCode(OpCodeValues.Blt, - ((int)OperandType.InlineBrTarget) | - ((int)FlowControl.Cond_Branch << OpCode.FlowControlShift) | - ((int)OpCodeType.Macro << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1_pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-2 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Bne_Un = new OpCode(OpCodeValues.Bne_Un, - ((int)OperandType.InlineBrTarget) | - ((int)FlowControl.Cond_Branch << OpCode.FlowControlShift) | - ((int)OpCodeType.Macro << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1_pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-2 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Bge_Un = new OpCode(OpCodeValues.Bge_Un, - ((int)OperandType.InlineBrTarget) | - ((int)FlowControl.Cond_Branch << OpCode.FlowControlShift) | - ((int)OpCodeType.Macro << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1_pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-2 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Bgt_Un = new OpCode(OpCodeValues.Bgt_Un, - ((int)OperandType.InlineBrTarget) | - ((int)FlowControl.Cond_Branch << OpCode.FlowControlShift) | - ((int)OpCodeType.Macro << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1_pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-2 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ble_Un = new OpCode(OpCodeValues.Ble_Un, - ((int)OperandType.InlineBrTarget) | - ((int)FlowControl.Cond_Branch << OpCode.FlowControlShift) | - ((int)OpCodeType.Macro << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1_pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-2 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Blt_Un = new OpCode(OpCodeValues.Blt_Un, - ((int)OperandType.InlineBrTarget) | - ((int)FlowControl.Cond_Branch << OpCode.FlowControlShift) | - ((int)OpCodeType.Macro << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1_pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-2 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Switch = new OpCode(OpCodeValues.Switch, - ((int)OperandType.InlineSwitch) | - ((int)FlowControl.Cond_Branch << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Popi << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ldind_I1 = new OpCode(OpCodeValues.Ldind_I1, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Popi << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ldind_U1 = new OpCode(OpCodeValues.Ldind_U1, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Popi << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ldind_I2 = new OpCode(OpCodeValues.Ldind_I2, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Popi << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ldind_U2 = new OpCode(OpCodeValues.Ldind_U2, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Popi << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ldind_I4 = new OpCode(OpCodeValues.Ldind_I4, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Popi << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ldind_U4 = new OpCode(OpCodeValues.Ldind_U4, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Popi << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ldind_I8 = new OpCode(OpCodeValues.Ldind_I8, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Popi << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi8 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ldind_I = new OpCode(OpCodeValues.Ldind_I, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Popi << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ldind_R4 = new OpCode(OpCodeValues.Ldind_R4, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Popi << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushr4 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ldind_R8 = new OpCode(OpCodeValues.Ldind_R8, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Popi << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushr8 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ldind_Ref = new OpCode(OpCodeValues.Ldind_Ref, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Popi << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushref << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Stind_Ref = new OpCode(OpCodeValues.Stind_Ref, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Popi_popi << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-2 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Stind_I1 = new OpCode(OpCodeValues.Stind_I1, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Popi_popi << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-2 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Stind_I2 = new OpCode(OpCodeValues.Stind_I2, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Popi_popi << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-2 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Stind_I4 = new OpCode(OpCodeValues.Stind_I4, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Popi_popi << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-2 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Stind_I8 = new OpCode(OpCodeValues.Stind_I8, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Popi_popi8 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-2 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Stind_R4 = new OpCode(OpCodeValues.Stind_R4, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Popi_popr4 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-2 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Stind_R8 = new OpCode(OpCodeValues.Stind_R8, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Popi_popr8 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-2 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Add = new OpCode(OpCodeValues.Add, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1_pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push1 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Sub = new OpCode(OpCodeValues.Sub, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1_pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push1 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Mul = new OpCode(OpCodeValues.Mul, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1_pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push1 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Div = new OpCode(OpCodeValues.Div, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1_pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push1 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Div_Un = new OpCode(OpCodeValues.Div_Un, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1_pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push1 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Rem = new OpCode(OpCodeValues.Rem, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1_pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push1 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Rem_Un = new OpCode(OpCodeValues.Rem_Un, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1_pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push1 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode And = new OpCode(OpCodeValues.And, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1_pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push1 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Or = new OpCode(OpCodeValues.Or, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1_pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push1 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Xor = new OpCode(OpCodeValues.Xor, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1_pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push1 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Shl = new OpCode(OpCodeValues.Shl, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1_pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push1 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Shr = new OpCode(OpCodeValues.Shr, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1_pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push1 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Shr_Un = new OpCode(OpCodeValues.Shr_Un, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1_pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push1 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Neg = new OpCode(OpCodeValues.Neg, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push1 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Not = new OpCode(OpCodeValues.Not, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push1 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Conv_I1 = new OpCode(OpCodeValues.Conv_I1, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Conv_I2 = new OpCode(OpCodeValues.Conv_I2, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Conv_I4 = new OpCode(OpCodeValues.Conv_I4, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Conv_I8 = new OpCode(OpCodeValues.Conv_I8, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi8 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Conv_R4 = new OpCode(OpCodeValues.Conv_R4, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushr4 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Conv_R8 = new OpCode(OpCodeValues.Conv_R8, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushr8 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Conv_U4 = new OpCode(OpCodeValues.Conv_U4, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Conv_U8 = new OpCode(OpCodeValues.Conv_U8, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi8 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Callvirt = new OpCode(OpCodeValues.Callvirt, - ((int)OperandType.InlineMethod) | - ((int)FlowControl.Call << OpCode.FlowControlShift) | - ((int)OpCodeType.Objmodel << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Varpop << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Varpush << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Cpobj = new OpCode(OpCodeValues.Cpobj, - ((int)OperandType.InlineType) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Objmodel << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Popi_popi << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-2 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ldobj = new OpCode(OpCodeValues.Ldobj, - ((int)OperandType.InlineType) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Objmodel << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Popi << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push1 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ldstr = new OpCode(OpCodeValues.Ldstr, - ((int)OperandType.InlineString) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Objmodel << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop0 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushref << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Newobj = new OpCode(OpCodeValues.Newobj, - ((int)OperandType.InlineMethod) | - ((int)FlowControl.Call << OpCode.FlowControlShift) | - ((int)OpCodeType.Objmodel << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Varpop << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushref << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Castclass = new OpCode(OpCodeValues.Castclass, - ((int)OperandType.InlineType) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Objmodel << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Popref << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushref << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Isinst = new OpCode(OpCodeValues.Isinst, - ((int)OperandType.InlineType) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Objmodel << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Popref << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Conv_R_Un = new OpCode(OpCodeValues.Conv_R_Un, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushr8 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Unbox = new OpCode(OpCodeValues.Unbox, - ((int)OperandType.InlineType) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Popref << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Throw = new OpCode(OpCodeValues.Throw, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Throw << OpCode.FlowControlShift) | - ((int)OpCodeType.Objmodel << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Popref << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - OpCode.EndsUncondJmpBlkFlag | - (-1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ldfld = new OpCode(OpCodeValues.Ldfld, - ((int)OperandType.InlineField) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Objmodel << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Popref << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push1 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ldflda = new OpCode(OpCodeValues.Ldflda, - ((int)OperandType.InlineField) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Objmodel << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Popref << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Stfld = new OpCode(OpCodeValues.Stfld, - ((int)OperandType.InlineField) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Objmodel << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Popref_pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-2 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ldsfld = new OpCode(OpCodeValues.Ldsfld, - ((int)OperandType.InlineField) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Objmodel << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop0 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push1 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ldsflda = new OpCode(OpCodeValues.Ldsflda, - ((int)OperandType.InlineField) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Objmodel << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop0 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Stsfld = new OpCode(OpCodeValues.Stsfld, - ((int)OperandType.InlineField) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Objmodel << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Stobj = new OpCode(OpCodeValues.Stobj, - ((int)OperandType.InlineType) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Popi_pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-2 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Conv_Ovf_I1_Un = new OpCode(OpCodeValues.Conv_Ovf_I1_Un, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Conv_Ovf_I2_Un = new OpCode(OpCodeValues.Conv_Ovf_I2_Un, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Conv_Ovf_I4_Un = new OpCode(OpCodeValues.Conv_Ovf_I4_Un, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Conv_Ovf_I8_Un = new OpCode(OpCodeValues.Conv_Ovf_I8_Un, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi8 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Conv_Ovf_U1_Un = new OpCode(OpCodeValues.Conv_Ovf_U1_Un, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Conv_Ovf_U2_Un = new OpCode(OpCodeValues.Conv_Ovf_U2_Un, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Conv_Ovf_U4_Un = new OpCode(OpCodeValues.Conv_Ovf_U4_Un, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Conv_Ovf_U8_Un = new OpCode(OpCodeValues.Conv_Ovf_U8_Un, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi8 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Conv_Ovf_I_Un = new OpCode(OpCodeValues.Conv_Ovf_I_Un, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Conv_Ovf_U_Un = new OpCode(OpCodeValues.Conv_Ovf_U_Un, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Box = new OpCode(OpCodeValues.Box, - ((int)OperandType.InlineType) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushref << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Newarr = new OpCode(OpCodeValues.Newarr, - ((int)OperandType.InlineType) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Objmodel << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Popi << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushref << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ldlen = new OpCode(OpCodeValues.Ldlen, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Objmodel << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Popref << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ldelema = new OpCode(OpCodeValues.Ldelema, - ((int)OperandType.InlineType) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Objmodel << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Popref_popi << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ldelem_I1 = new OpCode(OpCodeValues.Ldelem_I1, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Objmodel << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Popref_popi << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ldelem_U1 = new OpCode(OpCodeValues.Ldelem_U1, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Objmodel << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Popref_popi << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ldelem_I2 = new OpCode(OpCodeValues.Ldelem_I2, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Objmodel << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Popref_popi << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ldelem_U2 = new OpCode(OpCodeValues.Ldelem_U2, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Objmodel << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Popref_popi << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ldelem_I4 = new OpCode(OpCodeValues.Ldelem_I4, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Objmodel << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Popref_popi << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ldelem_U4 = new OpCode(OpCodeValues.Ldelem_U4, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Objmodel << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Popref_popi << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ldelem_I8 = new OpCode(OpCodeValues.Ldelem_I8, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Objmodel << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Popref_popi << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi8 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ldelem_I = new OpCode(OpCodeValues.Ldelem_I, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Objmodel << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Popref_popi << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ldelem_R4 = new OpCode(OpCodeValues.Ldelem_R4, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Objmodel << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Popref_popi << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushr4 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ldelem_R8 = new OpCode(OpCodeValues.Ldelem_R8, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Objmodel << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Popref_popi << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushr8 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ldelem_Ref = new OpCode(OpCodeValues.Ldelem_Ref, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Objmodel << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Popref_popi << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushref << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Stelem_I = new OpCode(OpCodeValues.Stelem_I, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Objmodel << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Popref_popi_popi << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-3 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Stelem_I1 = new OpCode(OpCodeValues.Stelem_I1, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Objmodel << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Popref_popi_popi << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-3 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Stelem_I2 = new OpCode(OpCodeValues.Stelem_I2, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Objmodel << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Popref_popi_popi << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-3 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Stelem_I4 = new OpCode(OpCodeValues.Stelem_I4, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Objmodel << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Popref_popi_popi << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-3 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Stelem_I8 = new OpCode(OpCodeValues.Stelem_I8, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Objmodel << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Popref_popi_popi8 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-3 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Stelem_R4 = new OpCode(OpCodeValues.Stelem_R4, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Objmodel << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Popref_popi_popr4 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-3 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Stelem_R8 = new OpCode(OpCodeValues.Stelem_R8, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Objmodel << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Popref_popi_popr8 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-3 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Stelem_Ref = new OpCode(OpCodeValues.Stelem_Ref, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Objmodel << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Popref_popi_popref << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-3 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ldelem = new OpCode(OpCodeValues.Ldelem, - ((int)OperandType.InlineType) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Objmodel << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Popref_popi << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push1 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Stelem = new OpCode(OpCodeValues.Stelem, - ((int)OperandType.InlineType) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Objmodel << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Popref_popi_pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-3 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Unbox_Any = new OpCode(OpCodeValues.Unbox_Any, - ((int)OperandType.InlineType) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Objmodel << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Popref << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push1 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Conv_Ovf_I1 = new OpCode(OpCodeValues.Conv_Ovf_I1, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Conv_Ovf_U1 = new OpCode(OpCodeValues.Conv_Ovf_U1, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Conv_Ovf_I2 = new OpCode(OpCodeValues.Conv_Ovf_I2, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Conv_Ovf_U2 = new OpCode(OpCodeValues.Conv_Ovf_U2, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Conv_Ovf_I4 = new OpCode(OpCodeValues.Conv_Ovf_I4, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Conv_Ovf_U4 = new OpCode(OpCodeValues.Conv_Ovf_U4, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Conv_Ovf_I8 = new OpCode(OpCodeValues.Conv_Ovf_I8, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi8 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Conv_Ovf_U8 = new OpCode(OpCodeValues.Conv_Ovf_U8, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi8 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Refanyval = new OpCode(OpCodeValues.Refanyval, - ((int)OperandType.InlineType) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ckfinite = new OpCode(OpCodeValues.Ckfinite, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushr8 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Mkrefany = new OpCode(OpCodeValues.Mkrefany, - ((int)OperandType.InlineType) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Popi << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push1 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ldtoken = new OpCode(OpCodeValues.Ldtoken, - ((int)OperandType.InlineTok) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop0 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Conv_U2 = new OpCode(OpCodeValues.Conv_U2, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Conv_U1 = new OpCode(OpCodeValues.Conv_U1, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Conv_I = new OpCode(OpCodeValues.Conv_I, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Conv_Ovf_I = new OpCode(OpCodeValues.Conv_Ovf_I, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Conv_Ovf_U = new OpCode(OpCodeValues.Conv_Ovf_U, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Add_Ovf = new OpCode(OpCodeValues.Add_Ovf, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1_pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push1 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Add_Ovf_Un = new OpCode(OpCodeValues.Add_Ovf_Un, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1_pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push1 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Mul_Ovf = new OpCode(OpCodeValues.Mul_Ovf, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1_pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push1 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Mul_Ovf_Un = new OpCode(OpCodeValues.Mul_Ovf_Un, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1_pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push1 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Sub_Ovf = new OpCode(OpCodeValues.Sub_Ovf, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1_pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push1 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Sub_Ovf_Un = new OpCode(OpCodeValues.Sub_Ovf_Un, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1_pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push1 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Endfinally = new OpCode(OpCodeValues.Endfinally, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Return << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop0 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - OpCode.EndsUncondJmpBlkFlag | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Leave = new OpCode(OpCodeValues.Leave, - ((int)OperandType.InlineBrTarget) | - ((int)FlowControl.Branch << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop0 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - OpCode.EndsUncondJmpBlkFlag | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Leave_S = new OpCode(OpCodeValues.Leave_S, - ((int)OperandType.ShortInlineBrTarget) | - ((int)FlowControl.Branch << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop0 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - OpCode.EndsUncondJmpBlkFlag | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Stind_I = new OpCode(OpCodeValues.Stind_I, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Popi_popi << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (-2 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Conv_U = new OpCode(OpCodeValues.Conv_U, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Prefix7 = new OpCode(OpCodeValues.Prefix7, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Meta << OpCode.FlowControlShift) | - ((int)OpCodeType.Nternal << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop0 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Prefix6 = new OpCode(OpCodeValues.Prefix6, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Meta << OpCode.FlowControlShift) | - ((int)OpCodeType.Nternal << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop0 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Prefix5 = new OpCode(OpCodeValues.Prefix5, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Meta << OpCode.FlowControlShift) | - ((int)OpCodeType.Nternal << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop0 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Prefix4 = new OpCode(OpCodeValues.Prefix4, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Meta << OpCode.FlowControlShift) | - ((int)OpCodeType.Nternal << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop0 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Prefix3 = new OpCode(OpCodeValues.Prefix3, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Meta << OpCode.FlowControlShift) | - ((int)OpCodeType.Nternal << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop0 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Prefix2 = new OpCode(OpCodeValues.Prefix2, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Meta << OpCode.FlowControlShift) | - ((int)OpCodeType.Nternal << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop0 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Prefix1 = new OpCode(OpCodeValues.Prefix1, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Meta << OpCode.FlowControlShift) | - ((int)OpCodeType.Nternal << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop0 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Prefixref = new OpCode(OpCodeValues.Prefixref, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Meta << OpCode.FlowControlShift) | - ((int)OpCodeType.Nternal << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop0 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (1 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Arglist = new OpCode(OpCodeValues.Arglist, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop0 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (2 << OpCode.SizeShift) | - (1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ceq = new OpCode(OpCodeValues.Ceq, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1_pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (2 << OpCode.SizeShift) | - (-1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Cgt = new OpCode(OpCodeValues.Cgt, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1_pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (2 << OpCode.SizeShift) | - (-1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Cgt_Un = new OpCode(OpCodeValues.Cgt_Un, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1_pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (2 << OpCode.SizeShift) | - (-1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Clt = new OpCode(OpCodeValues.Clt, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1_pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (2 << OpCode.SizeShift) | - (-1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Clt_Un = new OpCode(OpCodeValues.Clt_Un, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1_pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (2 << OpCode.SizeShift) | - (-1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ldftn = new OpCode(OpCodeValues.Ldftn, - ((int)OperandType.InlineMethod) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop0 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (2 << OpCode.SizeShift) | - (1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ldvirtftn = new OpCode(OpCodeValues.Ldvirtftn, - ((int)OperandType.InlineMethod) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Popref << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (2 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ldarg = new OpCode(OpCodeValues.Ldarg, - ((int)OperandType.InlineVar) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop0 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push1 << OpCode.StackBehaviourPushShift) | - (2 << OpCode.SizeShift) | - (1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ldarga = new OpCode(OpCodeValues.Ldarga, - ((int)OperandType.InlineVar) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop0 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (2 << OpCode.SizeShift) | - (1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Starg = new OpCode(OpCodeValues.Starg, - ((int)OperandType.InlineVar) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (2 << OpCode.SizeShift) | - (-1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ldloc = new OpCode(OpCodeValues.Ldloc, - ((int)OperandType.InlineVar) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop0 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push1 << OpCode.StackBehaviourPushShift) | - (2 << OpCode.SizeShift) | - (1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Ldloca = new OpCode(OpCodeValues.Ldloca, - ((int)OperandType.InlineVar) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop0 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (2 << OpCode.SizeShift) | - (1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Stloc = new OpCode(OpCodeValues.Stloc, - ((int)OperandType.InlineVar) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (2 << OpCode.SizeShift) | - (-1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Localloc = new OpCode(OpCodeValues.Localloc, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Popi << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (2 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Endfilter = new OpCode(OpCodeValues.Endfilter, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Return << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Popi << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (2 << OpCode.SizeShift) | - OpCode.EndsUncondJmpBlkFlag | - (-1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Unaligned = new OpCode(OpCodeValues.Unaligned_, - ((int)OperandType.ShortInlineI) | - ((int)FlowControl.Meta << OpCode.FlowControlShift) | - ((int)OpCodeType.Prefix << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop0 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (2 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Volatile = new OpCode(OpCodeValues.Volatile_, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Meta << OpCode.FlowControlShift) | - ((int)OpCodeType.Prefix << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop0 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (2 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Tailcall = new OpCode(OpCodeValues.Tail_, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Meta << OpCode.FlowControlShift) | - ((int)OpCodeType.Prefix << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop0 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (2 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Initobj = new OpCode(OpCodeValues.Initobj, - ((int)OperandType.InlineType) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Objmodel << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Popi << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (2 << OpCode.SizeShift) | - (-1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Constrained = new OpCode(OpCodeValues.Constrained_, - ((int)OperandType.InlineType) | - ((int)FlowControl.Meta << OpCode.FlowControlShift) | - ((int)OpCodeType.Prefix << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop0 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (2 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Cpblk = new OpCode(OpCodeValues.Cpblk, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Popi_popi_popi << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (2 << OpCode.SizeShift) | - (-3 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Initblk = new OpCode(OpCodeValues.Initblk, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Popi_popi_popi << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (2 << OpCode.SizeShift) | - (-3 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Rethrow = new OpCode(OpCodeValues.Rethrow, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Throw << OpCode.FlowControlShift) | - ((int)OpCodeType.Objmodel << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop0 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (2 << OpCode.SizeShift) | - OpCode.EndsUncondJmpBlkFlag | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Sizeof = new OpCode(OpCodeValues.Sizeof, - ((int)OperandType.InlineType) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop0 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (2 << OpCode.SizeShift) | - (1 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Refanytype = new OpCode(OpCodeValues.Refanytype, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Next << OpCode.FlowControlShift) | - ((int)OpCodeType.Primitive << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop1 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Pushi << OpCode.StackBehaviourPushShift) | - (2 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - public static readonly OpCode Readonly = new OpCode(OpCodeValues.Readonly_, - ((int)OperandType.InlineNone) | - ((int)FlowControl.Meta << OpCode.FlowControlShift) | - ((int)OpCodeType.Prefix << OpCode.OpCodeTypeShift) | - ((int)StackBehaviour.Pop0 << OpCode.StackBehaviourPopShift) | - ((int)StackBehaviour.Push0 << OpCode.StackBehaviourPushShift) | - (2 << OpCode.SizeShift) | - (0 << OpCode.StackChangeShift) - ); - - - public static bool TakesSingleByteArgument(OpCode inst) - { - switch (inst.OperandType) - { - case OperandType.ShortInlineBrTarget: - case OperandType.ShortInlineI: - case OperandType.ShortInlineVar: - return true; - } - return false; - } - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/Emit/Opcode.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/Emit/Opcode.cs deleted file mode 100644 index 0c6933ece13..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/Emit/Opcode.cs +++ /dev/null @@ -1,125 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Threading; - -namespace System.Reflection.Emit -{ - public readonly struct OpCode : IEquatable<OpCode> - { - // - // Use packed bitfield for flags to avoid code bloat - // - - internal const int OperandTypeMask = 0x1F; // 000000000000000000000000000XXXXX - - internal const int FlowControlShift = 5; // 00000000000000000000000XXXX00000 - internal const int FlowControlMask = 0x0F; - - internal const int OpCodeTypeShift = 9; // 00000000000000000000XXX000000000 - internal const int OpCodeTypeMask = 0x07; - - internal const int StackBehaviourPopShift = 12; // 000000000000000XXXXX000000000000 - internal const int StackBehaviourPushShift = 17; // 0000000000XXXXX00000000000000000 - internal const int StackBehaviourMask = 0x1F; - - internal const int SizeShift = 22; // 00000000XX0000000000000000000000 - internal const int SizeMask = 0x03; - - internal const int EndsUncondJmpBlkFlag = 0x01000000; // 0000000X000000000000000000000000 - - // unused // 0000XXX0000000000000000000000000 - - internal const int StackChangeShift = 28; // XXXX0000000000000000000000000000 - - private readonly OpCodeValues m_value; - private readonly int m_flags; - - internal OpCode(OpCodeValues value, int flags) - { - m_value = value; - m_flags = flags; - } - - internal bool EndsUncondJmpBlk() => - (m_flags & EndsUncondJmpBlkFlag) != 0; - - internal int StackChange() => - m_flags >> StackChangeShift; - - public OperandType OperandType => (OperandType)(m_flags & OperandTypeMask); - - public FlowControl FlowControl => (FlowControl)((m_flags >> FlowControlShift) & FlowControlMask); - - public OpCodeType OpCodeType => (OpCodeType)((m_flags >> OpCodeTypeShift) & OpCodeTypeMask); - - public StackBehaviour StackBehaviourPop => (StackBehaviour)((m_flags >> StackBehaviourPopShift) & StackBehaviourMask); - - public StackBehaviour StackBehaviourPush => (StackBehaviour)((m_flags >> StackBehaviourPushShift) & StackBehaviourMask); - - public int Size => (m_flags >> SizeShift) & SizeMask; - - public short Value => (short)m_value; - - private static volatile string[]? g_nameCache; - - public string? Name - { - get - { - if (Size == 0) - return null; - - // Create and cache the opcode names lazily. They should be rarely used (only for logging, etc.) - // Note that we do not any locks here because of we always get the same names. The last one wins. - string[]? nameCache = g_nameCache; - if (nameCache == null) - { - nameCache = new string[0x11f]; - g_nameCache = nameCache; - } - - OpCodeValues opCodeValue = (OpCodeValues)(ushort)Value; - - int idx = (int)opCodeValue; - if (idx > 0xFF) - { - if (idx >= 0xfe00 && idx <= 0xfe1e) - { - // Transform two byte opcode value to lower range that's suitable - // for array index - idx = 0x100 + (idx - 0xfe00); - } - else - { - // Unknown opcode - return null; - } - } - - string name = Volatile.Read(ref nameCache[idx]); - if (name != null) - return name; - - // Create ilasm style name from the enum value name. - name = Enum.GetName(typeof(OpCodeValues), opCodeValue)!.ToLowerInvariant().Replace('_', '.'); - Volatile.Write(ref nameCache[idx], name); - return name; - } - } - - public override bool Equals(object? obj) => - obj is OpCode other && Equals(other); - - public bool Equals(OpCode obj) => obj.Value == Value; - - public static bool operator ==(OpCode a, OpCode b) => a.Equals(b); - - public static bool operator !=(OpCode a, OpCode b) => !(a == b); - - public override int GetHashCode() => Value; - - public override string? ToString() => Name; - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/Emit/OperandType.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/Emit/OperandType.cs deleted file mode 100644 index 8abf79b5d01..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/Emit/OperandType.cs +++ /dev/null @@ -1,39 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*============================================================ -** -** Enumeration: OperandType -** -** Purpose: Exposes OperandType Attribute of IL. -** -** THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT BY HAND! -** See $(RepoRoot)\src\inc\OpCodeGen.pl for more information.** -==============================================================*/ - -namespace System.Reflection.Emit -{ - public enum OperandType - { - InlineBrTarget = 0, - InlineField = 1, - InlineI = 2, - InlineI8 = 3, - InlineMethod = 4, - InlineNone = 5, - [Obsolete("This API has been deprecated. https://go.microsoft.com/fwlink/?linkid=14202")] - InlinePhi = 6, - InlineR = 7, - InlineSig = 9, - InlineString = 10, - InlineSwitch = 11, - InlineTok = 12, - InlineType = 13, - InlineVar = 14, - ShortInlineBrTarget = 15, - ShortInlineI = 16, - ShortInlineR = 17, - ShortInlineVar = 18, - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/Emit/PEFileKinds.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/Emit/PEFileKinds.cs deleted file mode 100644 index 8a35a72a85d..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/Emit/PEFileKinds.cs +++ /dev/null @@ -1,14 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Reflection.Emit -{ - // This Enum matchs the CorFieldAttr defined in CorHdr.h - public enum PEFileKinds - { - Dll = 0x0001, - ConsoleApplication = 0x0002, - WindowApplication = 0x0003, - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/Emit/PackingSize.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/Emit/PackingSize.cs deleted file mode 100644 index f734e1a3423..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/Emit/PackingSize.cs +++ /dev/null @@ -1,19 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Reflection.Emit -{ - public enum PackingSize - { - Unspecified = 0, - Size1 = 1, - Size2 = 2, - Size4 = 4, - Size8 = 8, - Size16 = 16, - Size32 = 32, - Size64 = 64, - Size128 = 128, - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/Emit/ParameterToken.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/Emit/ParameterToken.cs deleted file mode 100644 index b03ddf082e6..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/Emit/ParameterToken.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Reflection.Emit -{ - /// <summary> - /// The ParameterToken class is an opaque representation of the Token returned - /// by the Metadata to represent the parameter. - /// </summary> - public struct ParameterToken - { - public static readonly ParameterToken Empty = default; - - internal ParameterToken(int parameterToken) - { - Token = parameterToken; - } - - public int Token { get; } - - public override int GetHashCode() => Token; - - public override bool Equals(object? obj) => obj is ParameterToken pt && Equals(pt); - - public bool Equals(ParameterToken obj) => obj.Token == Token; - - public static bool operator ==(ParameterToken a, ParameterToken b) => a.Equals(b); - - public static bool operator !=(ParameterToken a, ParameterToken b) => !(a == b); - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/Emit/PropertyToken.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/Emit/PropertyToken.cs deleted file mode 100644 index 02d88ff79f6..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/Emit/PropertyToken.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Reflection.Emit -{ - public struct PropertyToken - { - public static readonly PropertyToken Empty = default; - - internal PropertyToken(int propertyToken) - { - Token = propertyToken; - } - - public int Token { get; } - - public override int GetHashCode() => Token; - - public override bool Equals(object? obj) => obj is PropertyToken pt && Equals(pt); - - public bool Equals(PropertyToken obj) => obj.Token == Token; - - public static bool operator ==(PropertyToken a, PropertyToken b) => a.Equals(b); - - public static bool operator !=(PropertyToken a, PropertyToken b) => !(a == b); - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/Emit/SignatureToken.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/Emit/SignatureToken.cs deleted file mode 100644 index 851dcd7ee4f..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/Emit/SignatureToken.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Reflection.Emit -{ - public struct SignatureToken - { - public static readonly SignatureToken Empty = default; - - internal SignatureToken(int signatureToken) - { - Token = signatureToken; - } - - public int Token { get; } - - public override int GetHashCode() => Token; - - public override bool Equals(object? obj) => obj is SignatureToken st && Equals(st); - - public bool Equals(SignatureToken obj) => obj.Token == Token; - - public static bool operator ==(SignatureToken a, SignatureToken b) => a.Equals(b); - - public static bool operator !=(SignatureToken a, SignatureToken b) => !(a == b); - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/Emit/StackBehaviour.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/Emit/StackBehaviour.cs deleted file mode 100644 index c3d27ad72be..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/Emit/StackBehaviour.cs +++ /dev/null @@ -1,49 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*============================================================ -** -** Enumeration: StackBehaviour -** -** Purpose: Exposes StackBehaviour Attribute of IL. -** -** THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT BY HAND! -** See $(RepoRoot)\src\inc\OpCodeGen.pl for more information.** -==============================================================*/ - -namespace System.Reflection.Emit -{ - public enum StackBehaviour - { - Pop0 = 0, - Pop1 = 1, - Pop1_pop1 = 2, - Popi = 3, - Popi_pop1 = 4, - Popi_popi = 5, - Popi_popi8 = 6, - Popi_popi_popi = 7, - Popi_popr4 = 8, - Popi_popr8 = 9, - Popref = 10, - Popref_pop1 = 11, - Popref_popi = 12, - Popref_popi_popi = 13, - Popref_popi_popi8 = 14, - Popref_popi_popr4 = 15, - Popref_popi_popr8 = 16, - Popref_popi_popref = 17, - Push0 = 18, - Push1 = 19, - Push1_push1 = 20, - Pushi = 21, - Pushi8 = 22, - Pushr4 = 23, - Pushr8 = 24, - Pushref = 25, - Varpop = 26, - Varpush = 27, - Popref_popi_pop1 = 28, - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/Emit/StringToken.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/Emit/StringToken.cs deleted file mode 100644 index 0c2797a51c1..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/Emit/StringToken.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Reflection.Emit -{ - public struct StringToken - { - internal StringToken(int str) - { - Token = str; - } - - // Returns the metadata token for this particular string. - // Generated by a call to Module.GetStringConstant(). - // - public int Token { get; } - - public override int GetHashCode() => Token; - - public override bool Equals(object? obj) => obj is StringToken st && Equals(st); - - public bool Equals(StringToken obj) => obj.Token == Token; - - public static bool operator ==(StringToken a, StringToken b) => a.Equals(b); - - public static bool operator !=(StringToken a, StringToken b) => !(a == b); - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/Emit/TypeToken.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/Emit/TypeToken.cs deleted file mode 100644 index 099b9e84729..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/Emit/TypeToken.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Reflection.Emit -{ - public struct TypeToken - { - public static readonly TypeToken Empty = default; - - internal TypeToken(int typeToken) - { - Token = typeToken; - } - - public int Token { get; } - - public override int GetHashCode() => Token; - - public override bool Equals(object? obj) => obj is TypeToken tt && Equals(tt); - - public bool Equals(TypeToken obj) => obj.Token == Token; - - public static bool operator ==(TypeToken a, TypeToken b) => a.Equals(b); - - public static bool operator !=(TypeToken a, TypeToken b) => !(a == b); - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/EventAttributes.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/EventAttributes.cs deleted file mode 100644 index fbc2972f697..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/EventAttributes.cs +++ /dev/null @@ -1,22 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -// EventAttributes are an enum defining the attributes associated with and Event. -// These are defined in CorHdr.h and are a combination of bits and enums. - -namespace System.Reflection -{ - [Flags] - public enum EventAttributes - { - None = 0x0000, - - // This Enum matchs the CorEventAttr defined in CorHdr.h - SpecialName = 0x0200, // event is special. Name describes how. - - RTSpecialName = 0x0400, // Runtime(metadata internal APIs) should check name encoding. - - ReservedMask = 0x0400, - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/EventInfo.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/EventInfo.cs deleted file mode 100644 index 789352a16c8..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/EventInfo.cs +++ /dev/null @@ -1,125 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Diagnostics; -using System.Runtime.CompilerServices; - -#if FEATURE_COMINTEROP -using EventRegistrationToken = System.Runtime.InteropServices.WindowsRuntime.EventRegistrationToken; -#endif //#if FEATURE_COMINTEROP - -namespace System.Reflection -{ - public abstract class EventInfo : MemberInfo - { - protected EventInfo() { } - - public override MemberTypes MemberType => MemberTypes.Event; - - public abstract EventAttributes Attributes { get; } - public bool IsSpecialName => (Attributes & EventAttributes.SpecialName) != 0; - - public MethodInfo[] GetOtherMethods() => GetOtherMethods(nonPublic: false); - public virtual MethodInfo[] GetOtherMethods(bool nonPublic) { throw NotImplemented.ByDesign; } - - public virtual MethodInfo? AddMethod => GetAddMethod(nonPublic: true); - public virtual MethodInfo? RemoveMethod => GetRemoveMethod(nonPublic: true); - public virtual MethodInfo? RaiseMethod => GetRaiseMethod(nonPublic: true); - - public MethodInfo? GetAddMethod() => GetAddMethod(nonPublic: false); - public MethodInfo? GetRemoveMethod() => GetRemoveMethod(nonPublic: false); - public MethodInfo? GetRaiseMethod() => GetRaiseMethod(nonPublic: false); - - public abstract MethodInfo? GetAddMethod(bool nonPublic); - public abstract MethodInfo? GetRemoveMethod(bool nonPublic); - public abstract MethodInfo? GetRaiseMethod(bool nonPublic); - - public virtual bool IsMulticast - { - get - { - Type? cl = EventHandlerType; - Type mc = typeof(MulticastDelegate); - return mc.IsAssignableFrom(cl); - } - } - - public virtual Type? EventHandlerType - { - get - { - MethodInfo m = GetAddMethod(true)!; - ParameterInfo[] p = m.GetParametersNoCopy(); - Type del = typeof(Delegate); - for (int i = 0; i < p.Length; i++) - { - Type c = p[i].ParameterType; - if (c.IsSubclassOf(del)) - return c; - } - return null; - } - } - - [DebuggerHidden] - [DebuggerStepThrough] - public virtual void AddEventHandler(object? target, Delegate? handler) - { - MethodInfo? addMethod = GetAddMethod(nonPublic: false); - - if (addMethod == null) - throw new InvalidOperationException(SR.InvalidOperation_NoPublicAddMethod); - -#if FEATURE_COMINTEROP - if (addMethod.ReturnType == typeof(EventRegistrationToken)) - throw new InvalidOperationException(SR.InvalidOperation_NotSupportedOnWinRTEvent); -#endif //#if FEATURE_COMINTEROP - - addMethod.Invoke(target, new object?[] { handler }); - } - - [DebuggerHidden] - [DebuggerStepThrough] - public virtual void RemoveEventHandler(object? target, Delegate? handler) - { - MethodInfo? removeMethod = GetRemoveMethod(nonPublic: false); - - if (removeMethod == null) - throw new InvalidOperationException(SR.InvalidOperation_NoPublicRemoveMethod); - -#if FEATURE_COMINTEROP - ParameterInfo[] parameters = removeMethod.GetParametersNoCopy(); - if (parameters[0].ParameterType == typeof(EventRegistrationToken)) - throw new InvalidOperationException(SR.InvalidOperation_NotSupportedOnWinRTEvent); -#endif //#if FEATURE_COMINTEROP - - removeMethod.Invoke(target, new object?[] { handler }); - } - - public override bool Equals(object? obj) => base.Equals(obj); - public override int GetHashCode() => base.GetHashCode(); - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool operator ==(EventInfo? left, EventInfo? right) - { - // Test "right" first to allow branch elimination when inlined for null checks (== null) - // so it can become a simple test - if (right is null) - { - // return true/false not the test result https://github.com/dotnet/coreclr/issues/914 - return (left is null) ? true : false; - } - - // Try fast reference equality and opposite null check prior to calling the slower virtual Equals - if ((object?)left == (object)right) - { - return true; - } - - return (left is null) ? false : left.Equals(right); - } - - public static bool operator !=(EventInfo? left, EventInfo? right) => !(left == right); - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/ExceptionHandlingClause.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/ExceptionHandlingClause.cs deleted file mode 100644 index 543db08cccd..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/ExceptionHandlingClause.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Globalization; - -namespace System.Reflection -{ - public class ExceptionHandlingClause - { - protected ExceptionHandlingClause() { } - public virtual ExceptionHandlingClauseOptions Flags => default; - public virtual int TryOffset => 0; - public virtual int TryLength => 0; - public virtual int HandlerOffset => 0; - public virtual int HandlerLength => 0; - public virtual int FilterOffset => throw new InvalidOperationException(SR.Arg_EHClauseNotFilter); - public virtual Type? CatchType => null; - - public override string ToString() - { - return string.Format(CultureInfo.CurrentUICulture, - "Flags={0}, TryOffset={1}, TryLength={2}, HandlerOffset={3}, HandlerLength={4}, CatchType={5}", - Flags, TryOffset, TryLength, HandlerOffset, HandlerLength, CatchType); - } - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/ExceptionHandlingClauseOptions.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/ExceptionHandlingClauseOptions.cs deleted file mode 100644 index f121e350594..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/ExceptionHandlingClauseOptions.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Reflection -{ - [Flags] - public enum ExceptionHandlingClauseOptions : int - { - Clause = 0x0, - Filter = 0x1, - Finally = 0x2, - Fault = 0x4, - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/FieldAttributes.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/FieldAttributes.cs deleted file mode 100644 index 395763e8a60..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/FieldAttributes.cs +++ /dev/null @@ -1,40 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Reflection -{ - // This Enum matchs the CorFieldAttr defined in CorHdr.h - [Flags] - public enum FieldAttributes - { - // member access mask - Use this mask to retrieve accessibility information. - FieldAccessMask = 0x0007, - PrivateScope = 0x0000, // Member not referenceable. - Private = 0x0001, // Accessible only by the parent type. - FamANDAssem = 0x0002, // Accessible by sub-types only in this Assembly. - Assembly = 0x0003, // Accessibly by anyone in the Assembly. - Family = 0x0004, // Accessible only by type and sub-types. - FamORAssem = 0x0005, // Accessibly by sub-types anywhere, plus anyone in assembly. - Public = 0x0006, // Accessibly by anyone who has visibility to this scope. - // end member access mask - - // field contract attributes. - Static = 0x0010, // Defined on type, else per instance. - InitOnly = 0x0020, // Field may only be initialized, not written to after init. - Literal = 0x0040, // Value is compile time constant. - NotSerialized = 0x0080, // Field does not have to be serialized when type is remoted. - - SpecialName = 0x0200, // field is special. Name describes how. - - // interop attributes - PinvokeImpl = 0x2000, // Implementation is forwarded through pinvoke. - - RTSpecialName = 0x0400, // Runtime(metadata internal APIs) should check name encoding. - HasFieldMarshal = 0x1000, // Field has marshalling information. - HasDefault = 0x8000, // Field has default. - HasFieldRVA = 0x0100, // Field has RVA. - - ReservedMask = 0x9500, - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/FieldInfo.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/FieldInfo.cs deleted file mode 100644 index cbb04d54a42..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/FieldInfo.cs +++ /dev/null @@ -1,82 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Diagnostics; -using System.Globalization; -using System.Runtime.CompilerServices; - -namespace System.Reflection -{ - public abstract partial class FieldInfo : MemberInfo - { - protected FieldInfo() { } - - public override MemberTypes MemberType => MemberTypes.Field; - - public abstract FieldAttributes Attributes { get; } - public abstract Type FieldType { get; } - - public bool IsInitOnly => (Attributes & FieldAttributes.InitOnly) != 0; - public bool IsLiteral => (Attributes & FieldAttributes.Literal) != 0; - public bool IsNotSerialized => (Attributes & FieldAttributes.NotSerialized) != 0; - public bool IsPinvokeImpl => (Attributes & FieldAttributes.PinvokeImpl) != 0; - public bool IsSpecialName => (Attributes & FieldAttributes.SpecialName) != 0; - public bool IsStatic => (Attributes & FieldAttributes.Static) != 0; - - public bool IsAssembly => (Attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.Assembly; - public bool IsFamily => (Attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.Family; - public bool IsFamilyAndAssembly => (Attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.FamANDAssem; - public bool IsFamilyOrAssembly => (Attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.FamORAssem; - public bool IsPrivate => (Attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.Private; - public bool IsPublic => (Attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.Public; - - public virtual bool IsSecurityCritical => true; - public virtual bool IsSecuritySafeCritical => false; - public virtual bool IsSecurityTransparent => false; - - public abstract RuntimeFieldHandle FieldHandle { get; } - - public override bool Equals(object? obj) => base.Equals(obj); - public override int GetHashCode() => base.GetHashCode(); - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool operator ==(FieldInfo? left, FieldInfo? right) - { - // Test "right" first to allow branch elimination when inlined for null checks (== null) - // so it can become a simple test - if (right is null) - { - // return true/false not the test result https://github.com/dotnet/coreclr/issues/914 - return (left is null) ? true : false; - } - - // Try fast reference equality and opposite null check prior to calling the slower virtual Equals - if ((object?)left == (object)right) - { - return true; - } - - return (left is null) ? false : left.Equals(right); - } - - public static bool operator !=(FieldInfo? left, FieldInfo? right) => !(left == right); - - public abstract object? GetValue(object? obj); - - [DebuggerHidden] - [DebuggerStepThrough] - public void SetValue(object? obj, object? value) => SetValue(obj, value, BindingFlags.Default, Type.DefaultBinder, null); - public abstract void SetValue(object? obj, object? value, BindingFlags invokeAttr, Binder? binder, CultureInfo? culture); - - [CLSCompliant(false)] - public virtual void SetValueDirect(TypedReference obj, object value) { throw new NotSupportedException(SR.NotSupported_AbstractNonCLS); } - [CLSCompliant(false)] - public virtual object? GetValueDirect(TypedReference obj) { throw new NotSupportedException(SR.NotSupported_AbstractNonCLS); } - - public virtual object? GetRawConstantValue() { throw new NotSupportedException(SR.NotSupported_AbstractNonCLS); } - - public virtual Type[] GetOptionalCustomModifiers() { throw NotImplemented.ByDesign; } - public virtual Type[] GetRequiredCustomModifiers() { throw NotImplemented.ByDesign; } - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/GenericParameterAttributes.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/GenericParameterAttributes.cs deleted file mode 100644 index f672dc4f91c..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/GenericParameterAttributes.cs +++ /dev/null @@ -1,19 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Reflection -{ - [Flags] - public enum GenericParameterAttributes - { - None = 0x0000, - VarianceMask = 0x0003, - Covariant = 0x0001, - Contravariant = 0x0002, - SpecialConstraintMask = 0x001C, - ReferenceTypeConstraint = 0x0004, - NotNullableValueTypeConstraint = 0x0008, - DefaultConstructorConstraint = 0x0010, - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/ICustomAttributeProvider.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/ICustomAttributeProvider.cs deleted file mode 100644 index 3cae295bc49..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/ICustomAttributeProvider.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Reflection -{ - public interface ICustomAttributeProvider - { - object[] GetCustomAttributes(bool inherit); - object[] GetCustomAttributes(Type attributeType, bool inherit); - bool IsDefined(Type attributeType, bool inherit); - } -}
\ No newline at end of file diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/IReflect.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/IReflect.cs deleted file mode 100644 index 643c6eb17b1..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/IReflect.cs +++ /dev/null @@ -1,76 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Globalization; - -namespace System.Reflection -{ - public interface IReflect - { - // Return the requested method if it is implemented by the Reflection object. The - // match is based upon the name and DescriptorInfo which describes the signature - // of the method. - MethodInfo? GetMethod(string name, BindingFlags bindingAttr, Binder? binder, Type[] types, ParameterModifier[]? modifiers); - - // Return the requested method if it is implemented by the Reflection object. The - // match is based upon the name of the method. If the object implementes multiple methods - // with the same name an AmbiguousMatchException is thrown. - MethodInfo? GetMethod(string name, BindingFlags bindingAttr); - - MethodInfo[] GetMethods(BindingFlags bindingAttr); - - // Return the requestion field if it is implemented by the Reflection object. The - // match is based upon a name. There cannot be more than a single field with - // a name. - FieldInfo? GetField(string name, BindingFlags bindingAttr); - - FieldInfo[] GetFields(BindingFlags bindingAttr); - - // Return the property based upon name. If more than one property has the given - // name an AmbiguousMatchException will be thrown. Returns null if no property - // is found. - PropertyInfo? GetProperty(string name, BindingFlags bindingAttr); - - // Return the property based upon the name and Descriptor info describing the property - // indexing. Return null if no property is found. - PropertyInfo? GetProperty(string name, BindingFlags bindingAttr, Binder? binder, Type? returnType, Type[] types, ParameterModifier[]? modifiers); - - // Returns an array of PropertyInfos for all the properties defined on - // the Reflection object. - PropertyInfo[] GetProperties(BindingFlags bindingAttr); - - // Return an array of members which match the passed in name. - MemberInfo[] GetMember(string name, BindingFlags bindingAttr); - - // Return an array of all of the members defined for this object. - MemberInfo[] GetMembers(BindingFlags bindingAttr); - - // Description of the Binding Process. - // We must invoke a method that is accessible and for which the provided - // parameters have the most specific match. A method may be called if - // 1. The number of parameters in the method declaration equals the number of - // arguments provided to the invocation - // 2. The type of each argument can be converted by the binder to the - // type of the type of the parameter. - // - // The binder will find all of the matching methods. These method are found based - // upon the type of binding requested (MethodInvoke, Get/Set Properties). The set - // of methods is filtered by the name, number of arguments and a set of search modifiers - // defined in the Binder. - // - // After the method is selected, it will be invoked. Accessibility is checked - // at that point. The search may be control which set of methods are searched based - // upon the accessibility attribute associated with the method. - // - // The BindToMethod method is responsible for selecting the method to be invoked. - // For the default binder, the most specific method will be selected. - // - // This will invoke a specific member... - object? InvokeMember(string name, BindingFlags invokeAttr, Binder? binder, object? target, object?[]? args, ParameterModifier[]? modifiers, CultureInfo? culture, string[]? namedParameters); - - // Return the underlying Type that represents the IReflect Object. For expando object, - // this is the (Object) IReflectInstance.GetType(). For Type object it is this. - Type UnderlyingSystemType { get; } - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/IReflectableType.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/IReflectableType.cs deleted file mode 100644 index f3ba94b2c85..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/IReflectableType.cs +++ /dev/null @@ -1,11 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Reflection -{ - public interface IReflectableType - { - TypeInfo GetTypeInfo(); - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/ImageFileMachine.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/ImageFileMachine.cs deleted file mode 100644 index a38cd9509dd..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/ImageFileMachine.cs +++ /dev/null @@ -1,14 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Reflection -{ - public enum ImageFileMachine - { - I386 = 0x014c, - IA64 = 0x0200, - AMD64 = 0x8664, - ARM = 0x01c4, - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/InterfaceMapping.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/InterfaceMapping.cs deleted file mode 100644 index 2e0c0d8a28e..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/InterfaceMapping.cs +++ /dev/null @@ -1,14 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Reflection -{ - public struct InterfaceMapping - { - public Type TargetType; // The type implementing the interface - public Type InterfaceType; // The type representing the interface - public MethodInfo[] TargetMethods; // The methods implementing the interface - public MethodInfo[] InterfaceMethods; // The methods defined on the interface - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/IntrospectionExtensions.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/IntrospectionExtensions.cs deleted file mode 100644 index d9674f94b26..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/IntrospectionExtensions.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Reflection -{ - public static class IntrospectionExtensions - { - public static TypeInfo GetTypeInfo(this Type type) - { - if (type == null) - throw new ArgumentNullException(nameof(type)); - - if (type is IReflectableType reflectableType) - return reflectableType.GetTypeInfo(); - - return new TypeDelegator(type); - } - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/InvalidFilterCriteriaException.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/InvalidFilterCriteriaException.cs deleted file mode 100644 index 7c9093b9559..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/InvalidFilterCriteriaException.cs +++ /dev/null @@ -1,34 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Runtime.Serialization; - -namespace System.Reflection -{ - [Serializable] - [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] - public class InvalidFilterCriteriaException : ApplicationException - { - public InvalidFilterCriteriaException() - : this(SR.Arg_InvalidFilterCriteriaException) - { - } - - public InvalidFilterCriteriaException(string? message) - : this(message, null) - { - } - - public InvalidFilterCriteriaException(string? message, Exception? inner) - : base(message, inner) - { - HResult = HResults.COR_E_INVALIDFILTERCRITERIA; - } - - protected InvalidFilterCriteriaException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/LocalVariableInfo.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/LocalVariableInfo.cs deleted file mode 100644 index 09671e35c83..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/LocalVariableInfo.cs +++ /dev/null @@ -1,25 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Diagnostics; - -namespace System.Reflection -{ - public class LocalVariableInfo - { - public virtual Type LocalType { get { Debug.Fail("type must be set!"); return null!; } } - public virtual int LocalIndex => 0; - public virtual bool IsPinned => false; - protected LocalVariableInfo() { } - public override string ToString() - { - string toString = LocalType.ToString() + " (" + LocalIndex + ")"; - - if (IsPinned) - toString += " (pinned)"; - - return toString; - } - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/ManifestResourceInfo.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/ManifestResourceInfo.cs deleted file mode 100644 index 584e1361e4f..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/ManifestResourceInfo.cs +++ /dev/null @@ -1,22 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Reflection -{ - public class ManifestResourceInfo - { - public ManifestResourceInfo(Assembly containingAssembly, - string containingFileName, - ResourceLocation resourceLocation) - { - ReferencedAssembly = containingAssembly; - FileName = containingFileName; - ResourceLocation = resourceLocation; - } - - public virtual Assembly ReferencedAssembly { get; } - public virtual string FileName { get; } - public virtual ResourceLocation ResourceLocation { get; } - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/MemberFilter.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/MemberFilter.cs deleted file mode 100644 index 07198cbc4e0..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/MemberFilter.cs +++ /dev/null @@ -1,8 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Reflection -{ - public delegate bool MemberFilter(MemberInfo m, object? filterCriteria); -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/MemberInfo.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/MemberInfo.cs deleted file mode 100644 index 4c7316ff9eb..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/MemberInfo.cs +++ /dev/null @@ -1,69 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Collections.Generic; -using System.Runtime.CompilerServices; - -namespace System.Reflection -{ - public abstract partial class MemberInfo : ICustomAttributeProvider - { - protected MemberInfo() { } - - public abstract MemberTypes MemberType { get; } - public abstract string Name { get; } - public abstract Type? DeclaringType { get; } - public abstract Type? ReflectedType { get; } - - public virtual Module Module - { - get - { - // This check is necessary because for some reason, Type adds a new "Module" property that hides the inherited one instead - // of overriding. - - if (this is Type type) - return type.Module; - - throw NotImplemented.ByDesign; - } - } - - public virtual bool HasSameMetadataDefinitionAs(MemberInfo other) { throw NotImplemented.ByDesign; } - - public abstract bool IsDefined(Type attributeType, bool inherit); - public abstract object[] GetCustomAttributes(bool inherit); - public abstract object[] GetCustomAttributes(Type attributeType, bool inherit); - - public virtual IEnumerable<CustomAttributeData> CustomAttributes => GetCustomAttributesData(); - public virtual IList<CustomAttributeData> GetCustomAttributesData() { throw NotImplemented.ByDesign; } - public virtual bool IsCollectible => true; - public virtual int MetadataToken => throw new InvalidOperationException(); - - public override bool Equals(object? obj) => base.Equals(obj); - public override int GetHashCode() => base.GetHashCode(); - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool operator ==(MemberInfo? left, MemberInfo? right) - { - // Test "right" first to allow branch elimination when inlined for null checks (== null) - // so it can become a simple test - if (right is null) - { - // return true/false not the test result https://github.com/dotnet/coreclr/issues/914 - return (left is null) ? true : false; - } - - // Try fast reference equality and opposite null check prior to calling the slower virtual Equals - if ((object?)left == (object)right) - { - return true; - } - - return (left is null) ? false : left.Equals(right); - } - - public static bool operator !=(MemberInfo? left, MemberInfo? right) => !(left == right); - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/MemberTypes.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/MemberTypes.cs deleted file mode 100644 index f73892e0a16..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/MemberTypes.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Reflection -{ - [Flags] - public enum MemberTypes - { - Constructor = 0x01, - Event = 0x02, - Field = 0x04, - Method = 0x08, - Property = 0x10, - TypeInfo = 0x20, - Custom = 0x40, - NestedType = 0x80, - All = Constructor | Event | Field | Method | Property | TypeInfo | NestedType, - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/MethodAttributes.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/MethodAttributes.cs deleted file mode 100644 index 569ba9685c7..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/MethodAttributes.cs +++ /dev/null @@ -1,50 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Reflection -{ - [Flags] - public enum MethodAttributes - { - // NOTE: This Enum matchs the CorMethodAttr defined in CorHdr.h - - // member access mask - Use this mask to retrieve accessibility information. - MemberAccessMask = 0x0007, - PrivateScope = 0x0000, // Member not referenceable. - Private = 0x0001, // Accessible only by the parent type. - FamANDAssem = 0x0002, // Accessible by sub-types only in this Assembly. - Assembly = 0x0003, // Accessibly by anyone in the Assembly. - Family = 0x0004, // Accessible only by type and sub-types. - FamORAssem = 0x0005, // Accessibly by sub-types anywhere, plus anyone in assembly. - Public = 0x0006, // Accessibly by anyone who has visibility to this scope. - // end member access mask - - // method contract attributes. - Static = 0x0010, // Defined on type, else per instance. - Final = 0x0020, // Method may not be overridden. - Virtual = 0x0040, // Method virtual. - HideBySig = 0x0080, // Method hides by name+sig, else just by name. - CheckAccessOnOverride = 0x0200, - - // vtable layout mask - Use this mask to retrieve vtable attributes. - VtableLayoutMask = 0x0100, - ReuseSlot = 0x0000, // The default. - NewSlot = 0x0100, // Method always gets a new slot in the vtable. - // end vtable layout mask - - // method implementation attributes. - Abstract = 0x0400, // Method does not provide an implementation. - SpecialName = 0x0800, // Method is special. Name describes how. - - // interop attributes - PinvokeImpl = 0x2000, // Implementation is forwarded through pinvoke. - UnmanagedExport = 0x0008, // Managed method exported via thunk to unmanaged code. - RTSpecialName = 0x1000, // Runtime should check name encoding. - - HasSecurity = 0x4000, // Method has security associate with it. - RequireSecObject = 0x8000, // Method calls another method containing security code. - - ReservedMask = 0xd000, - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/MethodBase.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/MethodBase.cs deleted file mode 100644 index d737ccff3c9..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/MethodBase.cs +++ /dev/null @@ -1,121 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Globalization; -using System.Diagnostics; -using System.Runtime.CompilerServices; -using System.Text; - -namespace System.Reflection -{ - public abstract partial class MethodBase : MemberInfo - { - protected MethodBase() { } - - public abstract ParameterInfo[] GetParameters(); - public abstract MethodAttributes Attributes { get; } - public virtual MethodImplAttributes MethodImplementationFlags => GetMethodImplementationFlags(); - public abstract MethodImplAttributes GetMethodImplementationFlags(); - public virtual MethodBody? GetMethodBody() { throw new InvalidOperationException(); } - public virtual CallingConventions CallingConvention => CallingConventions.Standard; - - public bool IsAbstract => (Attributes & MethodAttributes.Abstract) != 0; - public bool IsConstructor => - // To be backward compatible we only return true for instance RTSpecialName ctors. - this is ConstructorInfo && - !IsStatic && - (Attributes & MethodAttributes.RTSpecialName) == MethodAttributes.RTSpecialName; - public bool IsFinal => (Attributes & MethodAttributes.Final) != 0; - public bool IsHideBySig => (Attributes & MethodAttributes.HideBySig) != 0; - public bool IsSpecialName => (Attributes & MethodAttributes.SpecialName) != 0; - public bool IsStatic => (Attributes & MethodAttributes.Static) != 0; - public bool IsVirtual => (Attributes & MethodAttributes.Virtual) != 0; - - public bool IsAssembly => (Attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.Assembly; - public bool IsFamily => (Attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.Family; - public bool IsFamilyAndAssembly => (Attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.FamANDAssem; - public bool IsFamilyOrAssembly => (Attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.FamORAssem; - public bool IsPrivate => (Attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.Private; - public bool IsPublic => (Attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.Public; - - public virtual bool IsConstructedGenericMethod => IsGenericMethod && !IsGenericMethodDefinition; - public virtual bool IsGenericMethod => false; - public virtual bool IsGenericMethodDefinition => false; - public virtual Type[] GetGenericArguments() { throw new NotSupportedException(SR.NotSupported_SubclassOverride); } - public virtual bool ContainsGenericParameters => false; - - [DebuggerHidden] - [DebuggerStepThrough] - public object? Invoke(object? obj, object?[]? parameters) => Invoke(obj, BindingFlags.Default, binder: null, parameters: parameters, culture: null); - public abstract object? Invoke(object? obj, BindingFlags invokeAttr, Binder? binder, object?[]? parameters, CultureInfo? culture); - - public abstract RuntimeMethodHandle MethodHandle { get; } - - public virtual bool IsSecurityCritical => throw NotImplemented.ByDesign; - public virtual bool IsSecuritySafeCritical => throw NotImplemented.ByDesign; - public virtual bool IsSecurityTransparent => throw NotImplemented.ByDesign; - - public override bool Equals(object? obj) => base.Equals(obj); - public override int GetHashCode() => base.GetHashCode(); - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool operator ==(MethodBase? left, MethodBase? right) - { - // Test "right" first to allow branch elimination when inlined for null checks (== null) - // so it can become a simple test - if (right is null) - { - // return true/false not the test result https://github.com/dotnet/coreclr/issues/914 - return (left is null) ? true : false; - } - - // Try fast reference equality and opposite null check prior to calling the slower virtual Equals - if ((object?)left == (object)right) - { - return true; - } - - return (left is null) ? false : left.Equals(right); - } - - public static bool operator !=(MethodBase? left, MethodBase? right) => !(left == right); - - internal const int MethodNameBufferSize = 100; - - internal static void AppendParameters(ref ValueStringBuilder sbParamList, Type[] parameterTypes, CallingConventions callingConvention) - { - string comma = ""; - - for (int i = 0; i < parameterTypes.Length; i++) - { - Type t = parameterTypes[i]; - - sbParamList.Append(comma); - - string typeName = t.FormatTypeName(); - - // Legacy: Why use "ByRef" for by ref parameters? What language is this? - // VB uses "ByRef" but it should precede (not follow) the parameter name. - // Why don't we just use "&"? - if (t.IsByRef) - { - sbParamList.Append(typeName.AsSpan().TrimEnd('&')); - sbParamList.Append(" ByRef"); - } - else - { - sbParamList.Append(typeName); - } - - comma = ", "; - } - - if ((callingConvention & CallingConventions.VarArgs) == CallingConventions.VarArgs) - { - sbParamList.Append(comma); - sbParamList.Append("..."); - } - } - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/MethodBody.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/MethodBody.cs deleted file mode 100644 index 1f05ef5b057..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/MethodBody.cs +++ /dev/null @@ -1,19 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Collections.Generic; - -namespace System.Reflection -{ - public class MethodBody - { - protected MethodBody() { } - public virtual int LocalSignatureMetadataToken => 0; - public virtual IList<LocalVariableInfo> LocalVariables => throw new ArgumentNullException("array"); - public virtual int MaxStackSize => 0; - public virtual bool InitLocals => false; - public virtual byte[]? GetILAsByteArray() => null; - public virtual IList<ExceptionHandlingClause> ExceptionHandlingClauses => throw new ArgumentNullException("array"); - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/MethodImplAttributes.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/MethodImplAttributes.cs deleted file mode 100644 index 7cdb5eaf35f..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/MethodImplAttributes.cs +++ /dev/null @@ -1,38 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Reflection -{ - // This Enum matchs the CorMethodImpl defined in CorHdr.h - public enum MethodImplAttributes - { - // code impl mask - CodeTypeMask = 0x0003, // Flags about code type. - IL = 0x0000, // Method impl is IL. - Native = 0x0001, // Method impl is native. - OPTIL = 0x0002, // Method impl is OPTIL - Runtime = 0x0003, // Method impl is provided by the runtime. - // end code impl mask - - // managed mask - ManagedMask = 0x0004, // Flags specifying whether the code is managed or unmanaged. - Unmanaged = 0x0004, // Method impl is unmanaged, otherwise managed. - Managed = 0x0000, // Method impl is managed. - // end managed mask - - // implementation info and interop - ForwardRef = 0x0010, // Indicates method is not defined; used primarily in merge scenarios. - PreserveSig = 0x0080, // Indicates method sig is exported exactly as declared. - - InternalCall = 0x1000, // Internal Call... - - Synchronized = 0x0020, // Method is single threaded through the body. - NoInlining = 0x0008, // Method may not be inlined. - AggressiveInlining = 0x0100, // Method should be inlined if possible. - NoOptimization = 0x0040, // Method may not be optimized. - AggressiveOptimization = 0x0200, // Method may contain hot code and should be aggressively optimized. - - MaxMethodImplVal = 0xffff, - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/MethodInfo.Internal.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/MethodInfo.Internal.cs deleted file mode 100644 index 8bb66968ddb..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/MethodInfo.Internal.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Reflection -{ - public abstract partial class MethodInfo : MethodBase - { -#if CORERT - public // Needs to be public so that Reflection.Core can see it. -#else - internal -#endif - virtual int GenericParameterCount => GetGenericArguments().Length; - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/MethodInfo.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/MethodInfo.cs deleted file mode 100644 index b274a656e44..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/MethodInfo.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Runtime.CompilerServices; - -namespace System.Reflection -{ - public abstract partial class MethodInfo : MethodBase - { - protected MethodInfo() { } - - public override MemberTypes MemberType => MemberTypes.Method; - - public virtual ParameterInfo ReturnParameter => throw NotImplemented.ByDesign; - public virtual Type ReturnType => throw NotImplemented.ByDesign; - - public override Type[] GetGenericArguments() { throw new NotSupportedException(SR.NotSupported_SubclassOverride); } - public virtual MethodInfo GetGenericMethodDefinition() { throw new NotSupportedException(SR.NotSupported_SubclassOverride); } - public virtual MethodInfo MakeGenericMethod(params Type[] typeArguments) { throw new NotSupportedException(SR.NotSupported_SubclassOverride); } - - public abstract MethodInfo GetBaseDefinition(); - - public abstract ICustomAttributeProvider ReturnTypeCustomAttributes { get; } - - public virtual Delegate CreateDelegate(Type delegateType) { throw new NotSupportedException(SR.NotSupported_SubclassOverride); } - public virtual Delegate CreateDelegate(Type delegateType, object? target) { throw new NotSupportedException(SR.NotSupported_SubclassOverride); } - - public override bool Equals(object? obj) => base.Equals(obj); - public override int GetHashCode() => base.GetHashCode(); - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool operator ==(MethodInfo? left, MethodInfo? right) - { - // Test "right" first to allow branch elimination when inlined for null checks (== null) - // so it can become a simple test - if (right is null) - { - // return true/false not the test result https://github.com/dotnet/coreclr/issues/914 - return (left is null) ? true : false; - } - - // Try fast reference equality and opposite null check prior to calling the slower virtual Equals - if ((object?)left == (object)right) - { - return true; - } - - return (left is null) ? false : left.Equals(right); - } - - public static bool operator !=(MethodInfo? left, MethodInfo? right) => !(left == right); - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/Missing.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/Missing.cs deleted file mode 100644 index 46ab32fccf6..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/Missing.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Runtime.Serialization; - -namespace System.Reflection -{ - public sealed class Missing : ISerializable - { - public static readonly Missing Value = new Missing(); - - private Missing() { } - - void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) - { - throw new PlatformNotSupportedException(); - } - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/Module.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/Module.cs deleted file mode 100644 index 07ac2613526..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/Module.cs +++ /dev/null @@ -1,168 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Collections.Generic; -using System.Runtime.CompilerServices; -using System.Runtime.Serialization; - -namespace System.Reflection -{ - public abstract partial class Module : ICustomAttributeProvider, ISerializable - { - protected Module() { } - - public virtual Assembly Assembly => throw NotImplemented.ByDesign; - public virtual string FullyQualifiedName => throw NotImplemented.ByDesign; - public virtual string Name => throw NotImplemented.ByDesign; - - public virtual int MDStreamVersion => throw NotImplemented.ByDesign; - public virtual Guid ModuleVersionId => throw NotImplemented.ByDesign; - public virtual string ScopeName => throw NotImplemented.ByDesign; - public ModuleHandle ModuleHandle => GetModuleHandleImpl(); - protected virtual ModuleHandle GetModuleHandleImpl() => ModuleHandle.EmptyHandle; // Not an api but declared protected because of Reflection.Core/Corelib divide (when built by CoreRt) - public virtual void GetPEKind(out PortableExecutableKinds peKind, out ImageFileMachine machine) { throw NotImplemented.ByDesign; } - public virtual bool IsResource() { throw NotImplemented.ByDesign; } - - public virtual bool IsDefined(Type attributeType, bool inherit) { throw NotImplemented.ByDesign; } - public virtual IEnumerable<CustomAttributeData> CustomAttributes => GetCustomAttributesData(); - public virtual IList<CustomAttributeData> GetCustomAttributesData() { throw NotImplemented.ByDesign; } - public virtual object[] GetCustomAttributes(bool inherit) { throw NotImplemented.ByDesign; } - public virtual object[] GetCustomAttributes(Type attributeType, bool inherit) { throw NotImplemented.ByDesign; } - - public MethodInfo? GetMethod(string name) - { - if (name == null) - throw new ArgumentNullException(nameof(name)); - - return GetMethodImpl(name, Module.DefaultLookup, null, CallingConventions.Any, null, null); - } - - public MethodInfo? GetMethod(string name, Type[] types) => GetMethod(name, Module.DefaultLookup, null, CallingConventions.Any, types, null); - public MethodInfo? GetMethod(string name, BindingFlags bindingAttr, Binder? binder, CallingConventions callConvention, Type[] types, ParameterModifier[]? modifiers) - { - if (name == null) - throw new ArgumentNullException(nameof(name)); - if (types == null) - throw new ArgumentNullException(nameof(types)); - for (int i = 0; i < types.Length; i++) - { - if (types[i] == null) - throw new ArgumentNullException(nameof(types)); - } - return GetMethodImpl(name, bindingAttr, binder, callConvention, types, modifiers); - } - - protected virtual MethodInfo? GetMethodImpl(string name, BindingFlags bindingAttr, Binder? binder, CallingConventions callConvention, Type[]? types, ParameterModifier[]? modifiers) { throw NotImplemented.ByDesign; } - - public MethodInfo[] GetMethods() => GetMethods(Module.DefaultLookup); - public virtual MethodInfo[] GetMethods(BindingFlags bindingFlags) { throw NotImplemented.ByDesign; } - - public FieldInfo? GetField(string name) => GetField(name, Module.DefaultLookup); - public virtual FieldInfo? GetField(string name, BindingFlags bindingAttr) { throw NotImplemented.ByDesign; } - - public FieldInfo[] GetFields() => GetFields(Module.DefaultLookup); - public virtual FieldInfo[] GetFields(BindingFlags bindingFlags) { throw NotImplemented.ByDesign; } - - public virtual Type[] GetTypes() { throw NotImplemented.ByDesign; } - - public virtual Type? GetType(string className) => GetType(className, throwOnError: false, ignoreCase: false); - public virtual Type? GetType(string className, bool ignoreCase) => GetType(className, throwOnError: false, ignoreCase: ignoreCase); - public virtual Type? GetType(string className, bool throwOnError, bool ignoreCase) { throw NotImplemented.ByDesign; } - - public virtual Type[] FindTypes(TypeFilter? filter, object? filterCriteria) - { - Type[] c = GetTypes(); - int cnt = 0; - for (int i = 0; i < c.Length; i++) - { - if (filter != null && !filter(c[i], filterCriteria)) - c[i] = null!; - else - cnt++; - } - if (cnt == c.Length) - return c; - - Type[] ret = new Type[cnt]; - cnt = 0; - for (int i = 0; i < c.Length; i++) - { - if (c[i] != null) - ret[cnt++] = c[i]; - } - return ret; - } - - public virtual int MetadataToken => throw NotImplemented.ByDesign; - - public FieldInfo? ResolveField(int metadataToken) => ResolveField(metadataToken, null, null); - public virtual FieldInfo? ResolveField(int metadataToken, Type[]? genericTypeArguments, Type[]? genericMethodArguments) { throw NotImplemented.ByDesign; } - - public MemberInfo? ResolveMember(int metadataToken) => ResolveMember(metadataToken, null, null); - public virtual MemberInfo? ResolveMember(int metadataToken, Type[]? genericTypeArguments, Type[]? genericMethodArguments) { throw NotImplemented.ByDesign; } - - public MethodBase? ResolveMethod(int metadataToken) => ResolveMethod(metadataToken, null, null); - public virtual MethodBase? ResolveMethod(int metadataToken, Type[]? genericTypeArguments, Type[]? genericMethodArguments) { throw NotImplemented.ByDesign; } - - public virtual byte[] ResolveSignature(int metadataToken) { throw NotImplemented.ByDesign; } - public virtual string ResolveString(int metadataToken) { throw NotImplemented.ByDesign; } - - public Type ResolveType(int metadataToken) => ResolveType(metadataToken, null, null); - public virtual Type ResolveType(int metadataToken, Type[]? genericTypeArguments, Type[]? genericMethodArguments) { throw NotImplemented.ByDesign; } - - public virtual void GetObjectData(SerializationInfo info, StreamingContext context) { throw NotImplemented.ByDesign; } - - public override bool Equals(object? o) => base.Equals(o); - public override int GetHashCode() => base.GetHashCode(); - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool operator ==(Module? left, Module? right) - { - // Test "right" first to allow branch elimination when inlined for null checks (== null) - // so it can become a simple test - if (right is null) - { - // return true/false not the test result https://github.com/dotnet/coreclr/issues/914 - return (left is null) ? true : false; - } - - // Try fast reference equality and opposite null check prior to calling the slower virtual Equals - if ((object?)left == (object)right) - { - return true; - } - - return (left is null) ? false : left.Equals(right); - } - - public static bool operator !=(Module? left, Module? right) => !(left == right); - - public override string ToString() => ScopeName; - - public static readonly TypeFilter FilterTypeName = (m, c) => FilterTypeNameImpl(m, c!, StringComparison.Ordinal); - public static readonly TypeFilter FilterTypeNameIgnoreCase = (m, c) => FilterTypeNameImpl(m, c!, StringComparison.OrdinalIgnoreCase); - - private const BindingFlags DefaultLookup = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public; - - // FilterTypeName - // This method will filter the class based upon the name. It supports - // a trailing wild card. - private static bool FilterTypeNameImpl(Type cls, object filterCriteria, StringComparison comparison) - { - // Check that the criteria object is a String object - if (!(filterCriteria is string str)) - { - throw new InvalidFilterCriteriaException(SR.InvalidFilterCriteriaException_CritString); - } - // Check to see if this is a prefix or exact match requirement - if (str.Length > 0 && str[^1] == '*') - { - ReadOnlySpan<char> slice = str.AsSpan(0, str.Length - 1); - return cls.Name.AsSpan().StartsWith(slice, comparison); - } - - return cls.Name.Equals(str, comparison); - } - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/ModuleResolveEventHandler.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/ModuleResolveEventHandler.cs deleted file mode 100644 index 7ac0f06f67e..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/ModuleResolveEventHandler.cs +++ /dev/null @@ -1,8 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Reflection -{ - public delegate Module ModuleResolveEventHandler(object sender, ResolveEventArgs e); -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/ObfuscateAssemblyAttribute.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/ObfuscateAssemblyAttribute.cs deleted file mode 100644 index f6f8438f144..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/ObfuscateAssemblyAttribute.cs +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Reflection -{ - [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false, Inherited = false)] - public sealed class ObfuscateAssemblyAttribute : Attribute - { - public ObfuscateAssemblyAttribute(bool assemblyIsPrivate) - { - AssemblyIsPrivate = assemblyIsPrivate; - } - - public bool AssemblyIsPrivate { get; } - public bool StripAfterObfuscation { get; set; } = true; - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/ObfuscationAttribute.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/ObfuscationAttribute.cs deleted file mode 100644 index 5e1f555b43f..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/ObfuscationAttribute.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Reflection -{ - [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Enum | AttributeTargets.Delegate, - AllowMultiple = true, Inherited = false)] - public sealed class ObfuscationAttribute : Attribute - { - public ObfuscationAttribute() - { - } - - public bool StripAfterObfuscation { get; set; } = true; - public bool Exclude { get; set; } = true; - public bool ApplyToMembers { get; set; } = true; - public string? Feature { get; set; } = "all"; - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/ParameterAttributes.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/ParameterAttributes.cs deleted file mode 100644 index 82e77a20e08..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/ParameterAttributes.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -// ParameterAttributes is an enum defining the attributes that may be -// associated with a Parameter. These are defined in CorHdr.h. - -namespace System.Reflection -{ - // This Enum matchs the CorParamAttr defined in CorHdr.h - [Flags] - public enum ParameterAttributes - { - None = 0x0000, // no flag is specified - In = 0x0001, // Param is [In] - Out = 0x0002, // Param is [Out] - Lcid = 0x0004, // Param is [lcid] - - Retval = 0x0008, // Param is [Retval] - Optional = 0x0010, // Param is optional - - HasDefault = 0x1000, // Param has default value. - HasFieldMarshal = 0x2000, // Param has FieldMarshal. - - Reserved3 = 0x4000, - Reserved4 = 0x8000, - ReservedMask = 0xf000, - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/ParameterInfo.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/ParameterInfo.cs deleted file mode 100644 index ef13b9031f5..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/ParameterInfo.cs +++ /dev/null @@ -1,110 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Collections.Generic; -using System.Runtime.Serialization; - -namespace System.Reflection -{ - public class ParameterInfo : ICustomAttributeProvider, IObjectReference - { - protected ParameterInfo() { } - - public virtual ParameterAttributes Attributes => AttrsImpl; - public virtual MemberInfo Member => MemberImpl; - public virtual string? Name => NameImpl; - public virtual Type ParameterType => ClassImpl!; - public virtual int Position => PositionImpl; - - public bool IsIn => (Attributes & ParameterAttributes.In) != 0; - public bool IsLcid => (Attributes & ParameterAttributes.Lcid) != 0; - public bool IsOptional => (Attributes & ParameterAttributes.Optional) != 0; - public bool IsOut => (Attributes & ParameterAttributes.Out) != 0; - public bool IsRetval => (Attributes & ParameterAttributes.Retval) != 0; - - public virtual object? DefaultValue => throw NotImplemented.ByDesign; - public virtual object? RawDefaultValue => throw NotImplemented.ByDesign; - public virtual bool HasDefaultValue => throw NotImplemented.ByDesign; - - public virtual bool IsDefined(Type attributeType, bool inherit) - { - if (attributeType == null) - throw new ArgumentNullException(nameof(attributeType)); - - return false; - } - - public virtual IEnumerable<CustomAttributeData> CustomAttributes => GetCustomAttributesData(); - public virtual IList<CustomAttributeData> GetCustomAttributesData() { throw NotImplemented.ByDesign; } - - public virtual object[] GetCustomAttributes(bool inherit) => Array.Empty<object>(); - public virtual object[] GetCustomAttributes(Type attributeType, bool inherit) - { - if (attributeType == null) - throw new ArgumentNullException(nameof(attributeType)); - - return Array.Empty<object>(); - } - - public virtual Type[] GetOptionalCustomModifiers() => Array.Empty<Type>(); - public virtual Type[] GetRequiredCustomModifiers() => Array.Empty<Type>(); - - public virtual int MetadataToken => MetadataToken_ParamDef; - - public object GetRealObject(StreamingContext context) - { - // Once all the serializable fields have come in we can set up the real - // instance based on just two of them (MemberImpl and PositionImpl). - - if (MemberImpl == null) - throw new SerializationException(SR.Serialization_InsufficientState); - - ParameterInfo[]? args = null; - - switch (MemberImpl.MemberType) - { - case MemberTypes.Constructor: - case MemberTypes.Method: - if (PositionImpl == -1) - { - if (MemberImpl.MemberType == MemberTypes.Method) - return ((MethodInfo)MemberImpl).ReturnParameter; - else - throw new SerializationException(SR.Serialization_BadParameterInfo); - } - else - { - args = ((MethodBase)MemberImpl).GetParametersNoCopy(); - - if (args != null && PositionImpl < args.Length) - return args[PositionImpl]; - else - throw new SerializationException(SR.Serialization_BadParameterInfo); - } - - case MemberTypes.Property: - args = ((PropertyInfo)MemberImpl).GetIndexParameters(); - - if (args != null && PositionImpl > -1 && PositionImpl < args.Length) - return args[PositionImpl]; - else - throw new SerializationException(SR.Serialization_BadParameterInfo); - - default: - throw new SerializationException(SR.Serialization_NoParameterInfo); - } - } - - public override string ToString() => ParameterType.FormatTypeName() + " " + Name; - - protected ParameterAttributes AttrsImpl; - protected Type? ClassImpl; - protected object? DefaultValueImpl; - protected MemberInfo MemberImpl = null!; - protected string? NameImpl; - protected int PositionImpl; - - private const int MetadataToken_ParamDef = 0x08000000; - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/ParameterModifier.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/ParameterModifier.cs deleted file mode 100644 index d280c94afb8..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/ParameterModifier.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Reflection -{ - public readonly struct ParameterModifier - { - private readonly bool[] _byRef; - - public ParameterModifier(int parameterCount) - { - if (parameterCount <= 0) - throw new ArgumentException(SR.Arg_ParmArraySize); - - _byRef = new bool[parameterCount]; - } - - public bool this[int index] - { - get => _byRef[index]; - set => _byRef[index] = value; - } - -#if CORECLR - internal bool[] IsByRefArray => _byRef; -#endif - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/Pointer.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/Pointer.cs deleted file mode 100644 index e1a9990cf0e..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/Pointer.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Diagnostics; -using System.Runtime.Serialization; - -namespace System.Reflection -{ - [CLSCompliant(false)] - public sealed unsafe class Pointer : ISerializable - { - // CoreCLR: Do not add or remove fields without updating the ReflectionPointer class in runtimehandles.h - private readonly void* _ptr; - private readonly Type _ptrType; - - private Pointer(void* ptr, Type ptrType) - { - Debug.Assert(ptrType.IsRuntimeImplemented()); // CoreCLR: For CoreRT's sake, _ptrType has to be declared as "Type", but in fact, it is always a RuntimeType. Code on CoreCLR expects this. - _ptr = ptr; - _ptrType = ptrType; - } - - public static object Box(void* ptr, Type type) - { - if (type == null) - throw new ArgumentNullException(nameof(type)); - if (!type.IsPointer) - throw new ArgumentException(SR.Arg_MustBePointer, nameof(ptr)); - if (!type.IsRuntimeImplemented()) - throw new ArgumentException(SR.Arg_MustBeType, nameof(ptr)); - - return new Pointer(ptr, type); - } - - public static void* Unbox(object ptr) - { - if (!(ptr is Pointer)) - throw new ArgumentException(SR.Arg_MustBePointer, nameof(ptr)); - return ((Pointer)ptr)._ptr; - } - - void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) - { - throw new PlatformNotSupportedException(); - } - - internal Type GetPointerType() => _ptrType; - internal IntPtr GetPointerValue() => (IntPtr)_ptr; - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/PortableExecutableKinds.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/PortableExecutableKinds.cs deleted file mode 100644 index 978d5348b23..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/PortableExecutableKinds.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Reflection -{ - [Flags] - public enum PortableExecutableKinds - { - NotAPortableExecutableImage = 0x0, - ILOnly = 0x1, - Required32Bit = 0x2, - PE32Plus = 0x4, - Unmanaged32Bit = 0x8, - Preferred32Bit = 0x10, - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/ProcessorArchitecture.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/ProcessorArchitecture.cs deleted file mode 100644 index becb346c4fd..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/ProcessorArchitecture.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Reflection -{ - public enum ProcessorArchitecture - { - None = 0x0000, - MSIL = 0x0001, - X86 = 0x0002, - IA64 = 0x0003, - Amd64 = 0x0004, - Arm = 0x0005 - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/PropertyAttributes.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/PropertyAttributes.cs deleted file mode 100644 index b85b636e395..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/PropertyAttributes.cs +++ /dev/null @@ -1,25 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -// PropertyAttributes is an enum which defines the attributes that may be associated -// with a property. The values here are defined in Corhdr.h. - -namespace System.Reflection -{ - // This Enum matchs the CorPropertyAttr defined in CorHdr.h - [Flags] - public enum PropertyAttributes - { - None = 0x0000, - SpecialName = 0x0200, // property is special. Name describes how. - - RTSpecialName = 0x0400, // Runtime(metadata internal APIs) should check name encoding. - HasDefault = 0x1000, // Property has default - - Reserved2 = 0x2000, - Reserved3 = 0x4000, - Reserved4 = 0x8000, - ReservedMask = 0xf400, - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/PropertyInfo.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/PropertyInfo.cs deleted file mode 100644 index 663d52dbb7c..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/PropertyInfo.cs +++ /dev/null @@ -1,84 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Diagnostics; -using System.Globalization; -using System.Runtime.CompilerServices; - -namespace System.Reflection -{ - public abstract class PropertyInfo : MemberInfo - { - protected PropertyInfo() { } - - public override MemberTypes MemberType => MemberTypes.Property; - - public abstract Type PropertyType { get; } - public abstract ParameterInfo[] GetIndexParameters(); - - public abstract PropertyAttributes Attributes { get; } - public bool IsSpecialName => (Attributes & PropertyAttributes.SpecialName) != 0; - - public abstract bool CanRead { get; } - public abstract bool CanWrite { get; } - - public MethodInfo[] GetAccessors() => GetAccessors(nonPublic: false); - public abstract MethodInfo[] GetAccessors(bool nonPublic); - - public virtual MethodInfo? GetMethod => GetGetMethod(nonPublic: true); - public MethodInfo? GetGetMethod() => GetGetMethod(nonPublic: false); - public abstract MethodInfo? GetGetMethod(bool nonPublic); - - public virtual MethodInfo? SetMethod => GetSetMethod(nonPublic: true); - public MethodInfo? GetSetMethod() => GetSetMethod(nonPublic: false); - public abstract MethodInfo? GetSetMethod(bool nonPublic); - - public virtual Type[] GetOptionalCustomModifiers() => Array.Empty<Type>(); - public virtual Type[] GetRequiredCustomModifiers() => Array.Empty<Type>(); - - [DebuggerHidden] - [DebuggerStepThrough] - public object? GetValue(object? obj) => GetValue(obj, index: null); - [DebuggerHidden] - [DebuggerStepThrough] - public virtual object? GetValue(object? obj, object?[]? index) => GetValue(obj, BindingFlags.Default, binder: null, index: index, culture: null); - public abstract object? GetValue(object? obj, BindingFlags invokeAttr, Binder? binder, object?[]? index, CultureInfo? culture); - - public virtual object? GetConstantValue() { throw NotImplemented.ByDesign; } - public virtual object? GetRawConstantValue() { throw NotImplemented.ByDesign; } - - [DebuggerHidden] - [DebuggerStepThrough] - public void SetValue(object? obj, object? value) => SetValue(obj, value, index: null); - [DebuggerHidden] - [DebuggerStepThrough] - public virtual void SetValue(object? obj, object? value, object?[]? index) => SetValue(obj, value, BindingFlags.Default, binder: null, index: index, culture: null); - public abstract void SetValue(object? obj, object? value, BindingFlags invokeAttr, Binder? binder, object?[]? index, CultureInfo? culture); - - public override bool Equals(object? obj) => base.Equals(obj); - public override int GetHashCode() => base.GetHashCode(); - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool operator ==(PropertyInfo? left, PropertyInfo? right) - { - // Test "right" first to allow branch elimination when inlined for null checks (== null) - // so it can become a simple test - if (right is null) - { - // return true/false not the test result https://github.com/dotnet/coreclr/issues/914 - return (left is null) ? true : false; - } - - // Try fast reference equality and opposite null check prior to calling the slower virtual Equals - if ((object?)left == (object)right) - { - return true; - } - - return (left is null) ? false : left.Equals(right); - } - - public static bool operator !=(PropertyInfo? left, PropertyInfo? right) => !(left == right); - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/ReflectionContext.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/ReflectionContext.cs deleted file mode 100644 index dc96d15dee0..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/ReflectionContext.cs +++ /dev/null @@ -1,23 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Reflection -{ - public abstract class ReflectionContext - { - protected ReflectionContext() { } - - public abstract Assembly MapAssembly(Assembly assembly); - - public abstract TypeInfo MapType(TypeInfo type); - - public virtual TypeInfo GetTypeForObject(object value) - { - if (value == null) - throw new ArgumentNullException(nameof(value)); - - return MapType(value.GetType().GetTypeInfo()); - } - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/ReflectionTypeLoadException.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/ReflectionTypeLoadException.cs deleted file mode 100644 index 29a624e6cf5..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/ReflectionTypeLoadException.cs +++ /dev/null @@ -1,73 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Runtime.Serialization; -using System.Text; - -namespace System.Reflection -{ - [Serializable] - [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] - public sealed class ReflectionTypeLoadException : SystemException, ISerializable - { - public ReflectionTypeLoadException(Type[]? classes, Exception?[]? exceptions) - : base(null) - { - Types = classes; - LoaderExceptions = exceptions; - HResult = HResults.COR_E_REFLECTIONTYPELOAD; - } - - public ReflectionTypeLoadException(Type[]? classes, Exception?[]? exceptions, string? message) - : base(message) - { - Types = classes; - LoaderExceptions = exceptions; - HResult = HResults.COR_E_REFLECTIONTYPELOAD; - } - - private ReflectionTypeLoadException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - LoaderExceptions = (Exception[]?)(info.GetValue("Exceptions", typeof(Exception[]))); - } - - public override void GetObjectData(SerializationInfo info, StreamingContext context) - { - base.GetObjectData(info, context); - info.AddValue("Types", null, typeof(Type[])); - info.AddValue("Exceptions", LoaderExceptions, typeof(Exception[])); - } - - public Type[]? Types { get; } - - public Exception?[]? LoaderExceptions { get; } - - public override string Message => CreateString(isMessage: true); - - public override string ToString() => CreateString(isMessage: false); - - private string CreateString(bool isMessage) - { - string baseValue = isMessage ? base.Message : base.ToString(); - - Exception?[]? exceptions = LoaderExceptions; - if (exceptions == null || exceptions.Length == 0) - { - return baseValue; - } - - var text = new StringBuilder(baseValue); - foreach (Exception? e in exceptions) - { - if (e != null) - { - text.AppendLine(); - text.Append(isMessage ? e.Message : e.ToString()); - } - } - return text.ToString(); - } - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/ResourceAttributes.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/ResourceAttributes.cs deleted file mode 100644 index 498ef7c25c5..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/ResourceAttributes.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Reflection -{ - [Flags] - public enum ResourceAttributes - { - Public = 0x0001, - Private = 0x0002, - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/ResourceLocation.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/ResourceLocation.cs deleted file mode 100644 index a5722a1b63e..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/ResourceLocation.cs +++ /dev/null @@ -1,14 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Reflection -{ - [Flags] - public enum ResourceLocation - { - ContainedInAnotherAssembly = 2, - ContainedInManifestFile = 4, - Embedded = 1, - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/SignatureArrayType.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/SignatureArrayType.cs deleted file mode 100644 index b02bd787f7a..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/SignatureArrayType.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Diagnostics; - -namespace System.Reflection -{ - internal sealed class SignatureArrayType : SignatureHasElementType - { - internal SignatureArrayType(SignatureType elementType, int rank, bool isMultiDim) - : base(elementType) - { - Debug.Assert(rank > 0); - Debug.Assert(rank == 1 || isMultiDim); - - _rank = rank; - _isMultiDim = isMultiDim; - } - - protected sealed override bool IsArrayImpl() => true; - protected sealed override bool IsByRefImpl() => false; - protected sealed override bool IsPointerImpl() => false; - - public sealed override bool IsSZArray => !_isMultiDim; - public sealed override bool IsVariableBoundArray => _isMultiDim; - - public sealed override int GetArrayRank() => _rank; - - protected sealed override string Suffix - { - get - { - if (!_isMultiDim) - return "[]"; - else if (_rank == 1) - return "[*]"; - else - return "[" + new string(',', _rank - 1) + "]"; - } - } - - private readonly int _rank; - private readonly bool _isMultiDim; - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/SignatureByRefType.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/SignatureByRefType.cs deleted file mode 100644 index db083a394f6..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/SignatureByRefType.cs +++ /dev/null @@ -1,25 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Reflection -{ - internal sealed class SignatureByRefType : SignatureHasElementType - { - internal SignatureByRefType(SignatureType elementType) - : base(elementType) - { - } - - protected sealed override bool IsArrayImpl() => false; - protected sealed override bool IsByRefImpl() => true; - protected sealed override bool IsPointerImpl() => false; - - public sealed override bool IsSZArray => false; - public sealed override bool IsVariableBoundArray => false; - - public sealed override int GetArrayRank() => throw new ArgumentException(SR.Argument_HasToBeArrayClass); - - protected sealed override string Suffix => "&"; - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/SignatureConstructedGenericType.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/SignatureConstructedGenericType.cs deleted file mode 100644 index 57a0dd55dcf..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/SignatureConstructedGenericType.cs +++ /dev/null @@ -1,85 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Text; - -namespace System.Reflection -{ - internal sealed class SignatureConstructedGenericType : SignatureType - { - // The exception-visible name "typeArguments" is chosen to match the parameter name to Type.MakeGenericType() since that's the - // intended user of this constructor. - internal SignatureConstructedGenericType(Type genericTypeDefinition, Type[] typeArguments) - { - if (genericTypeDefinition is null) - throw new ArgumentNullException(nameof(genericTypeDefinition)); - - if (typeArguments is null) - throw new ArgumentNullException(nameof(typeArguments)); - - typeArguments = (Type[])(typeArguments.Clone()); - for (int i = 0; i < typeArguments.Length; i++) - { - if (typeArguments[i] is null) - throw new ArgumentNullException(nameof(typeArguments)); - } - - _genericTypeDefinition = genericTypeDefinition; - _genericTypeArguments = typeArguments; - } - - public sealed override bool IsTypeDefinition => false; - public sealed override bool IsGenericTypeDefinition => false; - protected sealed override bool HasElementTypeImpl() => false; - protected sealed override bool IsArrayImpl() => false; - protected sealed override bool IsByRefImpl() => false; - public sealed override bool IsByRefLike => _genericTypeDefinition.IsByRefLike; - protected sealed override bool IsPointerImpl() => false; - public sealed override bool IsSZArray => false; - public sealed override bool IsVariableBoundArray => false; - public sealed override bool IsConstructedGenericType => true; - public sealed override bool IsGenericParameter => false; - public sealed override bool IsGenericTypeParameter => false; - public sealed override bool IsGenericMethodParameter => false; - public sealed override bool ContainsGenericParameters - { - get - { - for (int i = 0; i < _genericTypeArguments.Length; i++) - { - if (_genericTypeArguments[i].ContainsGenericParameters) - return true; - } - return false; - } - } - - internal sealed override SignatureType? ElementType => null; - public sealed override int GetArrayRank() => throw new ArgumentException(SR.Argument_HasToBeArrayClass); - public sealed override Type GetGenericTypeDefinition() => _genericTypeDefinition; - public sealed override Type[] GetGenericArguments() => GenericTypeArguments; - public sealed override Type[] GenericTypeArguments => (Type[])(_genericTypeArguments.Clone()); - public sealed override int GenericParameterPosition => throw new InvalidOperationException(SR.Arg_NotGenericParameter); - public sealed override string Name => _genericTypeDefinition.Name; - public sealed override string? Namespace => _genericTypeDefinition.Namespace; - - public sealed override string ToString() - { - StringBuilder sb = new StringBuilder(); - sb.Append(_genericTypeDefinition.ToString()); - sb.Append('['); - for (int i = 0; i < _genericTypeArguments.Length; i++) - { - if (i != 0) - sb.Append(','); - sb.Append(_genericTypeArguments[i].ToString()); - } - sb.Append(']'); - return sb.ToString(); - } - - private readonly Type _genericTypeDefinition; - private readonly Type[] _genericTypeArguments; - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/SignatureGenericMethodParameterType.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/SignatureGenericMethodParameterType.cs deleted file mode 100644 index 76a13f504f4..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/SignatureGenericMethodParameterType.cs +++ /dev/null @@ -1,19 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Reflection -{ - internal sealed class SignatureGenericMethodParameterType : SignatureGenericParameterType - { - internal SignatureGenericMethodParameterType(int position) - : base(position) - { - } - - public sealed override bool IsGenericTypeParameter => false; - public sealed override bool IsGenericMethodParameter => true; - - public sealed override string Name => "!!" + GenericParameterPosition; - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/SignatureGenericParameterType.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/SignatureGenericParameterType.cs deleted file mode 100644 index 2d3d4da77ca..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/SignatureGenericParameterType.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Diagnostics; - -namespace System.Reflection -{ - internal abstract class SignatureGenericParameterType : SignatureType - { - protected SignatureGenericParameterType(int position) - { - Debug.Assert(position >= 0); - _position = position; - } - - public sealed override bool IsTypeDefinition => false; - public sealed override bool IsGenericTypeDefinition => false; - protected sealed override bool HasElementTypeImpl() => false; - protected sealed override bool IsArrayImpl() => false; - protected sealed override bool IsByRefImpl() => false; - public sealed override bool IsByRefLike => false; - protected sealed override bool IsPointerImpl() => false; - public sealed override bool IsSZArray => false; - public sealed override bool IsVariableBoundArray => false; - public sealed override bool IsConstructedGenericType => false; - public sealed override bool IsGenericParameter => true; - public abstract override bool IsGenericMethodParameter { get; } - public sealed override bool ContainsGenericParameters => true; - - internal sealed override SignatureType? ElementType => null; - public sealed override int GetArrayRank() => throw new ArgumentException(SR.Argument_HasToBeArrayClass); - public sealed override Type GetGenericTypeDefinition() => throw new InvalidOperationException(SR.InvalidOperation_NotGenericType); - public sealed override Type[] GetGenericArguments() => Array.Empty<Type>(); - public sealed override Type[] GenericTypeArguments => Array.Empty<Type>(); - public sealed override int GenericParameterPosition => _position; - public abstract override string Name { get; } - public sealed override string? Namespace => null; - - public sealed override string ToString() => Name; - - private readonly int _position; - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/SignatureHasElementType.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/SignatureHasElementType.cs deleted file mode 100644 index 55fd863d6e8..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/SignatureHasElementType.cs +++ /dev/null @@ -1,47 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Diagnostics; - -namespace System.Reflection -{ - internal abstract class SignatureHasElementType : SignatureType - { - protected SignatureHasElementType(SignatureType elementType) - { - Debug.Assert(elementType != null); - _elementType = elementType; - } - - public sealed override bool IsTypeDefinition => false; - public sealed override bool IsGenericTypeDefinition => false; - protected sealed override bool HasElementTypeImpl() => true; - protected abstract override bool IsArrayImpl(); - protected abstract override bool IsByRefImpl(); - public sealed override bool IsByRefLike => false; - protected abstract override bool IsPointerImpl(); - public abstract override bool IsSZArray { get; } - public abstract override bool IsVariableBoundArray { get; } - public sealed override bool IsConstructedGenericType => false; - public sealed override bool IsGenericParameter => false; - public sealed override bool IsGenericTypeParameter => false; - public sealed override bool IsGenericMethodParameter => false; - public sealed override bool ContainsGenericParameters => _elementType.ContainsGenericParameters; - - internal sealed override SignatureType? ElementType => _elementType; - public abstract override int GetArrayRank(); - public sealed override Type GetGenericTypeDefinition() => throw new InvalidOperationException(SR.InvalidOperation_NotGenericType); - public sealed override Type[] GetGenericArguments() => Array.Empty<Type>(); - public sealed override Type[] GenericTypeArguments => Array.Empty<Type>(); - public sealed override int GenericParameterPosition => throw new InvalidOperationException(SR.Arg_NotGenericParameter); - public sealed override string Name => _elementType.Name + Suffix; - public sealed override string? Namespace => _elementType.Namespace; - - public sealed override string ToString() => _elementType.ToString() + Suffix; - - protected abstract string Suffix { get; } - - private readonly SignatureType _elementType; - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/SignaturePointerType.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/SignaturePointerType.cs deleted file mode 100644 index fdc32bdbe2a..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/SignaturePointerType.cs +++ /dev/null @@ -1,25 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Reflection -{ - internal sealed class SignaturePointerType : SignatureHasElementType - { - internal SignaturePointerType(SignatureType elementType) - : base(elementType) - { - } - - protected sealed override bool IsArrayImpl() => false; - protected sealed override bool IsByRefImpl() => false; - protected sealed override bool IsPointerImpl() => true; - - public sealed override bool IsSZArray => false; - public sealed override bool IsVariableBoundArray => false; - - public sealed override int GetArrayRank() => throw new ArgumentException(SR.Argument_HasToBeArrayClass); - - protected sealed override string Suffix => "*"; - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/SignatureType.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/SignatureType.cs deleted file mode 100644 index 5d2eca3a1a3..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/SignatureType.cs +++ /dev/null @@ -1,146 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Globalization; -using System.Collections.Generic; -using System.Runtime.InteropServices; - -namespace System.Reflection -{ - // - // Signature Types are highly restricted Type objects that can be passed in the Type[] parameter to Type.GetMethod(). Their primary - // use is to pass types representing generic parameters defined by the method, or types composed from them. Passing in the normal - // generic parameter Type obtained from MethodInfo.GetGenericArguments() is usually impractical (if you had the method, you wouldn't - // be looking for it!) - // - internal abstract class SignatureType : Type - { - public sealed override bool IsSignatureType => true; - - // Type flavor predicates - public abstract override bool IsTypeDefinition { get; } - protected abstract override bool HasElementTypeImpl(); - protected abstract override bool IsArrayImpl(); - public abstract override bool IsSZArray { get; } - public abstract override bool IsVariableBoundArray { get; } - protected abstract override bool IsByRefImpl(); - public abstract override bool IsByRefLike { get; } - protected abstract override bool IsPointerImpl(); - public sealed override bool IsGenericType => IsGenericTypeDefinition || IsConstructedGenericType; - public abstract override bool IsGenericTypeDefinition { get; } - public abstract override bool IsConstructedGenericType { get; } - public abstract override bool IsGenericParameter { get; } - public abstract override bool IsGenericTypeParameter { get; } - public abstract override bool IsGenericMethodParameter { get; } - public abstract override bool ContainsGenericParameters { get; } - public sealed override MemberTypes MemberType => MemberTypes.TypeInfo; - - // Compositors - public sealed override Type MakeArrayType() => new SignatureArrayType(this, rank: 1, isMultiDim: false); - public sealed override Type MakeArrayType(int rank) - { - if (rank <= 0) - throw new IndexOutOfRangeException(); - return new SignatureArrayType(this, rank: rank, isMultiDim: true); - } - public sealed override Type MakeByRefType() => new SignatureByRefType(this); - public sealed override Type MakePointerType() => new SignaturePointerType(this); - public sealed override Type MakeGenericType(params Type[] typeArguments) => throw new NotSupportedException(SR.NotSupported_SignatureType); // There is no SignatureType for type definition types so it would never be legal to call this. - - // Dissectors - public sealed override Type? GetElementType() => ElementType; - public abstract override int GetArrayRank(); - public abstract override Type GetGenericTypeDefinition(); - public abstract override Type[] GenericTypeArguments { get; } - public abstract override Type[] GetGenericArguments(); - public abstract override int GenericParameterPosition { get; } - internal abstract SignatureType? ElementType { get; } - - // Identity -#if DEBUG - public sealed override bool Equals(object? o) => base.Equals(o); - public sealed override bool Equals(Type? o) => base.Equals(o); - public sealed override int GetHashCode() => base.GetHashCode(); -#endif - public sealed override Type UnderlyingSystemType => this; // Equals(Type) depends on this. - - // Naming and diagnostics - public abstract override string Name { get; } - public abstract override string? Namespace { get; } - public sealed override string? FullName => null; - public sealed override string? AssemblyQualifiedName => null; - public abstract override string ToString(); - - // Not supported on Signature Types - public sealed override Assembly Assembly => throw new NotSupportedException(SR.NotSupported_SignatureType); - public sealed override Module Module => throw new NotSupportedException(SR.NotSupported_SignatureType); - - public sealed override Type ReflectedType => throw new NotSupportedException(SR.NotSupported_SignatureType); - public sealed override Type BaseType => throw new NotSupportedException(SR.NotSupported_SignatureType); - - public sealed override Type[] GetInterfaces() => throw new NotSupportedException(SR.NotSupported_SignatureType); - public sealed override bool IsAssignableFrom(Type? c) => throw new NotSupportedException(SR.NotSupported_SignatureType); - public sealed override int MetadataToken => throw new NotSupportedException(SR.NotSupported_SignatureType); - public sealed override bool HasSameMetadataDefinitionAs(MemberInfo other) => throw new NotSupportedException(SR.NotSupported_SignatureType); - - public sealed override Type DeclaringType => throw new NotSupportedException(SR.NotSupported_SignatureType); - public sealed override MethodBase DeclaringMethod => throw new NotSupportedException(SR.NotSupported_SignatureType); - - public sealed override Type[] GetGenericParameterConstraints() => throw new NotSupportedException(SR.NotSupported_SignatureType); - public sealed override GenericParameterAttributes GenericParameterAttributes => throw new NotSupportedException(SR.NotSupported_SignatureType); - public sealed override bool IsEnumDefined(object value) => throw new NotSupportedException(SR.NotSupported_SignatureType); - public sealed override string GetEnumName(object value) => throw new NotSupportedException(SR.NotSupported_SignatureType); - public sealed override string[] GetEnumNames() => throw new NotSupportedException(SR.NotSupported_SignatureType); - public sealed override Type GetEnumUnderlyingType() => throw new NotSupportedException(SR.NotSupported_SignatureType); - public sealed override Array GetEnumValues() => throw new NotSupportedException(SR.NotSupported_SignatureType); - public sealed override Guid GUID => throw new NotSupportedException(SR.NotSupported_SignatureType); - protected sealed override TypeCode GetTypeCodeImpl() => throw new NotSupportedException(SR.NotSupported_SignatureType); - protected sealed override TypeAttributes GetAttributeFlagsImpl() => throw new NotSupportedException(SR.NotSupported_SignatureType); - public sealed override ConstructorInfo[] GetConstructors(BindingFlags bindingAttr) => throw new NotSupportedException(SR.NotSupported_SignatureType); - public sealed override EventInfo GetEvent(string name, BindingFlags bindingAttr) => throw new NotSupportedException(SR.NotSupported_SignatureType); - public sealed override EventInfo[] GetEvents(BindingFlags bindingAttr) => throw new NotSupportedException(SR.NotSupported_SignatureType); - public sealed override FieldInfo GetField(string name, BindingFlags bindingAttr) => throw new NotSupportedException(SR.NotSupported_SignatureType); - public sealed override FieldInfo[] GetFields(BindingFlags bindingAttr) => throw new NotSupportedException(SR.NotSupported_SignatureType); - public sealed override MemberInfo[] GetMembers(BindingFlags bindingAttr) => throw new NotSupportedException(SR.NotSupported_SignatureType); - public sealed override MethodInfo[] GetMethods(BindingFlags bindingAttr) => throw new NotSupportedException(SR.NotSupported_SignatureType); - public sealed override Type GetNestedType(string name, BindingFlags bindingAttr) => throw new NotSupportedException(SR.NotSupported_SignatureType); - public sealed override Type[] GetNestedTypes(BindingFlags bindingAttr) => throw new NotSupportedException(SR.NotSupported_SignatureType); - public sealed override PropertyInfo[] GetProperties(BindingFlags bindingAttr) => throw new NotSupportedException(SR.NotSupported_SignatureType); - public sealed override object InvokeMember(string name, BindingFlags invokeAttr, Binder? binder, object? target, object?[]? args, ParameterModifier[]? modifiers, CultureInfo? culture, string[]? namedParameters) => throw new NotSupportedException(SR.NotSupported_SignatureType); - protected sealed override MethodInfo GetMethodImpl(string name, BindingFlags bindingAttr, Binder? binder, CallingConventions callConvention, Type[]? types, ParameterModifier[]? modifiers) => throw new NotSupportedException(SR.NotSupported_SignatureType); - protected sealed override MethodInfo GetMethodImpl(string name, int genericParameterCount, BindingFlags bindingAttr, Binder? binder, CallingConventions callConvention, Type[]? types, ParameterModifier[]? modifiers) => throw new NotSupportedException(SR.NotSupported_SignatureType); - protected sealed override PropertyInfo GetPropertyImpl(string name, BindingFlags bindingAttr, Binder? binder, Type? returnType, Type[]? types, ParameterModifier[]? modifiers) => throw new NotSupportedException(SR.NotSupported_SignatureType); - public sealed override MemberInfo[] FindMembers(MemberTypes memberType, BindingFlags bindingAttr, MemberFilter? filter, object? filterCriteria) => throw new NotSupportedException(SR.NotSupported_SignatureType); - public sealed override MemberInfo[] GetMember(string name, BindingFlags bindingAttr) => throw new NotSupportedException(SR.NotSupported_SignatureType); - public sealed override MemberInfo[] GetMember(string name, MemberTypes type, BindingFlags bindingAttr) => throw new NotSupportedException(SR.NotSupported_SignatureType); - public sealed override MemberInfo[] GetDefaultMembers() => throw new NotSupportedException(SR.NotSupported_SignatureType); - public sealed override EventInfo[] GetEvents() => throw new NotSupportedException(SR.NotSupported_SignatureType); - public sealed override object[] GetCustomAttributes(bool inherit) => throw new NotSupportedException(SR.NotSupported_SignatureType); - public sealed override object[] GetCustomAttributes(Type attributeType, bool inherit) => throw new NotSupportedException(SR.NotSupported_SignatureType); - public sealed override bool IsDefined(Type attributeType, bool inherit) => throw new NotSupportedException(SR.NotSupported_SignatureType); - public sealed override IList<CustomAttributeData> GetCustomAttributesData() => throw new NotSupportedException(SR.NotSupported_SignatureType); - public sealed override Type GetInterface(string name, bool ignoreCase) => throw new NotSupportedException(SR.NotSupported_SignatureType); - protected sealed override ConstructorInfo GetConstructorImpl(BindingFlags bindingAttr, Binder? binder, CallingConventions callConvention, Type[] types, ParameterModifier[]? modifiers) => throw new NotSupportedException(SR.NotSupported_SignatureType); - protected sealed override bool IsCOMObjectImpl() => throw new NotSupportedException(SR.NotSupported_SignatureType); - protected sealed override bool IsPrimitiveImpl() => throw new NotSupportedException(SR.NotSupported_SignatureType); - public sealed override IEnumerable<CustomAttributeData> CustomAttributes => throw new NotSupportedException(SR.NotSupported_SignatureType); - public sealed override Type[] FindInterfaces(TypeFilter filter, object? filterCriteria) => throw new NotSupportedException(SR.NotSupported_SignatureType); - public sealed override InterfaceMapping GetInterfaceMap(Type interfaceType) => throw new NotSupportedException(SR.NotSupported_SignatureType); - protected sealed override bool IsContextfulImpl() => throw new NotSupportedException(SR.NotSupported_SignatureType); - public sealed override bool IsEnum => throw new NotSupportedException(SR.NotSupported_SignatureType); - public sealed override bool IsEquivalentTo(Type? other) => throw new NotSupportedException(SR.NotSupported_SignatureType); - public sealed override bool IsInstanceOfType(object? o) => throw new NotSupportedException(SR.NotSupported_SignatureType); - protected sealed override bool IsMarshalByRefImpl() => throw new NotSupportedException(SR.NotSupported_SignatureType); - public sealed override bool IsSecurityCritical => throw new NotSupportedException(SR.NotSupported_SignatureType); - public sealed override bool IsSecuritySafeCritical => throw new NotSupportedException(SR.NotSupported_SignatureType); - public sealed override bool IsSecurityTransparent => throw new NotSupportedException(SR.NotSupported_SignatureType); - public sealed override bool IsSerializable => throw new NotSupportedException(SR.NotSupported_SignatureType); - public sealed override bool IsSubclassOf(Type c) => throw new NotSupportedException(SR.NotSupported_SignatureType); - protected sealed override bool IsValueTypeImpl() => throw new NotSupportedException(SR.NotSupported_SignatureType); - - public sealed override StructLayoutAttribute StructLayoutAttribute => throw new NotSupportedException(SR.NotSupported_SignatureType); - - public sealed override RuntimeTypeHandle TypeHandle => throw new NotSupportedException(SR.NotSupported_SignatureType); - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/SignatureTypeExtensions.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/SignatureTypeExtensions.cs deleted file mode 100644 index c83f25b0e19..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/SignatureTypeExtensions.cs +++ /dev/null @@ -1,224 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Reflection -{ -#if CORERT - [System.Runtime.CompilerServices.ReflectionBlocked] - public // Needs to be public so that Reflection.Core can see it. -#else - internal -#endif - static class SignatureTypeExtensions - { - /// <summary> - /// This is semantically identical to - /// - /// parameter.ParameterType == pattern.TryResolveAgainstGenericMethod(parameter.Member) - /// - /// but without the allocation overhead of TryResolve. - /// </summary> - public static bool MatchesParameterTypeExactly(this Type pattern, ParameterInfo parameter) - { - if (pattern is SignatureType signatureType) - return signatureType.MatchesExactly(parameter.ParameterType); - else - return pattern == (object)(parameter.ParameterType); - } - - /// <summary> - /// This is semantically identical to - /// - /// actual == pattern.TryResolveAgainstGenericMethod(parameterMember) - /// - /// but without the allocation overhead of TryResolve. - /// </summary> - internal static bool MatchesExactly(this SignatureType pattern, Type actual) - { - if (pattern.IsSZArray) - { - return actual.IsSZArray && pattern.ElementType!.MatchesExactly(actual.GetElementType()!); - } - else if (pattern.IsVariableBoundArray) - { - return actual.IsVariableBoundArray && pattern.GetArrayRank() == actual.GetArrayRank() && pattern.ElementType!.MatchesExactly(actual.GetElementType()!); - } - else if (pattern.IsByRef) - { - return actual.IsByRef && pattern.ElementType!.MatchesExactly(actual.GetElementType()!); - } - else if (pattern.IsPointer) - { - return actual.IsPointer && pattern.ElementType!.MatchesExactly(actual.GetElementType()!); - } - else if (pattern.IsConstructedGenericType) - { - if (!actual.IsConstructedGenericType) - return false; - if (!(pattern.GetGenericTypeDefinition() == actual.GetGenericTypeDefinition())) - return false; - Type[] patternGenericTypeArguments = pattern.GenericTypeArguments; - Type[] actualGenericTypeArguments = actual.GenericTypeArguments; - int count = patternGenericTypeArguments.Length; - if (count != actualGenericTypeArguments.Length) - return false; - for (int i = 0; i < count; i++) - { - Type patternGenericTypeArgument = patternGenericTypeArguments[i]; - if (patternGenericTypeArgument is SignatureType signatureType) - { - if (!signatureType.MatchesExactly(actualGenericTypeArguments[i])) - return false; - } - else - { - if (patternGenericTypeArgument != actualGenericTypeArguments[i]) - return false; - } - } - return true; - } - else if (pattern.IsGenericMethodParameter) - { - if (!actual.IsGenericMethodParameter) - return false; - if (pattern.GenericParameterPosition != actual.GenericParameterPosition) - return false; - return true; - } - else - { - return false; - } - } - - /// <summary> - /// Translates a SignatureType into its equivalent resolved Type by recursively substituting all generic parameter references - /// with its corresponding generic parameter definition. This is slow so MatchesExactly or MatchesParameterTypeExactly should be - /// substituted instead whenever possible. This is only used by the DefaultBinder when its fast-path checks have been exhausted and - /// it needs to call non-trivial methods like IsAssignableFrom which SignatureTypes will never support. - /// - /// Because this method is used to eliminate method candidates in a GetMethod() lookup, it is entirely possible that the Type - /// might not be creatable due to conflicting generic constraints. Since this merely implies that this candidate is not - /// the method we're looking for, we return null rather than let the TypeLoadException bubble up. The DefaultBinder will catch - /// the null and continue its search for a better candidate. - /// </summary> - internal static Type? TryResolveAgainstGenericMethod(this SignatureType signatureType, MethodInfo genericMethod) - { - return signatureType.TryResolve(genericMethod.GetGenericArguments()); - } - - private static Type? TryResolve(this SignatureType signatureType, Type[] genericMethodParameters) - { - if (signatureType.IsSZArray) - { - return signatureType.ElementType!.TryResolve(genericMethodParameters)?.TryMakeArrayType(); - } - else if (signatureType.IsVariableBoundArray) - { - return signatureType.ElementType!.TryResolve(genericMethodParameters)?.TryMakeArrayType(signatureType.GetArrayRank()); - } - else if (signatureType.IsByRef) - { - return signatureType.ElementType!.TryResolve(genericMethodParameters)?.TryMakeByRefType(); - } - else if (signatureType.IsPointer) - { - return signatureType.ElementType!.TryResolve(genericMethodParameters)?.TryMakePointerType(); - } - else if (signatureType.IsConstructedGenericType) - { - Type[] genericTypeArguments = signatureType.GenericTypeArguments; - int count = genericTypeArguments.Length; - Type?[] newGenericTypeArguments = new Type[count]; - for (int i = 0; i < count; i++) - { - Type genericTypeArgument = genericTypeArguments[i]; - if (genericTypeArgument is SignatureType signatureGenericTypeArgument) - { - newGenericTypeArguments[i] = signatureGenericTypeArgument.TryResolve(genericMethodParameters); - if (newGenericTypeArguments[i] == null) - return null; - } - else - { - newGenericTypeArguments[i] = genericTypeArgument; - } - } - return signatureType.GetGenericTypeDefinition().TryMakeGenericType(newGenericTypeArguments!); - } - else if (signatureType.IsGenericMethodParameter) - { - int position = signatureType.GenericParameterPosition; - if (position >= genericMethodParameters.Length) - return null; - return genericMethodParameters[position]; - } - else - { - return null; - } - } - - private static Type? TryMakeArrayType(this Type type) - { - try - { - return type.MakeArrayType(); - } - catch - { - return null; - } - } - - private static Type? TryMakeArrayType(this Type type, int rank) - { - try - { - return type.MakeArrayType(rank); - } - catch - { - return null; - } - } - - private static Type? TryMakeByRefType(this Type type) - { - try - { - return type.MakeByRefType(); - } - catch - { - return null; - } - } - - private static Type? TryMakePointerType(this Type type) - { - try - { - return type.MakePointerType(); - } - catch - { - return null; - } - } - - private static Type? TryMakeGenericType(this Type type, Type[] instantiation) - { - try - { - return type.MakeGenericType(instantiation); - } - catch - { - return null; - } - } - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/StrongNameKeyPair.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/StrongNameKeyPair.cs deleted file mode 100644 index 03e7f121a80..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/StrongNameKeyPair.cs +++ /dev/null @@ -1,45 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.IO; -using System.Runtime.Serialization; - -namespace System.Reflection -{ - public class StrongNameKeyPair : IDeserializationCallback, ISerializable - { - // Build key pair from file. - public StrongNameKeyPair(FileStream keyPairFile) - { - if (keyPairFile == null) - throw new ArgumentNullException(nameof(keyPairFile)); - - int length = (int)keyPairFile.Length; - byte[] keyPairArray = new byte[length]; - keyPairFile.Read(keyPairArray, 0, length); - } - - // Build key pair from byte array in memory. - public StrongNameKeyPair(byte[] keyPairArray) - { - if (keyPairArray == null) - throw new ArgumentNullException(nameof(keyPairArray)); - } - - protected StrongNameKeyPair(SerializationInfo info, StreamingContext context) => - throw new PlatformNotSupportedException(); - - public StrongNameKeyPair(string keyPairContainer) => - throw new PlatformNotSupportedException(SR.PlatformNotSupported_StrongNameSigning); - - public byte[] PublicKey => - throw new PlatformNotSupportedException(SR.PlatformNotSupported_StrongNameSigning); - - void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) => - throw new PlatformNotSupportedException(); - - void IDeserializationCallback.OnDeserialization(object? sender) => - throw new PlatformNotSupportedException(); - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/TargetException.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/TargetException.cs deleted file mode 100644 index 45d36648ca1..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/TargetException.cs +++ /dev/null @@ -1,34 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Runtime.Serialization; - -namespace System.Reflection -{ - [Serializable] - [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] - public class TargetException : ApplicationException - { - public TargetException() - : this(null) - { - } - - public TargetException(string? message) - : this(message, null) - { - } - - public TargetException(string? message, Exception? inner) - : base(message, inner) - { - HResult = HResults.COR_E_TARGET; - } - - protected TargetException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/TargetInvocationException.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/TargetInvocationException.cs deleted file mode 100644 index d529e649927..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/TargetInvocationException.cs +++ /dev/null @@ -1,30 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Runtime.Serialization; - -namespace System.Reflection -{ - [Serializable] - [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] - public sealed class TargetInvocationException : ApplicationException - { - public TargetInvocationException(Exception? inner) - : base(SR.Arg_TargetInvocationException, inner) - { - HResult = HResults.COR_E_TARGETINVOCATION; - } - - public TargetInvocationException(string? message, Exception? inner) - : base(message, inner) - { - HResult = HResults.COR_E_TARGETINVOCATION; - } - - private TargetInvocationException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/TargetParameterCountException.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/TargetParameterCountException.cs deleted file mode 100644 index 888068da7c9..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/TargetParameterCountException.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Runtime.Serialization; - -namespace System.Reflection -{ - [Serializable] - [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] - public sealed class TargetParameterCountException : ApplicationException - { - public TargetParameterCountException() - : base(SR.Arg_TargetParameterCountException) - { - HResult = HResults.COR_E_TARGETPARAMCOUNT; - } - - public TargetParameterCountException(string? message) - : base(message) - { - HResult = HResults.COR_E_TARGETPARAMCOUNT; - } - - public TargetParameterCountException(string? message, Exception? inner) - : base(message, inner) - { - HResult = HResults.COR_E_TARGETPARAMCOUNT; - } - - private TargetParameterCountException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/TypeAttributes.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/TypeAttributes.cs deleted file mode 100644 index 3ae314299e8..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/TypeAttributes.cs +++ /dev/null @@ -1,61 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Reflection -{ - // This Enum matchs the CorTypeAttr defined in CorHdr.h - [Flags] - public enum TypeAttributes - { - VisibilityMask = 0x00000007, - NotPublic = 0x00000000, // Class is not public scope. - Public = 0x00000001, // Class is public scope. - NestedPublic = 0x00000002, // Class is nested with public visibility. - NestedPrivate = 0x00000003, // Class is nested with private visibility. - NestedFamily = 0x00000004, // Class is nested with family visibility. - NestedAssembly = 0x00000005, // Class is nested with assembly visibility. - NestedFamANDAssem = 0x00000006, // Class is nested with family and assembly visibility. - NestedFamORAssem = 0x00000007, // Class is nested with family or assembly visibility. - - // Use this mask to retrieve class layout informaiton - // 0 is AutoLayout, 0x2 is SequentialLayout, 4 is ExplicitLayout - LayoutMask = 0x00000018, - AutoLayout = 0x00000000, // Class fields are auto-laid out - SequentialLayout = 0x00000008, // Class fields are laid out sequentially - ExplicitLayout = 0x00000010, // Layout is supplied explicitly - // end layout mask - - // Use this mask to distinguish whether a type declaration is an interface. (Class vs. ValueType done based on whether it subclasses S.ValueType) - ClassSemanticsMask = 0x00000020, - Class = 0x00000000, // Type is a class (or a value type). - Interface = 0x00000020, // Type is an interface. - - // Special semantics in addition to class semantics. - Abstract = 0x00000080, // Class is abstract - Sealed = 0x00000100, // Class is concrete and may not be extended - SpecialName = 0x00000400, // Class name is special. Name describes how. - - // Implementation attributes. - Import = 0x00001000, // Class / interface is imported - Serializable = 0x00002000, // The class is Serializable. - WindowsRuntime = 0x00004000, // Type is a Windows Runtime type. - - // Use tdStringFormatMask to retrieve string information for native interop - StringFormatMask = 0x00030000, - AnsiClass = 0x00000000, // LPTSTR is interpreted as ANSI in this class - UnicodeClass = 0x00010000, // LPTSTR is interpreted as UNICODE - AutoClass = 0x00020000, // LPTSTR is interpreted automatically - CustomFormatClass = 0x00030000, // A non-standard encoding specified by CustomFormatMask - CustomFormatMask = 0x00C00000, // Use this mask to retrieve non-standard encoding information for native interop. The meaning of the values of these 2 bits is unspecified. - - // end string format mask - - BeforeFieldInit = 0x00100000, // Initialize the class any time before first static field access. - - RTSpecialName = 0x00000800, // Runtime should check name encoding. - HasSecurity = 0x00040000, // Class has security associate with it. - - ReservedMask = 0x00040800, - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/TypeDelegator.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/TypeDelegator.cs deleted file mode 100644 index d0d32dcca97..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/TypeDelegator.cs +++ /dev/null @@ -1,131 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -// TypeDelegator -// -// This class wraps a Type object and delegates all methods to that Type. - -using CultureInfo = System.Globalization.CultureInfo; - -namespace System.Reflection -{ - public class TypeDelegator : TypeInfo - { - public override bool IsAssignableFrom(TypeInfo? typeInfo) - { - if (typeInfo == null) - return false; - return IsAssignableFrom(typeInfo.AsType()); - } - - protected Type typeImpl = null!; - - protected TypeDelegator() { } - - public TypeDelegator(Type delegatingType) - { - if (delegatingType is null) - throw new ArgumentNullException(nameof(delegatingType)); - - typeImpl = delegatingType; - } - - public override Guid GUID => typeImpl.GUID; - public override int MetadataToken => typeImpl.MetadataToken; - - public override object? InvokeMember(string name, BindingFlags invokeAttr, Binder? binder, object? target, - object?[]? args, ParameterModifier[]? modifiers, CultureInfo? culture, string[]? namedParameters) - { - return typeImpl.InvokeMember(name, invokeAttr, binder, target, args, modifiers, culture, namedParameters); - } - - public override Module Module => typeImpl.Module; - public override Assembly Assembly => typeImpl.Assembly; - public override RuntimeTypeHandle TypeHandle => typeImpl.TypeHandle; - public override string Name => typeImpl.Name; - public override string? FullName => typeImpl.FullName; - public override string? Namespace => typeImpl.Namespace; - public override string? AssemblyQualifiedName => typeImpl.AssemblyQualifiedName; - public override Type? BaseType => typeImpl.BaseType; - - protected override ConstructorInfo? GetConstructorImpl(BindingFlags bindingAttr, Binder? binder, - CallingConventions callConvention, Type[] types, ParameterModifier[]? modifiers) - { - return typeImpl.GetConstructor(bindingAttr, binder, callConvention, types, modifiers); - } - - public override ConstructorInfo[] GetConstructors(BindingFlags bindingAttr) => typeImpl.GetConstructors(bindingAttr); - - protected override MethodInfo? GetMethodImpl(string name, BindingFlags bindingAttr, Binder? binder, - CallingConventions callConvention, Type[]? types, ParameterModifier[]? modifiers) - { - // This is interesting there are two paths into the impl. One that validates - // type as non-null and one where type may be null. - if (types == null) - return typeImpl.GetMethod(name, bindingAttr); - else - return typeImpl.GetMethod(name, bindingAttr, binder, callConvention, types, modifiers); - } - - public override MethodInfo[] GetMethods(BindingFlags bindingAttr) => typeImpl.GetMethods(bindingAttr); - - public override FieldInfo? GetField(string name, BindingFlags bindingAttr) => typeImpl.GetField(name, bindingAttr); - public override FieldInfo[] GetFields(BindingFlags bindingAttr) => typeImpl.GetFields(bindingAttr); - - public override Type? GetInterface(string name, bool ignoreCase) => typeImpl.GetInterface(name, ignoreCase); - - public override Type[] GetInterfaces() => typeImpl.GetInterfaces(); - - public override EventInfo? GetEvent(string name, BindingFlags bindingAttr) => typeImpl.GetEvent(name, bindingAttr); - - public override EventInfo[] GetEvents() => typeImpl.GetEvents(); - - protected override PropertyInfo? GetPropertyImpl(string name, BindingFlags bindingAttr, Binder? binder, - Type? returnType, Type[]? types, ParameterModifier[]? modifiers) - { - if (returnType == null && types == null) - return typeImpl.GetProperty(name, bindingAttr); - else - return typeImpl.GetProperty(name, bindingAttr, binder, returnType, types!, modifiers); - } - - public override PropertyInfo[] GetProperties(BindingFlags bindingAttr) => typeImpl.GetProperties(bindingAttr); - public override EventInfo[] GetEvents(BindingFlags bindingAttr) => typeImpl.GetEvents(bindingAttr); - public override Type[] GetNestedTypes(BindingFlags bindingAttr) => typeImpl.GetNestedTypes(bindingAttr); - public override Type? GetNestedType(string name, BindingFlags bindingAttr) => typeImpl.GetNestedType(name, bindingAttr); - public override MemberInfo[] GetMember(string name, MemberTypes type, BindingFlags bindingAttr) => typeImpl.GetMember(name, type, bindingAttr); - public override MemberInfo[] GetMembers(BindingFlags bindingAttr) => typeImpl.GetMembers(bindingAttr); - - protected override TypeAttributes GetAttributeFlagsImpl() => typeImpl.Attributes; - - public override bool IsTypeDefinition => typeImpl.IsTypeDefinition; - public override bool IsSZArray => typeImpl.IsSZArray; - public override bool IsVariableBoundArray => typeImpl.IsVariableBoundArray; - - protected override bool IsArrayImpl() => typeImpl.IsArray; - protected override bool IsPrimitiveImpl() => typeImpl.IsPrimitive; - protected override bool IsByRefImpl() => typeImpl.IsByRef; - public override bool IsGenericTypeParameter => typeImpl.IsGenericTypeParameter; - public override bool IsGenericMethodParameter => typeImpl.IsGenericMethodParameter; - protected override bool IsPointerImpl() => typeImpl.IsPointer; - protected override bool IsValueTypeImpl() => typeImpl.IsValueType; - protected override bool IsCOMObjectImpl() => typeImpl.IsCOMObject; - public override bool IsByRefLike => typeImpl.IsByRefLike; - public override bool IsConstructedGenericType => typeImpl.IsConstructedGenericType; - - public override bool IsCollectible => typeImpl.IsCollectible; - - public override Type? GetElementType() => typeImpl.GetElementType(); - protected override bool HasElementTypeImpl() => typeImpl.HasElementType; - - public override Type UnderlyingSystemType => typeImpl.UnderlyingSystemType; - - // ICustomAttributeProvider - public override object[] GetCustomAttributes(bool inherit) => typeImpl.GetCustomAttributes(inherit); - public override object[] GetCustomAttributes(Type attributeType, bool inherit) => typeImpl.GetCustomAttributes(attributeType, inherit); - - public override bool IsDefined(Type attributeType, bool inherit) => typeImpl.IsDefined(attributeType, inherit); - public override InterfaceMapping GetInterfaceMap(Type interfaceType) => typeImpl.GetInterfaceMap(interfaceType); - } -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/TypeFilter.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/TypeFilter.cs deleted file mode 100644 index befa09ac32f..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/TypeFilter.cs +++ /dev/null @@ -1,8 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Reflection -{ - public delegate bool TypeFilter(Type m, object? filterCriteria); -} diff --git a/netcore/System.Private.CoreLib/shared/System/Reflection/TypeInfo.cs b/netcore/System.Private.CoreLib/shared/System/Reflection/TypeInfo.cs deleted file mode 100644 index eca9213e9e4..00000000000 --- a/netcore/System.Private.CoreLib/shared/System/Reflection/TypeInfo.cs +++ /dev/null @@ -1,94 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Collections.Generic; - -namespace System.Reflection -{ - public abstract partial class TypeInfo : Type, IReflectableType - { - protected TypeInfo() { } - - TypeInfo IReflectableType.GetTypeInfo() => this; - public virtual Type AsType() => this; - - public virtual Type[] GenericTypeParameters => IsGenericTypeDefinition ? GetGenericArguments() : Type.EmptyTypes; - - public virtual EventInfo? GetDeclaredEvent(string name) => GetEvent(name, TypeInfo.DeclaredOnlyLookup); - public virtual FieldInfo? GetDeclaredField(string name) => GetField(name, TypeInfo.DeclaredOnlyLookup); - public virtual MethodInfo? GetDeclaredMethod(string name) => GetMethod(name, TypeInfo.DeclaredOnlyLookup); - public virtual TypeInfo? GetDeclaredNestedType(string name) => GetNestedType(name, TypeInfo.DeclaredOnlyLookup)?.GetTypeInfo(); - public virtual PropertyInfo? GetDeclaredProperty(string name) => GetProperty(name, TypeInfo.DeclaredOnlyLookup); - - public virtual IEnumerable<MethodInfo> GetDeclaredMethods(string name) - { - foreach (MethodInfo method in GetMethods(TypeInfo.DeclaredOnlyLookup)) - { - if (method.Name == name) - yield return method; - } - } - - public virtual IEnumerable<ConstructorInfo> DeclaredConstructors => GetConstructors(TypeInfo.DeclaredOnlyLookup); - public virtual IEnumerable<EventInfo> DeclaredEvents => GetEvents(TypeInfo.DeclaredOnlyLookup); - public virtual IEnumerable<FieldInfo> DeclaredFields => GetFields(TypeInfo.DeclaredOnlyLookup); - public virtual IEnumerable<MemberInfo> DeclaredMembers => GetMembers(TypeInfo.DeclaredOnlyLookup); - public virtual IEnumerable<MethodInfo> DeclaredMethods => GetMethods(TypeInfo.DeclaredOnlyLookup); - public virtual IEnumerable<System.Reflection.TypeInfo> DeclaredNestedTypes - { - get - { - foreach (Type t in GetNestedTypes(TypeInfo.DeclaredOnlyLookup)) - { - yield return t.GetTypeInfo(); - } - } - } - public virtual IEnumerable<PropertyInfo> DeclaredProperties => GetProperties(TypeInfo.DeclaredOnlyLookup); - - public virtual IEnumerable<Type> ImplementedInterfaces => GetInterfaces(); - - // a re-implementation of ISAF from Type, skipping the use of UnderlyingType - public virtual bool IsAssignableFrom(TypeInfo? typeInfo) - { - if (typeInfo == null) - return false; - - if (this == typeInfo) - return true; - - // If c is a subclass of this class, then c can be cast to this type. - if (typeInfo.IsSubclassOf(this)) - return true; - - if (this.IsInterface) - { - return typeInfo.ImplementInterface(this); - } - else if (IsGenericParameter) - { - Type[] constraints = GetGenericParameterConstraints(); - for (int i = 0; i < constraints.Length; i++) - if (!constraints[i].IsAssignableFrom(typeInfo)) - return false; - - return true; - } - - return false; - } - - internal static string GetRankString(int rank) - { - if (rank <= 0) - throw new IndexOutOfRangeException(); - - return rank == 1 ? - "[*]" : - "[" + new string(',', rank - 1) + "]"; - } - - private const BindingFlags DeclaredOnlyLookup = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly; - } -} |