Пример #1
0
        public static SignatureHelper GetMethodSigHelper(Module mod, CallingConvention unmanagedCallConv, Type returnType)
        {
            byte type;

            switch (unmanagedCallConv)
            {
            case CallingConvention.Cdecl:
                type = 0x01;                            // C
                break;

            case CallingConvention.StdCall:
            case CallingConvention.Winapi:
                type = 0x02;                            // STDCALL
                break;

            case CallingConvention.ThisCall:
                type = 0x03;                            // THISCALL
                break;

            case CallingConvention.FastCall:
                type = 0x04;                            // FASTCALL
                break;

            default:
                throw new ArgumentOutOfRangeException("unmanagedCallConv");
            }
            SignatureHelper sig = Create(mod, type, returnType);

            sig.AddArgument(returnType);
            sig.paramCount = 0;
            return(sig);
        }
Пример #2
0
        public static SignatureHelper GetMethodSigHelper(Module mod, Type returnType, Type[] parameterTypes)
        {
            SignatureHelper sig = Create(mod, 0, returnType);

            sig.AddArgument(returnType);
            sig.paramCount = 0;
            sig.AddArguments(parameterTypes, null, null);
            return(sig);
        }
Пример #3
0
		public LocalBuilder DeclareLocal(Type localType, bool pinned)
		{
			LocalBuilder local = new LocalBuilder(localType, localsCount++, pinned);
			locals.AddArgument(localType, pinned);
			if (scope != null)
			{
				scope.locals.Add(local);
			}
			return local;
		}
Пример #4
0
        public static SignatureHelper GetPropertySigHelper(Module mod, Type returnType, Type[] parameterTypes)
        {
            SignatureHelper sig = new SignatureHelper(mod as ModuleBuilder, Signature.PROPERTY);

            sig.returnType = returnType;
            foreach (Type type in parameterTypes)
            {
                sig.AddArgument(type);
            }
            return(sig);
        }
Пример #5
0
        public static SignatureHelper GetMethodSigHelper(Module mod, Type returnType, Type[] parameterTypes)
        {
            SignatureHelper sig = new SignatureHelper(mod as ModuleBuilder, 0);

            sig.returnType        = returnType;
            sig.callingConvention = CallingConventions.Standard;
            foreach (Type type in parameterTypes)
            {
                sig.AddArgument(type);
            }
            return(sig);
        }
Пример #6
0
        public static SignatureHelper GetPropertySigHelper(Module mod, Type returnType, Type[] parameterTypes)
        {
            SignatureHelper sig = new SignatureHelper(mod as ModuleBuilder, Signature.PROPERTY);

            sig.returnType = returnType;
            sig.returnTypeOptionalCustomModifiers = Type.EmptyTypes;
            sig.returnTypeRequiredCustomModifiers = Type.EmptyTypes;
            foreach (Type type in parameterTypes)
            {
                sig.AddArgument(type);
            }
            return(sig);
        }
Пример #7
0
        public static SignatureHelper GetPropertySigHelper(Module mod, CallingConventions callingConvention, Type returnType, Type[] requiredReturnTypeCustomModifiers, Type[] optionalReturnTypeCustomModifiers, Type[] parameterTypes, Type[][] requiredParameterTypeCustomModifiers, Type[][] optionalParameterTypeCustomModifiers)
        {
            byte type = Signature.PROPERTY;

            if ((callingConvention & CallingConventions.HasThis) != 0)
            {
                type |= Signature.HASTHIS;
            }
            SignatureHelper sig = Create(mod, type, returnType);

            sig.AddArgument(returnType, requiredReturnTypeCustomModifiers, optionalReturnTypeCustomModifiers);
            sig.paramCount = 0;
            sig.AddArguments(parameterTypes, requiredParameterTypeCustomModifiers, optionalParameterTypeCustomModifiers);
            return(sig);
        }
Пример #8
0
        public static SignatureHelper GetMethodSigHelper(Module mod, CallingConventions callingConvention, Type returnType)
        {
            byte type = 0;

            if ((callingConvention & CallingConventions.HasThis) != 0)
            {
                type |= Signature.HASTHIS;
            }
            if ((callingConvention & CallingConventions.ExplicitThis) != 0)
            {
                type |= Signature.EXPLICITTHIS;
            }
            if ((callingConvention & CallingConventions.VarArgs) != 0)
            {
                type |= Signature.VARARG;
            }
            SignatureHelper sig = Create(mod, type, returnType);

            sig.AddArgument(returnType);
            sig.paramCount = 0;
            return(sig);
        }
Пример #9
0
		public static SignatureHelper GetPropertySigHelper(Module mod, Type returnType, Type[] parameterTypes)
		{
			SignatureHelper sig = new SignatureHelper(mod as ModuleBuilder, Signature.PROPERTY);
			sig.returnType = returnType;
			sig.returnTypeOptionalCustomModifiers = Type.EmptyTypes;
			sig.returnTypeRequiredCustomModifiers = Type.EmptyTypes;
			foreach (Type type in parameterTypes)
			{
				sig.AddArgument(type);
			}
			return sig;
		}
Пример #10
0
		public static SignatureHelper GetMethodSigHelper(Module mod, Type returnType, Type[] parameterTypes)
		{
			SignatureHelper sig = new SignatureHelper(mod as ModuleBuilder, 0);
			sig.returnType = returnType;
			sig.callingConvention = CallingConventions.Standard;
			foreach (Type type in parameterTypes)
			{
				sig.AddArgument(type);
			}
			return sig;
		}
		public static SignatureHelper GetPropertySigHelper(Module mod, Type returnType, Type[] parameterTypes)
		{
			SignatureHelper sig = new SignatureHelper(mod as ModuleBuilder, Signature.PROPERTY);
			sig.returnType = returnType;
			foreach (Type type in parameterTypes)
			{
				sig.AddArgument(type);
			}
			return sig;
		}