mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 12:32:20 +02:00
Added support for bool in reflected attributes
This commit is contained in:
parent
e5406250e3
commit
5c2e0d86c0
3 changed files with 14 additions and 6 deletions
|
@ -46,7 +46,8 @@ namespace System.Reflection
|
||||||
{
|
{
|
||||||
case .Int8,
|
case .Int8,
|
||||||
.UInt8,
|
.UInt8,
|
||||||
.Char8:
|
.Char8,
|
||||||
|
.Boolean:
|
||||||
let attrData = Decode!<int8>(data);
|
let attrData = Decode!<int8>(data);
|
||||||
args[argIdx] = scope:AttrBlock box attrData;
|
args[argIdx] = scope:AttrBlock box attrData;
|
||||||
case .Int16,
|
case .Int16,
|
||||||
|
|
|
@ -5723,7 +5723,8 @@ BfIRValue BfModule::CreateTypeData(BfType* type, Dictionary<int, int>& usedStrin
|
||||||
PUSH_INT64(constant->mInt64);
|
PUSH_INT64(constant->mInt64);
|
||||||
}
|
}
|
||||||
else if ((constant->mTypeCode == BfTypeCode_Int32) ||
|
else if ((constant->mTypeCode == BfTypeCode_Int32) ||
|
||||||
(constant->mTypeCode == BfTypeCode_UInt32))
|
(constant->mTypeCode == BfTypeCode_UInt32) ||
|
||||||
|
(constant->mTypeCode == BfTypeCode_Char32))
|
||||||
{
|
{
|
||||||
PUSH_INT32(constant->mInt32);
|
PUSH_INT32(constant->mInt32);
|
||||||
}
|
}
|
||||||
|
@ -5733,12 +5734,15 @@ BfIRValue BfModule::CreateTypeData(BfType* type, Dictionary<int, int>& usedStrin
|
||||||
PUSH_INT32(*(int*)&val);
|
PUSH_INT32(*(int*)&val);
|
||||||
}
|
}
|
||||||
else if ((constant->mTypeCode == BfTypeCode_Int16) ||
|
else if ((constant->mTypeCode == BfTypeCode_Int16) ||
|
||||||
(constant->mTypeCode == BfTypeCode_UInt16))
|
(constant->mTypeCode == BfTypeCode_UInt16) ||
|
||||||
|
(constant->mTypeCode == BfTypeCode_Char16))
|
||||||
{
|
{
|
||||||
PUSH_INT16(constant->mInt16);
|
PUSH_INT16(constant->mInt16);
|
||||||
}
|
}
|
||||||
else if ((constant->mTypeCode == BfTypeCode_Int8) ||
|
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);
|
PUSH_INT8(constant->mInt8);
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,15 +13,17 @@ namespace Tests
|
||||||
public float mB;
|
public float mB;
|
||||||
public String mC;
|
public String mC;
|
||||||
public String mD;
|
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;
|
mA = a;
|
||||||
mB = b;
|
mB = b;
|
||||||
mC = c;
|
mC = c;
|
||||||
mD = d;
|
mD = d;
|
||||||
|
mE = e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -354,6 +356,7 @@ namespace Tests
|
||||||
Test.Assert(attrA.mB == 22);
|
Test.Assert(attrA.mB == 22);
|
||||||
Test.Assert(attrA.mC == "StrA");
|
Test.Assert(attrA.mC == "StrA");
|
||||||
Test.Assert(attrA.mD == "D");
|
Test.Assert(attrA.mD == "D");
|
||||||
|
Test.Assert(attrA.mE == true);
|
||||||
}
|
}
|
||||||
|
|
||||||
fieldIdx++;
|
fieldIdx++;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue