/// <summary>get or create the boxed value type(s) for a .NET arrayType</summary>
 internal Type GetOrCreateBoxedTypeForArray(Type arrayType)
 {
     if (!arrayType.IsArray)
     {
         // an array-type is required for calling GetOrCreateBoxedTypeForArray
         throw new INTERNAL(10050, CompletionStatus.Completed_MayBe);
     }
     lock (this) {
         // for the .NET / .NET case, check if already a boxed type has been created by the idl to cls compiler
         // the repository id, which will identify the boxed value type generated for clsArrayType
         // will be used to check, if this boxed value type has already been created by the idl to cls mapping.
         string repIdForType = (string)m_repIdsForBoxedArrays[arrayType];
         if (repIdForType == null)
         {
             repIdForType = m_boxedValGen.GetRepositoryIDForBoxedArrayType(arrayType);
             m_repIdsForBoxedArrays[arrayType] = repIdForType;
         }
         // repository knows all the types, ask for type for rep-id
         Type result = Repository.GetTypeForId(repIdForType);
         if (result == null)
         {
             // no type found,
             // create the boxed value type(s) for the array
             TypeBuilder resultBuild = m_boxedValGen.CreateBoxedTypeForArray(arrayType, m_modBuilder, this);
             result = resultBuild.CreateType();
             Repository.RegisterDynamicallyCreatedType(result);
         }
         return(result);
     }
 }
Esempio n. 2
0
 /// <summary>
 /// create the type with name fullname, described by forTypeCode!
 /// </summary>
 /// <param name="fullname"></param>
 /// <param name="forTypeCode"></param>
 /// <returns></returns>
 internal Type CreateOrGetType(string fullname, TypeCodeImpl forTypeCode)
 {
     lock (this) {
         Type result = RetrieveType(fullname);
         if (result == null)
         {
             result = forTypeCode.CreateType(m_modBuilder, fullname);
             Repository.RegisterDynamicallyCreatedType(result);
         }
         return(result);
     }
 }