Exemple #1
0
        private TypeReference TypeReferenceFor(TypeNameParseInfo typeNameInfo)
        {
            TypeReference typeByName = this.GetTypeByName(CecilElementTypeNameFor(typeNameInfo), typeNameInfo.Assembly);

            if (typeByName == null)
            {
                throw new TypeResolutionException(typeNameInfo);
            }
            if (typeNameInfo.HasGenericArguments)
            {
                GenericInstanceType genericInstanceType = new GenericInstanceType(typeByName);
                foreach (TypeNameParseInfo info in typeNameInfo.TypeArguments)
                {
                    genericInstanceType.GenericArguments.Add(this.TypeReferenceFor(info));
                }
                genericInstanceType.Accept(this._visitor);
                typeByName = genericInstanceType;
            }
            if (typeNameInfo.IsPointer)
            {
                throw new TypeResolutionException(typeNameInfo);
            }
            if (!typeNameInfo.IsArray)
            {
                return(typeByName);
            }
            ArrayType type2 = new ArrayType(typeByName, typeNameInfo.Ranks[0]);

            for (int i = 1; i < typeNameInfo.Ranks.Length; i++)
            {
                type2 = new ArrayType(type2, typeNameInfo.Ranks[i]);
            }
            type2.Accept(this._visitor);
            return(type2);
        }
 public override DataType VisitArray(ArrayType at)
 {
     if (insideComplexType)
     {
         var nctr = new NestedComplexTypeExtractor(factory, store);
         at.Accept(nctr);
         return at;
     }
     else
     {
         insideComplexType = true;
         return base.VisitArray(at);
     }
 }
 public override DataType VisitArray(ArrayType at)
 {
     if (insideComplexType)
     {
         var nctr = new NestedComplexTypeExtractor(factory, store);
         at.Accept(nctr);
         return(at);
     }
     else
     {
         insideComplexType = true;
         return(base.VisitArray(at));
     }
 }