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

Support System.Compiler values in comptime, SetReturnType, Enum helpers

This commit is contained in:
Brian Fiete 2022-06-23 11:53:21 -07:00
parent 0e86b5c49d
commit 2a55b5c7bb
14 changed files with 341 additions and 63 deletions

View file

@ -259,6 +259,9 @@ namespace System
[LinkName("#CallerExpression")]
public static extern String[0x00FFFFFF] CallerExpression;
[LinkName("#OrigCalleeType")]
public static extern Type OrigCalleeType;
[LinkName("#ProjectName")]
public static extern String ProjectName;
@ -287,6 +290,7 @@ namespace System
Runtime.FatalError("Assert failed");
}
static extern void Comptime_SetReturnType(int32 typeId);
static extern void* Comptime_MethodBuilder_EmitStr(void* native, StringView str);
static extern void* Comptime_CreateMethod(int32 typeId, StringView methodName, Type returnType, MethodFlags methodFlags);
static extern void Comptime_EmitTypeBody(int32 typeId, StringView text);
@ -309,6 +313,12 @@ namespace System
Comptime_EmitTypeBody((.)owner.TypeId, text);
}
[Comptime(OnlyFromComptime=true)]
public static void SetReturnType(Type type)
{
Comptime_SetReturnType((.)type.TypeId);
}
[Comptime(OnlyFromComptime=true)]
public static void EmitAddInterface(Type owner, Type iface)
{