1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 04:22:20 +02:00

Fixed comptime reflection reentrancy issue with StringView

This commit is contained in:
Brian Fiete 2022-03-31 10:47:23 -07:00
parent 382ecdd750
commit 6cce0ffc25

View file

@ -1811,7 +1811,7 @@ BfIRValue BfModule::GetStringObjectValue(const StringImpl& str, bool define, boo
}
BfIRValue* irValuePtr = NULL;
if (!mStringObjectPool.TryAdd(strId, NULL, &irValuePtr))
if (mStringObjectPool.TryGetValue(strId, &irValuePtr))
return *irValuePtr;
// If this wasn't in neither dictionary yet, add to mStringPoolRefs
@ -1819,8 +1819,8 @@ BfIRValue BfModule::GetStringObjectValue(const StringImpl& str, bool define, boo
mStringPoolRefs.Add(strId);
BfIRValue strObject = CreateStringObjectValue(str, strId, define);
mStringObjectPool[strId] = strObject;
*irValuePtr = strObject;
mStringPoolRefs.Add(strId);
return strObject;
@ -5161,7 +5161,7 @@ BfIRValue BfModule::CreateClassVDataGlobal(BfTypeInstance* typeInstance, int* ou
if (mBfIRBuilder->mIgnoreWrites)
return mBfIRBuilder->GetFakeVal();
PopulateType(typeInstance, BfPopulateType_DataAndMethods);
PopulateType(typeInstance, mIsComptimeModule ? BfPopulateType_Data : BfPopulateType_DataAndMethods);
BfType* classVDataType = ResolveTypeDef(mCompiler->mClassVDataTypeDef);
@ -5706,7 +5706,7 @@ BfIRValue BfModule::CreateTypeData(BfType* type, Dictionary<int, int>& usedStrin
else
typeDataSource = mContext->mBfTypeType;
if ((!mTypeDataRefs.ContainsKey(typeDataSource)) && (typeDataSource != type))
if ((!mTypeDataRefs.ContainsKey(typeDataSource)) && (typeDataSource != type) && (!mIsComptimeModule))
{
CreateTypeData(typeDataSource, usedStringIdMap, false, true, needsTypeNames, true);
}