1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-09 20:12:21 +02:00

Fixed reflection of compile-time compiler constants

This commit is contained in:
Brian Fiete 2020-09-16 04:38:44 -07:00
parent 0631bb2ca8
commit 49ca3b67bf

View file

@ -5887,6 +5887,18 @@ BfIRValue BfModule::CreateTypeData(BfType* type, Dictionary<int, int>& usedStrin
else if (fieldInstance->GetFieldDef()->mIsStatic)
{
auto refVal = ReferenceStaticField(fieldInstance);
if (refVal.mValue.IsConst())
{
auto constant = mBfIRBuilder->GetConstant(refVal.mValue);
if (constant->mConstType == BfConstType_GlobalVar)
{
auto globalVar = (BfGlobalVar*)constant;
if (globalVar->mName[0] == '#')
refVal = BfTypedValue();
}
}
if (refVal.IsAddr())
{
constValue = mBfIRBuilder->CreatePtrToInt(refVal.mValue, BfTypeCode_IntPtr);