internal TypeDesc(ExecutionEngine executionEngine, Type reflType) { executionEngine.Context._types.Add(reflType, this); _executionEngine = executionEngine; _reflType = reflType; _typeHandle = reflType.TypeHandle.Value; _module = executionEngine.ResolveModule(reflType.Module); _metadataToken = reflType.MetadataToken; _instantiation = reflType.IsGenericType ? reflType.GetGenericArguments().Select(t => executionEngine.ResolveType(t)).ToArray() : null; _annotatedElementType = (AnnotatedElementType)GetElementType(); // not redundant code, GetAnnotatedElementType will use _elementType field (see IsValueType) _size = IsValueType ? SizeOf(reflType) : sizeof(nint); _alignedSize = IsValueType ? AlignedSizeOf(_typeHandle) : sizeof(nint); _attributes = reflType.Attributes; _annotatedElementType = GetAnnotatedElementType(); _isCOMObject = _reflType.IsCOMObject; _genericParameterIndex = IsGenericParameter ? reflType.GenericParameterPosition : 0; _fields = new List <FieldDesc>(); _methods = new List <MethodDesc>(); }
/// <summary> /// Is <see cref="AnnotatedElementType.Unmanaged"/> set /// </summary> /// <param name="annotatedElementType"></param> /// <returns></returns> public static bool IsUnmanaged(this AnnotatedElementType annotatedElementType) { return((annotatedElementType & AnnotatedElementType.Unmanaged) != 0); }
/// <summary> /// Is <see cref="AnnotatedElementType.LargeValueType"/> set /// </summary> /// <param name="annotatedElementType"></param> /// <returns></returns> public static bool IsLargeValueType(this AnnotatedElementType annotatedElementType) { return((annotatedElementType & AnnotatedElementType.LargeValueType) != 0); }