1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-17 15:46:05 +02:00

Add GetCustomAttributes

This commit is contained in:
disarray2077 2022-02-26 13:43:56 -03:00
parent 3dd4212ccd
commit 9eecf83c22
4 changed files with 329 additions and 0 deletions

View file

@ -92,6 +92,22 @@ namespace System.Reflection
return mTypeInstance.[Friend]GetCustomAttribute<T>(mData.mMethodData.mParamData[paramIdx].mCustomAttributesIdx);
}
public AttributeInfo.CustomAttributeEnumerator GetParamCustomAttributes(int paramIdx)
{
if (Compiler.IsComptime)
Runtime.NotImplemented();
Debug.Assert((uint)paramIdx < (uint)mData.mMethodData.mParamCount);
return mTypeInstance.[Friend]GetCustomAttributes(mData.mMethodData.mParamData[paramIdx].mCustomAttributesIdx);
}
public AttributeInfo.CustomAttributeEnumerator<T> GetParamCustomAttributes<T>(int paramIdx) where T : Attribute
{
if (Compiler.IsComptime)
Runtime.NotImplemented();
Debug.Assert((uint)paramIdx < (uint)mData.mMethodData.mParamCount);
return mTypeInstance.[Friend]GetCustomAttributes<T>(mData.mMethodData.mParamData[paramIdx].mCustomAttributesIdx);
}
public Result<T> GetCustomAttribute<T>() where T : Attribute
{
if (Compiler.IsComptime)
@ -104,6 +120,20 @@ namespace System.Reflection
return mTypeInstance.[Friend]GetCustomAttribute<T>(mData.mMethodData.mCustomAttributesIdx);
}
public AttributeInfo.CustomAttributeEnumerator GetCustomAttributes()
{
if (Compiler.IsComptime)
Runtime.NotImplemented();
return mTypeInstance.[Friend]GetCustomAttributes(mData.mMethodData.mCustomAttributesIdx);
}
public AttributeInfo.CustomAttributeEnumerator<T> GetCustomAttributes<T>() where T : Attribute
{
if (Compiler.IsComptime)
Runtime.NotImplemented();
return mTypeInstance.[Friend]GetCustomAttributes<T>(mData.mMethodData.mCustomAttributesIdx);
}
public Result<T> GetReturnCustomAttribute<T>() where T : Attribute
{
if (Compiler.IsComptime)
@ -111,6 +141,20 @@ namespace System.Reflection
return mTypeInstance.[Friend]GetCustomAttribute<T>(mData.mMethodData.mReturnCustomAttributesIdx);
}
public AttributeInfo.CustomAttributeEnumerator GetReturnCustomAttributes()
{
if (Compiler.IsComptime)
Runtime.NotImplemented();
return mTypeInstance.[Friend]GetCustomAttributes(mData.mMethodData.mReturnCustomAttributesIdx);
}
public AttributeInfo.CustomAttributeEnumerator<T> GetReturnCustomAttributes<T>() where T : Attribute
{
if (Compiler.IsComptime)
Runtime.NotImplemented();
return mTypeInstance.[Friend]GetCustomAttributes<T>(mData.mMethodData.mReturnCustomAttributesIdx);
}
public enum CallError
{
case None;