mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-20 17:08:00 +02:00
Comptime improvments, IOn<X> interfaces, const payload enum
This commit is contained in:
parent
e7fe91facb
commit
f37fb2c1b7
20 changed files with 884 additions and 364 deletions
|
@ -540,6 +540,26 @@ namespace System
|
|||
}
|
||||
}
|
||||
|
||||
interface IOnTypeInit
|
||||
{
|
||||
void OnTypeInit(Type type, Self* prev) mut;
|
||||
}
|
||||
|
||||
interface IOnTypeDone
|
||||
{
|
||||
void OnTypeDone(Type type, Self* prev) mut;
|
||||
}
|
||||
|
||||
interface IOnFieldInit
|
||||
{
|
||||
void OnFieldInit(ComptimeFieldInfo type, Self* prev) mut;
|
||||
}
|
||||
|
||||
interface IOnMethodInit
|
||||
{
|
||||
void OnMethodInit(ComptimeMethodInfo type, Self* prev) mut;
|
||||
}
|
||||
|
||||
interface IComptimeTypeApply
|
||||
{
|
||||
void ApplyToType(Type type);
|
||||
|
|
|
@ -44,8 +44,8 @@ namespace System.IO
|
|||
if (bytes == 0)
|
||||
return .Ok;
|
||||
outData.AddRange(.(&buffer, bytes));
|
||||
case .Err(let err):
|
||||
return .Err(err);
|
||||
case .Err:
|
||||
return .Err(.Unknown);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -150,4 +150,31 @@ namespace System.Reflection
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Ordered]
|
||||
struct ComptimeFieldInfo
|
||||
{
|
||||
int64 mNativeFieldInstance;
|
||||
TypeId mOwner;
|
||||
TypeId mTypeId;
|
||||
int32 mFieldIdx;
|
||||
FieldFlags mFlags;
|
||||
|
||||
public StringView Name
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Compiler.IsComptime)
|
||||
return Type.[Friend]Comptime_Field_GetName(mNativeFieldInstance);
|
||||
return "?";
|
||||
}
|
||||
}
|
||||
|
||||
public Type Owner => Type.[Friend]GetType_((.)mOwner);
|
||||
public Type FieldType => Type.[Friend]GetType_((.)mTypeId);
|
||||
public int FieldIdx => mFieldIdx;
|
||||
public bool IsConst => mFlags.HasFlag(.Const);
|
||||
public bool IsStatic => mFlags.HasFlag(.Static);
|
||||
public bool IsInstanceField => !mFlags.HasFlag(.Static) && !mFlags.HasFlag(.Const);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -159,6 +159,7 @@ namespace System
|
|||
.Int16,
|
||||
.Int32,
|
||||
.Int64,
|
||||
.Int,
|
||||
.Float,
|
||||
.Double:
|
||||
return true;
|
||||
|
@ -483,6 +484,15 @@ namespace System
|
|||
}
|
||||
}
|
||||
|
||||
public virtual int32 BitSize
|
||||
{
|
||||
[Error("This property can only be accessed directly from a typeof() expression")]
|
||||
get
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public int32 GetTypeId()
|
||||
{
|
||||
return (int32)mTypeId;
|
||||
|
@ -497,6 +507,7 @@ namespace System
|
|||
static extern int64 Comptime_GetMethod(int32 typeId, int32 methodIdx);
|
||||
static extern String Comptime_Method_ToString(int64 methodHandle);
|
||||
static extern String Comptime_Method_GetName(int64 methodHandle);
|
||||
static extern String Comptime_Field_GetName(int64 fieldHandle);
|
||||
static extern ComptimeMethodInfo.Info Comptime_Method_GetInfo(int64 methodHandle);
|
||||
static extern ComptimeMethodInfo.ParamInfo Comptime_Method_GetParamInfo(int64 methodHandle, int32 paramIdx);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue