1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-17 23:56:05 +02:00

Reflection support for methods and types

This commit is contained in:
Brian Fiete 2020-05-28 07:36:34 -07:00
parent f1eafa8d81
commit be6a132fb5
4 changed files with 61 additions and 19 deletions

View file

@ -143,18 +143,7 @@ namespace System.Reflection
public Result<T> GetCustomAttribute<T>() where T : Attribute
{
if (mFieldData.mCustomAttributesIdx == -1)
return .Err;
void* data = mTypeInstance.[Friend]mCustomAttrDataPtr[mFieldData.mCustomAttributesIdx];
T attrInst = ?;
switch (AttributeInfo.GetCustomAttribute(data, typeof(T), &attrInst))
{
case .Ok: return .Ok(attrInst);
default:
return .Err;
}
return mTypeInstance.[Friend]GetCustomAttribute<T>(mFieldData.mCustomAttributesIdx);
}
void* GetDataPtrAndType(Object value, out Type type)