1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-09 20:12:21 +02:00

Improved emitted static field lookup

This commit is contained in:
Brian Fiete 2022-06-28 08:33:30 -07:00
parent a69e1cfe6e
commit 1aca5f6771
3 changed files with 8 additions and 2 deletions

View file

@ -5385,7 +5385,7 @@ BfTypedValue BfExprEvaluator::LookupField(BfAstNode* targetSrc, BfTypedValue tar
if ((!isPopulatingType) && (curCheckType->mDefineState < Beefy::BfTypeDefineState_Defined)) if ((!isPopulatingType) && (curCheckType->mDefineState < Beefy::BfTypeDefineState_Defined))
{ {
// We MAY have emitted fields so we need to do this // We MAY have emitted fields so we need to do this
mModule->PopulateType(curCheckType); mModule->mContext->mUnreifiedModule->PopulateType(curCheckType, Beefy::BfPopulateType_Interfaces_All);
} }
curCheckType->mTypeDef->PopulateMemberSets(); curCheckType->mTypeDef->PopulateMemberSets();

View file

@ -2714,7 +2714,7 @@ void BfIRBuilder::CreateTypeDeclaration(BfType* type, bool forceDbgDefine)
{ {
auto populateModule = mModule->mContext->mUnreifiedModule; auto populateModule = mModule->mContext->mUnreifiedModule;
auto typeInstance = type->ToTypeInstance(); auto typeInstance = type->ToTypeInstance();
if (typeInstance != NULL) if ((typeInstance != NULL) && (typeInstance->mModule != NULL))
populateModule = typeInstance->mModule; populateModule = typeInstance->mModule;
bool wantDIData = DbgHasInfo() && (!type->IsUnspecializedType()); bool wantDIData = DbgHasInfo() && (!type->IsUnspecializedType());

View file

@ -5221,6 +5221,12 @@ void BfModule::DoPopulateType(BfType* resolvedTypeRef, BfPopulateType populateTy
{ {
if ((fieldTypeInst->mRebuildFlags & BfTypeRebuildFlag_UnderlyingTypeDeferred) != 0) if ((fieldTypeInst->mRebuildFlags & BfTypeRebuildFlag_UnderlyingTypeDeferred) != 0)
{ {
if (populateType < BfPopulateType_Data)
{
// We don't actually need the data - bail out
return;
}
BfAstNode* refNode = fieldDef->mFieldDeclaration; BfAstNode* refNode = fieldDef->mFieldDeclaration;
String failStr; String failStr;
failStr = StrFormat("Circular data reference detected between '%s' and '%s'", TypeToString(mCurTypeInstance).c_str(), TypeToString(fieldTypeInst).c_str()); failStr = StrFormat("Circular data reference detected between '%s' and '%s'", TypeToString(mCurTypeInstance).c_str(), TypeToString(fieldTypeInst).c_str());