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

Fixed const-eval-initialized const field dependency issues

This commit is contained in:
Brian Fiete 2021-01-02 15:46:29 -08:00
parent 1893988195
commit 496eae24ad
5 changed files with 85 additions and 29 deletions

View file

@ -4119,6 +4119,17 @@ BfTypedValue BfExprEvaluator::LookupField(BfAstNode* targetSrc, BfTypedValue tar
mModule->PopulateType(resolvedFieldType, BfPopulateType_Data);
mModule->AddDependency(curCheckType, mModule->mCurTypeInstance, BfDependencyMap::DependencyFlag_ReadFields);
if (fieldInstance->mHadConstEval)
{
mModule->AddDependency(curCheckType, mModule->mCurTypeInstance, BfDependencyMap::DependencyFlag_ConstEvalConstField);
if ((mModule->mContext->mCurTypeState != NULL) && (mModule->mContext->mCurTypeState->mCurFieldDef != NULL))
{
// If we're initializing another const field then
auto resolvingFieldInstance = &mModule->mContext->mCurTypeState->mTypeInstance->mFieldInstances[mModule->mContext->mCurTypeState->mCurFieldDef->mIdx];
if (resolvingFieldInstance->GetFieldDef()->mIsConst)
resolvingFieldInstance->mHadConstEval = true;
}
}
auto autoComplete = GetAutoComplete();
if (autoComplete != NULL)