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

Reflection fixes

This commit is contained in:
Brian Fiete 2020-05-01 09:10:58 -07:00
parent 5f010456be
commit 501e1028ee

View file

@ -1278,6 +1278,7 @@ void BfCompiler::CreateVData(BfVDataModule* bfModule)
continue;
bool needsTypeData = (needsTypeList) || ((type->IsObject()) && (needsObjectTypeData));
bool needsVData = (type->IsObject()) && (typeInst->mHasBeenInstantiated);
bool forceReflectFields = false;
@ -1287,8 +1288,7 @@ void BfCompiler::CreateVData(BfVDataModule* bfModule)
if (type->IsEnum())
forceReflectFields = true;
}
bool needsVData = (type->IsObject()) && (typeInst->mHasBeenInstantiated);
BfIRValue typeVariable;
if ((needsTypeData) || (needsVData))
@ -1330,6 +1330,11 @@ void BfCompiler::CreateVData(BfVDataModule* bfModule)
auto typeDataConst = bfModule->mBfIRBuilder->CreateConstArray(arrayType, typeDataVector);
BfIRValue typeDataArray = bfModule->mBfIRBuilder->CreateGlobalVariable(arrayType, true, BfIRLinkageType_External,
typeDataConst, typesVariableName);
StringT<128> typeCountVariableName;
BfMangler::MangleStaticFieldName(typeCountVariableName, GetMangleKind(), typeDefType->ToTypeInstance(), "sTypeCount", bfModule->GetPrimitiveType(BfTypeCode_Int32));
bfModule->mBfIRBuilder->CreateGlobalVariable(bfModule->mBfIRBuilder->MapType(bfModule->GetPrimitiveType(BfTypeCode_Int32)), true, BfIRLinkageType_External,
bfModule->mBfIRBuilder->CreateConst(BfTypeCode_Int32, (int)typeDataVector.size()), typeCountVariableName);
}
HashSet<int> foundStringIds;