예제 #1
0
 public IType MakeArrayType()
 {
     if (arrayType == null)
     {
         Type t = clrType.MakeArrayType();
         arrayType = new CLRType(t, appdomain);
     }
     return(arrayType);
 }
예제 #2
0
 public IType MakeArrayType()
 {
     if (arrayType == null)
     {
         Type t = clrType.MakeArrayType();
         arrayType = new CLRType(t, appdomain);
         ((CLRType)arrayType).elementType = this;
         ((CLRType)arrayType).IsArray     = true;
     }
     return(arrayType);
 }
예제 #3
0
        static StackObject *get_GenericArguments_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, 1);

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

            var result_of_this_method = instance_of_this_method.GenericArguments;

            return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method));
        }
예제 #4
0
파일: CLRType.cs 프로젝트: qq21/XIL
        public IType MakeArrayType(int rank)
        {
            if (arrayTypes == null)
            {
                arrayTypes = new Dictionary <int, IType>();
            }
            IType atype;

            if (!arrayTypes.TryGetValue(rank, out atype))
            {
                Type t = rank > 1 ? clrType.MakeArrayType(rank) : clrType.MakeArrayType();
                atype = new CLRType(t, appdomain);
                ((CLRType)atype).elementType = this;
                ((CLRType)atype).IsArray     = true;
                ((CLRType)atype).ArrayRank   = rank;
                arrayTypes[rank]             = atype;
            }
            return(atype);
        }
예제 #5
0
        public IType MakeGenericInstance(KeyValuePair <string, IType>[] genericArguments)
        {
            lock (this)
            {
                if (genericInstances == null)
                {
                    genericInstances = new List <CLRType>();
                }
                foreach (var i in genericInstances)
                {
                    bool match = true;
                    for (int j = 0; j < genericArguments.Length; j++)
                    {
                        if (i.genericArguments[j].Value != genericArguments[j].Value)
                        {
                            match = false;
                            break;
                        }
                    }
                    if (match)
                    {
                        return(i);
                    }
                }
                Type[] args = new Type[genericArguments.Length];
                for (int i = 0; i < genericArguments.Length; i++)
                {
                    args[i] = genericArguments[i].Value.TypeForCLR;
                }
                Type newType = clrType.MakeGenericType(args);
                var  res     = new CLRType(newType, appdomain)
                {
                    genericArguments = genericArguments
                };

                genericInstances.Add(res);
                return(res);
            }
        }