1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-22 01:37:59 +02:00

Reflection support for method param attributes, return attributes

This commit is contained in:
Brian Fiete 2021-07-06 10:55:38 -07:00
parent 19513d3310
commit c10565678e
4 changed files with 38 additions and 14 deletions

View file

@ -37,11 +37,22 @@ namespace System.Reflection
return mMethodData.mParamData[paramIdx].mName;
}
public Result<T> GetParamCustomAttribute<T>(int paramIdx) where T : Attribute
{
Debug.Assert((uint)paramIdx < (uint)mMethodData.mParamCount);
return mTypeInstance.[Friend]GetCustomAttribute<T>(mMethodData.mParamData[paramIdx].mCustomAttributesIdx);
}
public Result<T> GetCustomAttribute<T>() where T : Attribute
{
return mTypeInstance.[Friend]GetCustomAttribute<T>(mMethodData.mCustomAttributesIdx);
}
public Result<T> GetReturnCustomAttribute<T>() where T : Attribute
{
return mTypeInstance.[Friend]GetCustomAttribute<T>(mMethodData.mReturnCustomAttributesIdx);
}
public enum CallError
{
case None;

View file

@ -718,6 +718,7 @@ namespace System.Reflection
public int32 mMethodIdx;
public int32 mVirtualIdx;
public int32 mCustomAttributesIdx;
public int32 mReturnCustomAttributesIdx;
}
public enum ParamFlags : int16
@ -734,6 +735,7 @@ namespace System.Reflection
public TypeId mType;
public ParamFlags mParamFlags;
public int32 mDefaultIdx;
public int32 mCustomAttributesIdx;
}
public struct InterfaceData