static StackObject *get_ReflectionType_1(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 1);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            ILRuntime.CLR.TypeSystem.ILType instance_of_this_method = (ILRuntime.CLR.TypeSystem.ILType) typeof(ILRuntime.CLR.TypeSystem.ILType).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            var result_of_this_method = instance_of_this_method.ReflectionType;

            return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method));
        }
Exemplo n.º 2
0
        public IMethod GetVirtualMethod(IMethod method)
        {
            IType[] genericArguments = null;
            if (method.IsGenericInstance)
            {
                if (method is ILMethod)
                {
                    genericArguments = ((ILMethod)method).GenericArugmentsArray;
                }
                else
                {
                    genericArguments = ((CLRMethod)method).GenericArguments;
                }
            }

            var m = GetMethod(method.Name, method.Parameters, genericArguments, method.ReturnType, true);

            if (m == null && BaseType != null)
            {
                m = BaseType.GetVirtualMethod(method);
                if (m != null)
                {
                    return(m);
                }
            }
            if (m == null && method.DeclearingType.IsInterface)
            {
                if (method.DeclearingType is ILType)
                {
                    ILType iltype = (ILType)method.DeclearingType;
                    m = GetMethod(string.Format("{0}.{1}", iltype.FullNameForNested, method.Name), method.Parameters, genericArguments, method.ReturnType, true);
                }
                else
                {
                    m = GetMethod(string.Format("{0}.{1}", method.DeclearingType.FullName, method.Name), method.Parameters, genericArguments, method.ReturnType, true);
                }
            }

            if (m == null || m.IsGenericInstance == method.IsGenericInstance)
            {
                return(m);
            }
            else
            {
                return(method);
            }
        }
        static StackObject *Instantiate_0(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 2);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.Boolean @callDefaultConstructor = ptr_of_this_method->Value == 1;

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            ILRuntime.CLR.TypeSystem.ILType instance_of_this_method = (ILRuntime.CLR.TypeSystem.ILType) typeof(ILRuntime.CLR.TypeSystem.ILType).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            var result_of_this_method = instance_of_this_method.Instantiate(@callDefaultConstructor);

            return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method));
        }
        static StackObject *Ctor_0(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 2);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.Boolean @initializeCLRInstance = ptr_of_this_method->Value == 1;

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            ILRuntime.CLR.TypeSystem.ILType @type = (ILRuntime.CLR.TypeSystem.ILType) typeof(ILRuntime.CLR.TypeSystem.ILType).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags) 0);
            __intp.Free(ptr_of_this_method);


            var result_of_this_method = new ILRuntime.Runtime.Intepreter.ILTypeInstance(@type, @initializeCLRInstance);

            return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method));
        }
Exemplo n.º 5
0
        public IType MakeArrayType(int rank)
        {
            if (arrayTypes == null)
            {
                arrayTypes = new Dictionary <int, IType>();
            }
            IType atype;

            if (!arrayTypes.TryGetValue(rank, out atype))
            {
                var def = new ArrayType(typeRef, rank);
                atype = new ILType(def, appdomain);
                ((ILType)atype).IsArray      = true;
                ((ILType)atype).elementType  = this;
                ((ILType)atype).arrayCLRType = rank > 1 ? this.TypeForCLR.MakeArrayType(rank) : this.TypeForCLR.MakeArrayType();
                arrayTypes[rank]             = atype;
            }
            return(atype);
        }