mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-17 07:44:09 +02:00
Improved generic param reflection in comptime
This commit is contained in:
parent
157d3f90e5
commit
26506efc1e
9 changed files with 143 additions and 19 deletions
|
@ -482,6 +482,7 @@ namespace System
|
|||
|
||||
static extern Type Comptime_GetTypeById(int32 typeId);
|
||||
static extern Type Comptime_GetTypeByName(StringView name);
|
||||
static extern String Comptime_Type_ToString(int32 typeId);
|
||||
static extern Type Comptime_GetSpecializedType(Type unspecializedType, Span<Type> typeArgs);
|
||||
static extern bool Comptime_Type_GetCustomAttribute(int32 typeId, int32 attributeId, void* dataPtr);
|
||||
static extern int32 Comptime_GetMethodCount(int32 typeId);
|
||||
|
@ -548,6 +549,12 @@ namespace System
|
|||
}
|
||||
}
|
||||
|
||||
void ComptimeToString(String strBuffer)
|
||||
{
|
||||
if (Compiler.IsComptime)
|
||||
strBuffer.Append(Comptime_Type_ToString((.)mTypeId));
|
||||
}
|
||||
|
||||
public virtual void GetFullName(String strBuffer)
|
||||
{
|
||||
GetBasicName(strBuffer);
|
||||
|
@ -1261,6 +1268,23 @@ namespace System.Reflection
|
|||
}
|
||||
}
|
||||
|
||||
[Ordered, AlwaysInclude(AssumeInstantiated=true)]
|
||||
class GenericParamType : Type
|
||||
{
|
||||
public override void GetName(String strBuffer)
|
||||
{
|
||||
if (Compiler.IsComptime)
|
||||
this.[Friend]ComptimeToString(strBuffer);
|
||||
else
|
||||
strBuffer.Append("$GenericParam");
|
||||
}
|
||||
|
||||
public override void GetFullName(String strBuffer)
|
||||
{
|
||||
GetName(strBuffer);
|
||||
}
|
||||
}
|
||||
|
||||
public enum TypeFlags : uint32
|
||||
{
|
||||
UnspecializedGeneric = 0x0001,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue