コード例 #1
0
 public static SignatureHelper GetPropertySigHelper(Module?mod, Type?returnType, Type[]?parameterTypes)
 {
     return(GetPropertySigHelper(mod, returnType, null, null, parameterTypes, null, null));
 }
コード例 #2
0
        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);
        }
コード例 #3
0
 private void SetActiveParameter(Module module, int parameter)
 {
     activeModule = module;
     activeParameter = parameter;
     UpdateAnnouncer();
 }
コード例 #4
0
 public static SignatureHelper GetFieldSigHelper(Module?mod)
 {
     return(new SignatureHelper(mod, MdSigCallingConvention.Field));
 }
コード例 #5
0
 public static SignatureHelper GetMethodSigHelper(Module?mod, Type?returnType, Type[]?parameterTypes)
 {
     return(GetMethodSigHelper(mod, CallingConventions.Standard, (CallingConvention)0, returnType, parameterTypes));
 }
コード例 #6
0
        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);
        }
コード例 #7
0
 /// <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;
コード例 #8
0
 public static SignatureHelper GetMethodSigHelper(Module?mod, CallingConventions callingConvention, Type?returnType)
 {
     return(GetMethodSigHelper(mod, callingConvention, (CallingConvention)0, returnType, null));
 }
コード例 #9
0
 private void SetActiveParameter(Module module, int parameter)
 {
     activeModule    = module;
     activeParameter = parameter;
     UpdateAnnouncer();
 }
コード例 #10
0
 private void ClearActiveParameter()
 {
     activeModule    = null;
     activeParameter = null;
     UpdateAnnouncer();
 }
コード例 #11
0
ファイル: NodeOptionsViewModel.cs プロジェクト: gix/foreman
 public ModuleSlot(Module module, int count)
 {
     this.module  = module;
     this.count   = count;
     IsAggregated = true;
 }
コード例 #12
0
ファイル: NodeOptionsViewModel.cs プロジェクト: gix/foreman
 public ModuleSlot(Module?module)
 {
     this.module  = module;
     IsAggregated = false;
 }
コード例 #13
0
ファイル: Projector.cs プロジェクト: z77ma/runtime
 public abstract Module?ProjectModule(Module?value);
コード例 #14
0
 private SignatureHelper(Module?mod, MdSigCallingConvention callingConvention,
                         Type returnType, Type[]?requiredCustomModifiers, Type[]?optionalCustomModifiers)
     : this(mod, callingConvention, 0, returnType, requiredCustomModifiers, optionalCustomModifiers)
 {
 }
コード例 #15
0
 /// <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;
コード例 #16
0
 private void Init(Module?mod, MdSigCallingConvention callingConvention)
 {
     Init(mod, callingConvention, 0);
 }
コード例 #17
0
 internal extern Type InternalGetType(Module?module, string name, bool throwOnError, bool ignoreCase);
コード例 #18
0
 public static SignatureHelper GetMethodSigHelper(Module?mod, CallingConvention unmanagedCallConv, Type?returnType)
 {
     return(GetMethodSigHelper(mod, CallingConventions.Standard, unmanagedCallConv, returnType, null));
 }
コード例 #19
0
        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;
        }
コード例 #20
0
 // FIXME: "Not implemented"
 public static SignatureHelper GetPropertySigHelper(Module?mod, Type?returnType, Type[]?parameterTypes)
 {
     throw new NotImplementedException();
 }
コード例 #21
0
ファイル: SignatureHelper.cs プロジェクト: PeterG75/coreclr
 internal static SignatureHelper GetMethodSigHelper(Module?mod, CallingConventions callingConvention, Type?returnType, int cGenericParam)
 {
     return(GetMethodSigHelper(mod, callingConvention, cGenericParam, returnType, null, null, null, null, null));
 }
コード例 #22
0
 public static SignatureHelper GetLocalVarSigHelper(Module?mod)
 {
     return(new SignatureHelper(mod, MdSigCallingConvention.LocalSig));
 }
コード例 #23
0
 private void ClearActiveParameter()
 {
     activeModule = null;
     activeParameter = null;
     UpdateAnnouncer();
 }