1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 11:38:21 +02:00

Added support for bool in reflected attributes

This commit is contained in:
Brian Fiete 2020-08-23 07:43:16 -07:00
parent e5406250e3
commit 5c2e0d86c0
3 changed files with 14 additions and 6 deletions

View file

@ -46,7 +46,8 @@ namespace System.Reflection
{
case .Int8,
.UInt8,
.Char8:
.Char8,
.Boolean:
let attrData = Decode!<int8>(data);
args[argIdx] = scope:AttrBlock box attrData;
case .Int16,

View file

@ -5723,7 +5723,8 @@ BfIRValue BfModule::CreateTypeData(BfType* type, Dictionary<int, int>& usedStrin
PUSH_INT64(constant->mInt64);
}
else if ((constant->mTypeCode == BfTypeCode_Int32) ||
(constant->mTypeCode == BfTypeCode_UInt32))
(constant->mTypeCode == BfTypeCode_UInt32) ||
(constant->mTypeCode == BfTypeCode_Char32))
{
PUSH_INT32(constant->mInt32);
}
@ -5733,12 +5734,15 @@ BfIRValue BfModule::CreateTypeData(BfType* type, Dictionary<int, int>& usedStrin
PUSH_INT32(*(int*)&val);
}
else if ((constant->mTypeCode == BfTypeCode_Int16) ||
(constant->mTypeCode == BfTypeCode_UInt16))
(constant->mTypeCode == BfTypeCode_UInt16) ||
(constant->mTypeCode == BfTypeCode_Char16))
{
PUSH_INT16(constant->mInt16);
}
else if ((constant->mTypeCode == BfTypeCode_Int8) ||
(constant->mTypeCode == BfTypeCode_UInt8))
(constant->mTypeCode == BfTypeCode_UInt8) ||
(constant->mTypeCode == BfTypeCode_Boolean) ||
(constant->mTypeCode == BfTypeCode_Char8))
{
PUSH_INT8(constant->mInt8);
}

View file

@ -13,15 +13,17 @@ namespace Tests
public float mB;
public String mC;
public String mD;
public bool mE;
public this(int32 a, float b, String c, String d = "D")
public this(int32 a, float b, String c, String d = "D", bool e = true)
{
PrintF("this: %p A: %d B: %f", this, a, (double)b);
//PrintF("this: %p A: %d B: %f", this, a, (double)b);
mA = a;
mB = b;
mC = c;
mD = d;
mE = e;
}
}
@ -354,6 +356,7 @@ namespace Tests
Test.Assert(attrA.mB == 22);
Test.Assert(attrA.mC == "StrA");
Test.Assert(attrA.mD == "D");
Test.Assert(attrA.mE == true);
}
fieldIdx++;