1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-25 19:18:01 +02:00

Fixed comptime reflected static field accesses

This commit is contained in:
Brian Fiete 2024-01-22 08:12:15 -05:00
parent 4176f7369d
commit a356186514
7 changed files with 177 additions and 16 deletions

View file

@ -327,6 +327,14 @@ namespace System.Reflection
if (!mFieldData.mFlags.HasFlag(FieldFlags.Static))
return .Err(.InvalidTargetType);
if (Compiler.IsComptime)
{
void* dataPtr = Type.[Friend]Comptime_Field_GetStatic((int32)mTypeInstance.TypeId, (int32)mFieldData.mData);
if (dataPtr != null)
value = *(TMember*)dataPtr;
return .Ok;
}
targetDataAddr = null;
}
else

View file

@ -567,6 +567,7 @@ namespace System
static extern Type Comptime_Method_GetGenericArg(int64 methodHandle, int32 genericArgIdx);
static extern String Comptime_Field_GetName(int64 fieldHandle);
static extern ComptimeFieldInfo Comptime_Field_GetInfo(int64 fieldHandle);
static extern void* Comptime_Field_GetStatic(int32 typeId, int32 fieldIdx);
protected static Type GetType(TypeId typeId)
{