コード例 #1
0
        public override void Emit(OpCode opcode, ConstructorInfo con)
        {
            if (con == null)
            {
                throw new ArgumentNullException(nameof(con));
            }

            RuntimeConstructorInfo rtConstructor = con as RuntimeConstructorInfo;

            if (rtConstructor == null)
            {
                throw new ArgumentException(SR.Argument_MustBeRuntimeMethodInfo, nameof(con));
            }

            RuntimeType declaringType = rtConstructor.GetRuntimeType();
            int         token;

            if (declaringType != null && (declaringType.IsGenericType || declaringType.IsArray))
            {
                // need to sort out the stack size story
                token = GetTokenFor(rtConstructor, declaringType);
            }
            else
            {
                token = GetTokenFor(rtConstructor);
            }

            EnsureCapacity(7);
            InternalEmit(opcode);

            // need to sort out the stack size story
            UpdateStackSize(opcode, 1);

            PutInteger4(token);
        }
コード例 #2
0
        public override void Emit(OpCode opcode, ConstructorInfo con)
        {
            if (con == null)
            {
                throw new ArgumentNullException("con");
            }
            RuntimeConstructorInfo runtimeConstructorInfo = con as RuntimeConstructorInfo;

            if (runtimeConstructorInfo == null)
            {
                throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeMethodInfo"), "con");
            }
            RuntimeType runtimeType = runtimeConstructorInfo.GetRuntimeType();
            int         tokenFor;

            if (runtimeType != null && (runtimeType.IsGenericType || runtimeType.IsArray))
            {
                tokenFor = this.GetTokenFor(runtimeConstructorInfo, runtimeType);
            }
            else
            {
                tokenFor = this.GetTokenFor(runtimeConstructorInfo);
            }
            base.EnsureCapacity(7);
            base.InternalEmit(opcode);
            base.UpdateStackSize(opcode, 1);
            base.PutInteger4(tokenFor);
        }
コード例 #3
0
        public override void Emit(OpCode opcode, ConstructorInfo con)
        {
            if (con == (ConstructorInfo)null)
            {
                throw new ArgumentNullException("con");
            }
            RuntimeConstructorInfo rtMeth = con as RuntimeConstructorInfo;

            if ((ConstructorInfo)rtMeth == (ConstructorInfo)null)
            {
                throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeMethodInfo"), "con");
            }
            RuntimeType runtimeType = rtMeth.GetRuntimeType();
            int         num         = !(runtimeType != (RuntimeType)null) || !runtimeType.IsGenericType && !runtimeType.IsArray ? this.GetTokenFor(rtMeth) : this.GetTokenFor(rtMeth, runtimeType);

            this.EnsureCapacity(7);
            this.InternalEmit(opcode);
            this.UpdateStackSize(opcode, 1);
            this.PutInteger4(num);
        }