1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 19:48:20 +02:00

Fixed MapType issue with global var

This commit is contained in:
Brian Fiete 2021-02-11 08:20:57 -08:00
parent cffd849045
commit 1c14177638
2 changed files with 8 additions and 1 deletions

View file

@ -690,6 +690,8 @@ void BeIRCodeGen::Read(BeValue*& beValue)
CMD_PARAM(BeConstant*, initializer); CMD_PARAM(BeConstant*, initializer);
CMD_PARAM(String, name); CMD_PARAM(String, name);
CMD_PARAM(bool, isTLS); CMD_PARAM(bool, isTLS);
BF_ASSERT(varType != NULL);
auto globalVariable = mBeModule->mGlobalVariables.Alloc(); auto globalVariable = mBeModule->mGlobalVariables.Alloc();
globalVariable->mModule = mBeModule; globalVariable->mModule = mBeModule;
@ -1907,7 +1909,9 @@ void BeIRCodeGen::HandleNextCmd()
CMD_PARAM(StringT<256>, name); CMD_PARAM(StringT<256>, name);
CMD_PARAM(bool, isTLS); CMD_PARAM(bool, isTLS);
CMD_PARAM(BeConstant*, initializer); CMD_PARAM(BeConstant*, initializer);
BF_ASSERT(varType != NULL);
auto globalVariable = mBeModule->mGlobalVariables.Alloc(); auto globalVariable = mBeModule->mGlobalVariables.Alloc();
globalVariable->mModule = mBeModule; globalVariable->mModule = mBeModule;
globalVariable->mType = varType; globalVariable->mType = varType;

View file

@ -13725,7 +13725,10 @@ BfTypedValue BfModule::ReferenceStaticField(BfFieldInstance* fieldInstance)
auto globalVar = (BfGlobalVar*)mBfIRBuilder->GetConstant(globalValue); auto globalVar = (BfGlobalVar*)mBfIRBuilder->GetConstant(globalValue);
if ((globalVar->mStreamId == -1) && (!mBfIRBuilder->mIgnoreWrites)) if ((globalVar->mStreamId == -1) && (!mBfIRBuilder->mIgnoreWrites))
{
mBfIRBuilder->MapType(fieldInstance->mResolvedType);
mBfIRBuilder->CreateGlobalVariable(globalValue); mBfIRBuilder->CreateGlobalVariable(globalValue);
}
} }
else else
{ {