protected sealed override RuntimeArrayType Factory(RuntimeType elementType) { // We only permit creating parameterized types if the pay-for-play policy specifically allows them *or* if the result // type would be an open type. RuntimeTypeHandle runtimeTypeHandle; RuntimeTypeHandle elementTypeHandle; if (elementType.InternalTryGetTypeHandle(out elementTypeHandle) && RuntimeAugments.Callbacks.TryGetMultiDimArrayTypeForElementType(elementTypeHandle, _rank, out runtimeTypeHandle)) { return((RuntimeArrayType)(RuntimeTypeUnifier.GetTypeForRuntimeTypeHandle(runtimeTypeHandle))); } if (elementType.IsByRef) { throw new TypeLoadException(SR.Format(SR.ArgumentException_InvalidArrayElementType, elementType)); } if (elementType.InternalIsGenericTypeDefinition) { throw new ArgumentException(SR.Format(SR.ArgumentException_InvalidArrayElementType, elementType)); } if (!elementType.InternalIsOpen) { throw RuntimeAugments.Callbacks.CreateMissingArrayTypeException(elementType, true, _rank); } return(new RuntimeInspectionOnlyArrayType(elementType, _rank)); }
protected sealed override RuntimeConstructedGenericType Factory(ConstructedGenericTypeKey key) { // We only permit creating parameterized types if the pay-for-play policy specifically allows them *or* if the result // type would be an open type. RuntimeTypeHandle runtimeTypeHandle; if (TryFindRuntimeTypeHandleForConstructedGenericType(key, out runtimeTypeHandle)) { return((RuntimeConstructedGenericType)(RuntimeTypeUnifier.GetTypeForRuntimeTypeHandle(runtimeTypeHandle))); } bool atLeastOneOpenType = false; foreach (RuntimeType genericTypeArgument in key.GenericTypeArguments) { if (genericTypeArgument.IsByRef || genericTypeArgument.InternalIsGenericTypeDefinition) { throw new ArgumentException(SR.Format(SR.ArgumentException_InvalidTypeArgument, genericTypeArgument)); } if (genericTypeArgument.InternalIsOpen) { atLeastOneOpenType = true; } } if (!atLeastOneOpenType) { throw RuntimeAugments.Callbacks.CreateMissingConstructedGenericTypeException(key.GenericTypeDefinition, key.GenericTypeArguments); } return(new RuntimeInspectionOnlyConstructedGenericType(key.GenericTypeDefinition, key.GenericTypeArguments)); }
protected sealed override RuntimePointerType Factory(RuntimeType elementType) { RuntimeTypeHandle thElementType; if (elementType.InternalTryGetTypeHandle(out thElementType)) { RuntimeTypeHandle thForPointerType; if (RuntimeAugments.Callbacks.TryGetPointerTypeForTargetType(thElementType, out thForPointerType)) { Debug.Assert(thForPointerType.Classification == RuntimeImports.RhEETypeClassification.UnmanagedPointer); return((RuntimePointerType)(RuntimeTypeUnifier.GetTypeForRuntimeTypeHandle(thForPointerType))); } } return(new RuntimeInspectionOnlyPointerType(elementType)); }
internal static RuntimeType GetRuntimeTypeForEEType(EETypePtr eeType) { return(RuntimeTypeUnifier.GetTypeForRuntimeTypeHandle(new RuntimeTypeHandle(eeType))); }
public static RuntimeType GetPointerType(RuntimeType targetType) { return(RuntimeTypeUnifier.GetPointerType(targetType)); }
public static RuntimeType GetTypeForRuntimeTypeHandle(RuntimeTypeHandle runtimeTypeHandle) { return(RuntimeTypeUnifier.GetTypeForRuntimeTypeHandle(runtimeTypeHandle)); }
public static RuntimeType GetConstructedGenericType(RuntimeType genericTypeDefinition, RuntimeType[] genericTypeArguments) { return(RuntimeTypeUnifier.GetConstructedGenericType(genericTypeDefinition, genericTypeArguments)); }
public static RuntimeType GetByRefType(RuntimeType targetType) { return(RuntimeTypeUnifier.GetByRefType(targetType)); }
public static RuntimeType GetMultiDimArrayType(RuntimeType elementType, int rank) { return(RuntimeTypeUnifier.GetMultiDimArrayType(elementType, rank)); }
public static RuntimeType GetArrayType(RuntimeType elementType) { return(RuntimeTypeUnifier.GetArrayType(elementType)); }
internal static Type GetTypeForRuntimeTypeHandle(RuntimeTypeHandle runtimeTypeHandle) { return(RuntimeTypeUnifier.GetTypeForRuntimeTypeHandle(runtimeTypeHandle)); }