public RuntimeTypeInfo(RuntimeType type, Assembly assembly)
{
var handle = type.TypeHandle;
asType = type;
this.assembly = assembly;
//this.handle = handle;
typeStruct = (MetadataTypeStruct*)((uint**)&handle)[0];
assemblyQualifiedName = Mosa.Runtime.Internal.InitializeMetadataString(typeStruct->Name); // TODO
name = Mosa.Runtime.Internal.InitializeMetadataString(typeStruct->Name); // TODO
@namespace = Mosa.Runtime.Internal.InitializeMetadataString(typeStruct->Name); // TODO
fullname = Mosa.Runtime.Internal.InitializeMetadataString(typeStruct->Name);
typeCode = (TypeCode)(typeStruct->Attributes >> 24);
attributes = (TypeAttributes)(typeStruct->Attributes & 0x00FFFFFF);
// Base Type
if (typeStruct->ParentType != null)
{
RuntimeTypeHandle parentHandle = new RuntimeTypeHandle();
((uint**)&parentHandle)[0] = (uint*)typeStruct->ParentType;
baseType = Type.GetTypeFromHandle(parentHandle);
}
// Declaring Type
if (typeStruct->DeclaringType != null)
{
RuntimeTypeHandle declaringHandle = new RuntimeTypeHandle();
((uint**)&declaringHandle)[0] = (uint*)typeStruct->DeclaringType;
declaringType = Type.GetTypeFromHandle(declaringHandle);
}
// Element Type
if (typeStruct->ElementType != null)
{
RuntimeTypeHandle elementHandle = new RuntimeTypeHandle();
((uint**)&elementHandle)[0] = (uint*)typeStruct->ElementType;
elementType = Type.GetTypeFromHandle(elementHandle);
}
}