public static SignatureHelper GetPropertySigHelper(Module?mod, Type?returnType, Type[]?parameterTypes) { return(GetPropertySigHelper(mod, returnType, null, null, parameterTypes, null, null)); }
private int m_argCount; // tracking number of arguments in the signature #endregion #region Constructor private SignatureHelper(Module?mod, MdSigCallingConvention callingConvention) { // Use this constructor to instantiate a local var sig or Field where return type is not applied. Init(mod, callingConvention); }
private void SetActiveParameter(Module module, int parameter) { activeModule = module; activeParameter = parameter; UpdateAnnouncer(); }
public static SignatureHelper GetFieldSigHelper(Module?mod) { return(new SignatureHelper(mod, MdSigCallingConvention.Field)); }
public static SignatureHelper GetMethodSigHelper(Module?mod, Type?returnType, Type[]?parameterTypes) { return(GetMethodSigHelper(mod, CallingConventions.Standard, (CallingConvention)0, returnType, parameterTypes)); }
private void Init(string name, MethodAttributes attributes, CallingConventions callingConvention, Type?returnType, Type[]?signature, Type?owner, Module?m, bool skipVisibility, bool transparentMethod) { DynamicMethod.CheckConsistency(attributes, callingConvention); // check and store the signature if (signature != null) { m_parameterTypes = new RuntimeType[signature.Length]; for (int i = 0; i < signature.Length; i++) { if (signature[i] == null) { throw new ArgumentException(SR.Arg_InvalidTypeInSignature); } m_parameterTypes[i] = (signature[i].UnderlyingSystemType as RuntimeType) !; if (m_parameterTypes[i] == null || m_parameterTypes[i] == typeof(void)) { throw new ArgumentException(SR.Arg_InvalidTypeInSignature); } } } else { m_parameterTypes = Array.Empty <RuntimeType>(); } // check and store the return value m_returnType = (returnType == null) ? (RuntimeType)typeof(void) : (returnType.UnderlyingSystemType as RuntimeType) !; if (m_returnType == null) { throw new NotSupportedException(SR.Arg_InvalidTypeInRetType); } if (transparentMethod) { Debug.Assert(owner == null && m == null, "owner and m cannot be set for transparent methods"); m_module = GetDynamicMethodsModule(); if (skipVisibility) { m_restrictedSkipVisibility = true; } } else { Debug.Assert(m != null || owner != null, "Constructor should ensure that either m or owner is set"); Debug.Assert(m == null || !m.Equals(s_anonymouslyHostedDynamicMethodsModule), "The user cannot explicitly use this assembly"); Debug.Assert(m == null || owner == null, "m and owner cannot both be set"); if (m != null) { m_module = m.ModuleHandle.GetRuntimeModule(); // this returns the underlying module for all RuntimeModule and ModuleBuilder objects. } else { RuntimeType?rtOwner = null; if (owner != null) { rtOwner = owner.UnderlyingSystemType as RuntimeType; } if (rtOwner != null) { if (rtOwner.HasElementType || rtOwner.ContainsGenericParameters || rtOwner.IsGenericParameter || rtOwner.IsInterface) { throw new ArgumentException(SR.Argument_InvalidTypeForDynamicMethod); } m_typeOwner = rtOwner; m_module = rtOwner.GetRuntimeModule(); } } m_skipVisibility = skipVisibility; } // initialize remaining fields m_ilGenerator = null; m_fInitLocals = true; m_methodHandle = null; if (name == null) { throw new ArgumentNullException(nameof(name)); } m_dynMethod = new RTDynamicMethod(this, name, attributes, callingConvention); }
/// <summary> /// 指定した 2 つのオブジェクトが等価であるかを判定する /// </summary> /// <param name="x">比較対象のオブジェクト</param> /// <param name="y">比較対象のオブジェクト</param> /// <returns>等価である場合は true、それ以外の場合は false</returns> public bool Equals(Module?x, Module?y) => x?.Equals(y) ?? false;
public static SignatureHelper GetMethodSigHelper(Module?mod, CallingConventions callingConvention, Type?returnType) { return(GetMethodSigHelper(mod, callingConvention, (CallingConvention)0, returnType, null)); }
private void ClearActiveParameter() { activeModule = null; activeParameter = null; UpdateAnnouncer(); }
public ModuleSlot(Module module, int count) { this.module = module; this.count = count; IsAggregated = true; }
public ModuleSlot(Module?module) { this.module = module; IsAggregated = false; }
public abstract Module?ProjectModule(Module?value);
private SignatureHelper(Module?mod, MdSigCallingConvention callingConvention, Type returnType, Type[]?requiredCustomModifiers, Type[]?optionalCustomModifiers) : this(mod, callingConvention, 0, returnType, requiredCustomModifiers, optionalCustomModifiers) { }
/// <summary> /// 指定のオブジェクトと等価であるかを判定する /// </summary> /// <param name="module">比較対象のオブジェクト</param> /// <returns>等価である場合は true、それ以外の場合は false</returns> public bool Equals(Module?module) => this.ModuleID == module?.ModuleID && this.ModuleTypeID == module.ModuleTypeID && this.Macro == module.Macro && this.MaxWorkers == module.MaxWorkers && this.WorkersCapacity == module.WorkersCapacity && this.NoBlueprint == module.NoBlueprint;
private void Init(Module?mod, MdSigCallingConvention callingConvention) { Init(mod, callingConvention, 0); }
internal extern Type InternalGetType(Module?module, string name, bool throwOnError, bool ignoreCase);
public static SignatureHelper GetMethodSigHelper(Module?mod, CallingConvention unmanagedCallConv, Type?returnType) { return(GetMethodSigHelper(mod, CallingConventions.Standard, unmanagedCallConv, returnType, null)); }
private DynamicMethod(string name, MethodAttributes attributes, CallingConventions callingConvention, Type?returnType, Type[]?parameterTypes, Type?owner, Module?m, bool skipVisibility, bool anonHosted, bool typeOwner) { if (name == null) { throw new ArgumentNullException(nameof(name)); } if (returnType == null) { returnType = typeof(void); } if (owner == null && typeOwner) { throw new ArgumentNullException(nameof(owner)); } if ((m == null) && !anonHosted) { throw new ArgumentNullException(nameof(m)); } if (parameterTypes != null) { for (int i = 0; i < parameterTypes.Length; ++i) { if (parameterTypes[i] == null) { throw new ArgumentException($"Parameter {i} is null"); } } } if (owner != null && (owner.IsArray || owner.IsInterface)) { throw new ArgumentException("Owner can't be an array or an interface."); } if (m == null) { m = AnonHostModuleHolder.AnonHostModule; } this.name = name; this.attributes = attributes | MethodAttributes.Static; this.callingConvention = callingConvention; this.returnType = returnType; this.parameters = parameterTypes; this.owner = owner; this.module = m; this.skipVisibility = skipVisibility; }
// FIXME: "Not implemented" public static SignatureHelper GetPropertySigHelper(Module?mod, Type?returnType, Type[]?parameterTypes) { throw new NotImplementedException(); }
internal static SignatureHelper GetMethodSigHelper(Module?mod, CallingConventions callingConvention, Type?returnType, int cGenericParam) { return(GetMethodSigHelper(mod, callingConvention, cGenericParam, returnType, null, null, null, null, null)); }
public static SignatureHelper GetLocalVarSigHelper(Module?mod) { return(new SignatureHelper(mod, MdSigCallingConvention.LocalSig)); }