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:
parent
0631bb2ca8
commit
49ca3b67bf
1 changed files with 13 additions and 1 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue