mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 12:32:20 +02:00
Added IsReadOnly to FieldInfo and MethodInfo
This commit is contained in:
parent
c080f1cbb1
commit
996377909f
6 changed files with 28 additions and 26 deletions
|
@ -24,6 +24,7 @@ namespace System.Reflection
|
|||
public int32 MemberOffset => (int32)mFieldData.mData;
|
||||
public Type FieldType => Type.[Friend]GetType(mFieldData.mFieldTypeId);
|
||||
public bool IsConst => mFieldData.mFlags.HasFlag(.Const);
|
||||
public bool IsReadOnly => mFieldData.mFlags.HasFlag(.ReadOnly);
|
||||
public bool IsStatic => mFieldData.mFlags.HasFlag(.Static);
|
||||
public bool IsPublic => (mFieldData.mFlags & .FieldAccessMask) == .Public;
|
||||
public bool IsProtected => (mFieldData.mFlags & .FieldAccessMask) == .Protected;
|
||||
|
|
|
@ -47,6 +47,9 @@ namespace System.Reflection
|
|||
public bool IsPrivate => Compiler.IsComptime ?
|
||||
(Type.[Friend]Comptime_Method_GetInfo(mData.mComptimeMethodInstance).mMethodFlags & .MethodAccessMask) == 0 :
|
||||
(mData.mMethodData.[Friend]mFlags & .MethodAccessMask) == 0;
|
||||
public bool IsReadOnly => Compiler.IsComptime ?
|
||||
(Type.[Friend]Comptime_Method_GetInfo(mData.mComptimeMethodInstance).mMethodFlags & .ReadOnly) == 0 :
|
||||
(mData.mMethodData.[Friend]mFlags & .ReadOnly) == 0;
|
||||
|
||||
public StringView Name => Compiler.IsComptime ?
|
||||
Type.[Friend]Comptime_Method_GetName(mData.mComptimeMethodInstance) :
|
||||
|
|
|
@ -1477,7 +1477,8 @@ namespace System.Reflection
|
|||
SpecialName = 0x0080, // field is special. Name describes how.
|
||||
EnumPayload = 0x0100,
|
||||
EnumDiscriminator = 0x0200,
|
||||
EnumCase = 0x0400
|
||||
EnumCase = 0x0400,
|
||||
ReadOnly = 0x0800,
|
||||
}
|
||||
|
||||
public enum MethodFlags : uint16
|
||||
|
@ -1487,27 +1488,17 @@ namespace System.Reflection
|
|||
Public = 0x0006,
|
||||
|
||||
// method contract attributes.
|
||||
Static = 0x0010, // Defined on type, else per instance.
|
||||
Final = 0x0020, // Method may not be overridden.
|
||||
Virtual = 0x0040, // Method virtual.
|
||||
HideBySig = 0x0080, // Method hides by name+sig, else just by name.
|
||||
CheckAccessOnOverride = 0x0200,
|
||||
|
||||
// vtable layout mask - Use this mask to retrieve vtable attributes.
|
||||
VtableLayoutMask = 0x0100,
|
||||
#unwarn
|
||||
ReuseSlot = 0x0000, // The default.
|
||||
#unwarn
|
||||
NewSlot = 0x0100, // Method always gets a new slot in the vtable.
|
||||
// end vtable layout mask
|
||||
|
||||
// method implementation attributes.
|
||||
Abstract = 0x0400, // Method does not provide an implementation.
|
||||
SpecialName = 0x0800, // Method is special. Name describes how.
|
||||
StdCall = 0x1000,
|
||||
FastCall = 0x2000,
|
||||
ThisCall = 0x3000, // Purposely resuing StdCall|FastCall
|
||||
Mutating = 0x4000,
|
||||
Constructor = 0x8000,
|
||||
Static = 0x0010, // Defined on type, else per instance.
|
||||
Final = 0x0020, // Method may not be overridden.
|
||||
Virtual = 0x0040, // Method virtual.
|
||||
HideBySig = 0x0080, // Method hides by name+sig, else just by name.
|
||||
ReadOnly = 0x0100,
|
||||
Abstract = 0x0400, // Method does not provide an implementation.
|
||||
SpecialName = 0x0800, // Method is special. Name describes how.
|
||||
StdCall = 0x1000,
|
||||
FastCall = 0x2000,
|
||||
ThisCall = 0x3000, // Purposely resuing StdCall|FastCall
|
||||
Mutating = 0x4000,
|
||||
Constructor = 0x8000,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5585,6 +5585,8 @@ BfIRValue BfModule::CreateFieldData(BfFieldInstance* fieldInstance, int customAt
|
|||
fieldFlags = (BfFieldFlags)(fieldFlags | BfFieldFlags_Const);
|
||||
if (fieldDef->IsEnumCaseEntry())
|
||||
fieldFlags = (BfFieldFlags)(fieldFlags | BfFieldFlags_EnumCase);
|
||||
if (fieldDef->mIsReadOnly)
|
||||
fieldFlags = (BfFieldFlags)(fieldFlags | BfFieldFlags_ReadOnly);
|
||||
|
||||
BfIRValue constValue;
|
||||
BfIRValue constValue2;
|
||||
|
|
|
@ -697,6 +697,8 @@ BfMethodFlags BfMethodInstance::GetMethodFlags()
|
|||
methodFlags = (BfMethodFlags)(methodFlags | BfMethodFlags_Mutating);
|
||||
if (mMethodDef->mMethodType == BfMethodType_Ctor)
|
||||
methodFlags = (BfMethodFlags)(methodFlags | BfMethodFlags_Constructor);
|
||||
if (mMethodDef->mIsReadOnly)
|
||||
methodFlags = (BfMethodFlags)(methodFlags | BfMethodFlags_ReadOnly);
|
||||
|
||||
auto callingConvention = GetOwner()->mModule->GetIRCallingConvention(this);
|
||||
if (callingConvention == BfIRCallingConv_ThisCall)
|
||||
|
@ -705,6 +707,7 @@ BfMethodFlags BfMethodInstance::GetMethodFlags()
|
|||
methodFlags = (BfMethodFlags)(methodFlags | BfMethodFlags_StdCall);
|
||||
else if (callingConvention == BfIRCallingConv_FastCall)
|
||||
methodFlags = (BfMethodFlags)(methodFlags | BfMethodFlags_FastCall);
|
||||
|
||||
return methodFlags;
|
||||
}
|
||||
|
||||
|
|
|
@ -229,11 +229,12 @@ enum BfMethodFlags
|
|||
BfMethodFlags_Public = 6,
|
||||
BfMethodFlags_Static = 0x10,
|
||||
BfMethodFlags_Virtual = 0x40,
|
||||
BfMethodFlags_ReadOnly = 0x100,
|
||||
BfMethodFlags_StdCall = 0x1000,
|
||||
BfMethodFlags_FastCall = 0x2000,
|
||||
BfMethodFlags_ThisCall = 0x3000,
|
||||
BfMethodFlags_Mutating = 0x4000,
|
||||
BfMethodFlags_Constructor = 0x8000,
|
||||
BfMethodFlags_Constructor = 0x8000
|
||||
};
|
||||
|
||||
enum BfObjectFlags : uint8
|
||||
|
@ -1666,7 +1667,8 @@ enum BfFieldFlags
|
|||
BfFieldFlags_SpecialName = 0x80,
|
||||
BfFieldFlags_EnumPayload = 0x100,
|
||||
BfFieldFlags_EnumDiscriminator = 0x200,
|
||||
BfFieldFlags_EnumCase = 0x400
|
||||
BfFieldFlags_EnumCase = 0x400,
|
||||
BfFieldFlags_ReadOnly = 0x800
|
||||
};
|
||||
|
||||
enum BfReflectKind
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue