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

Improved some var handling for allocations

This commit is contained in:
Brian Fiete 2020-01-31 06:12:04 -08:00
parent 1c876af91c
commit 5d909752c9
2 changed files with 31 additions and 33 deletions

View file

@ -1380,6 +1380,9 @@ BfTypedValue BfModule::GetFakeTypedValue(BfType* type)
BfTypedValue BfModule::GetDefaultTypedValue(BfType* type, bool allowRef, BfDefaultValueKind defaultValueKind)
{
if (type->IsVar())
return BfTypedValue(mBfIRBuilder->GetFakeVal(), type);
PopulateType(type, BfPopulateType_Data);
mBfIRBuilder->PopulateType(type, type->IsValueType() ? BfIRPopulateType_Full : BfIRPopulateType_Declaration);
@ -7384,6 +7387,8 @@ BfIRValue BfModule::AllocFromType(BfType* type, const BfAllocTarget& allocTarget
BfScopeData* scopeData = allocTarget.mScopeData;
BF_ASSERT(!type->IsVar());
auto typeInstance = type->ToTypeInstance();
if ((typeInstance == NULL) && (type->IsGenericParam()))
typeInstance = mContext->mBfObjectType;