diff --git a/BeefLibs/corlib/src/Reflection/FieldInfo.bf b/BeefLibs/corlib/src/Reflection/FieldInfo.bf index f3df2ffe..18b0ca3c 100644 --- a/BeefLibs/corlib/src/Reflection/FieldInfo.bf +++ b/BeefLibs/corlib/src/Reflection/FieldInfo.bf @@ -25,6 +25,9 @@ namespace System.Reflection public Type FieldType => Type.[Friend]GetType(mFieldData.mFieldTypeId); public bool IsConst => mFieldData.mFlags.HasFlag(.Const); public bool IsStatic => mFieldData.mFlags.HasFlag(.Static); + public bool IsPublic => (mFieldData.mFlags & .FieldAccessMask) == .Public; + public bool IsProtected => (mFieldData.mFlags & .FieldAccessMask) == .Protected; + public bool IsPrivate => (mFieldData.mFlags & .FieldAccessMask) == 0; public bool IsInstanceField => !mFieldData.mFlags.HasFlag(.Static) && !mFieldData.mFlags.HasFlag(.Const); public StringView Name => mFieldData.mName; public int32 FieldIdx => Compiler.IsComptime ? diff --git a/BeefLibs/corlib/src/Reflection/MethodInfo.bf b/BeefLibs/corlib/src/Reflection/MethodInfo.bf index 4569dd27..a00f5f3a 100644 --- a/BeefLibs/corlib/src/Reflection/MethodInfo.bf +++ b/BeefLibs/corlib/src/Reflection/MethodInfo.bf @@ -38,6 +38,16 @@ namespace System.Reflection (mData.mComptimeMethodInstance != 0) : (mData.mMethodData != null); + public bool IsPublic => Compiler.IsComptime ? + (Type.[Friend]Comptime_Method_GetInfo(mData.mComptimeMethodInstance).mMethodFlags & .MethodAccessMask) == .Public : + (mData.mMethodData.[Friend]mFlags & .MethodAccessMask) == .Public; + public bool IsProtected => Compiler.IsComptime ? + (Type.[Friend]Comptime_Method_GetInfo(mData.mComptimeMethodInstance).mMethodFlags & .MethodAccessMask) == .Protected : + (mData.mMethodData.[Friend]mFlags & .MethodAccessMask) == .Protected; + public bool IsPrivate => Compiler.IsComptime ? + (Type.[Friend]Comptime_Method_GetInfo(mData.mComptimeMethodInstance).mMethodFlags & .MethodAccessMask) == 0 : + (mData.mMethodData.[Friend]mFlags & .MethodAccessMask) == 0; + public StringView Name => Compiler.IsComptime ? Type.[Friend]Comptime_Method_GetName(mData.mComptimeMethodInstance) : mData.mMethodData.[Friend]mName; diff --git a/BeefLibs/corlib/src/Type.bf b/BeefLibs/corlib/src/Type.bf index 17f0b56a..d814af49 100644 --- a/BeefLibs/corlib/src/Type.bf +++ b/BeefLibs/corlib/src/Type.bf @@ -1466,13 +1466,8 @@ namespace System.Reflection { // member access mask - Use this mask to retrieve accessibility information. FieldAccessMask = 0x0007, - PrivateScope = 0x0000, // Member not referenceable. - Private = 0x0001, // Accessible only by the parent type. - FamAndProject = 0x0002, // Accessible by sub-types only in this Assembly. - Project = 0x0003, // Accessibly by anyone in the Assembly. - Family = 0x0004, // Accessible only by type and sub-types. - FamOrProject = 0x0005, // Accessibly by sub-types anywhere, plus anyone in assembly. - Public = 0x0006, // Accessibly by anyone who has visibility to this scope. + Protected = 0x0003, + Public = 0x0006, // end member access mask // field contract attributes. @@ -1487,15 +1482,9 @@ namespace System.Reflection public enum MethodFlags : uint16 { - MethodAccessMask = 0x0007, - PrivateScope = 0x0000, // Member not referenceable. - Private = 0x0001, // Accessible only by the parent type. - FamANDAssem = 0x0002, // Accessible by sub-types only in this Assembly. - Assembly = 0x0003, // Accessibly by anyone in the Assembly. - Family = 0x0004, // Accessible only by type and sub-types. - FamORAssem = 0x0005, // Accessibly by sub-types anywhere, plus anyone in assembly. - Public = 0x0006, // Accessibly by anyone who has visibility to this scope. - // end member access mask + MethodAccessMask = 0x0007, + Protected = 0x0003, + Public = 0x0006, // method contract attributes. Static = 0x0010, // Defined on type, else per instance.