1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-09 03:52:19 +02:00

Fixed string gv to stringId

This commit is contained in:
Brian Fiete 2022-03-02 09:51:28 -08:00
parent 16f307f7ca
commit e11c4aa0fe

View file

@ -203,7 +203,15 @@ BfTypedValue BfConstResolver::Resolve(BfExpression* expr, BfType* wantType, BfCo
{ {
auto constant = mModule->mBfIRBuilder->GetConstant(mResult.mValue); auto constant = mModule->mBfIRBuilder->GetConstant(mResult.mValue);
if ((constant->mConstType == BfConstType_GlobalVar) && ((flags & BfConstResolveFlag_AllowGlobalVariable) == 0)) if ((constant->mConstType == BfConstType_GlobalVar) && ((flags & BfConstResolveFlag_AllowGlobalVariable) == 0))
isConst = false; {
int stringId = mModule->GetStringPoolIdx(mResult.mValue, mModule->mBfIRBuilder);
if (stringId != -1)
{
mResult.mValue = mModule->mBfIRBuilder->CreateConst(BfTypeCode_StringId, stringId);
}
else
isConst = false;
}
} }
if ((!isConst) && ((mBfEvalExprFlags & BfEvalExprFlags_AllowNonConst) == 0)) if ((!isConst) && ((mBfEvalExprFlags & BfEvalExprFlags_AllowNonConst) == 0))