mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 20:42:21 +02:00
Reflection protection properties
This commit is contained in:
parent
b334423106
commit
fd9fa3ad89
3 changed files with 18 additions and 16 deletions
|
@ -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 ?
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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.
|
||||
|
@ -1488,14 +1483,8 @@ 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
|
||||
Protected = 0x0003,
|
||||
Public = 0x0006,
|
||||
|
||||
// method contract attributes.
|
||||
Static = 0x0010, // Defined on type, else per instance.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue