1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-07-02 22:36:00 +02:00

Added GetGenericArgType to MethodInfo

This commit is contained in:
Brian Fiete 2022-04-17 12:43:49 -07:00
parent 7e59c7fb93
commit 6a8bbd1240
4 changed files with 54 additions and 5 deletions

View file

@ -55,6 +55,9 @@ namespace System.Reflection
public int ParamCount => Compiler.IsComptime ?
Type.[Friend]Comptime_Method_GetInfo(mData.mComptimeMethodInstance).mParamCount :
mData.mMethodData.[Friend]mParamCount;
public int GenericArgCount => Compiler.IsComptime ?
Type.[Friend]Comptime_Method_GetInfo(mData.mComptimeMethodInstance).mGenericArgCount :
0;
public bool IsConstructor => Compiler.IsComptime ?
(Name == "__BfCtor" || Name == "__BfStaticCtor") :
@ -81,6 +84,18 @@ namespace System.Reflection
}
}
public Type GetGenericArgType(int genericArgIdx)
{
if (Compiler.IsComptime)
{
return Type.[Friend]Comptime_Method_GetGenericArg(mData.mComptimeMethodInstance, (.)genericArgIdx);
}
else
{
Runtime.FatalError();
}
}
public StringView GetParamName(int paramIdx)
{
if (Compiler.IsComptime)

View file

@ -503,6 +503,7 @@ namespace System
{
public int32 mReturnTypeId;
public int32 mParamCount;
public int32 mGenericArgCount;
public MethodFlags mMethodFlags;
public int32 mMethodIdx;
}
@ -540,6 +541,7 @@ namespace System
static extern String Comptime_Method_GetName(int64 methodHandle);
static extern ComptimeMethodData Comptime_Method_GetInfo(int64 methodHandle);
static extern ComptimeParamInfo Comptime_Method_GetParamInfo(int64 methodHandle, int32 paramIdx);
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);