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

Fixed lookup infinite field loop during custom attribute population

This commit is contained in:
Brian Fiete 2021-02-11 07:46:05 -08:00
parent fb0bace727
commit cffd849045
2 changed files with 9 additions and 28 deletions

View file

@ -4248,6 +4248,14 @@ BfTypedValue BfExprEvaluator::LookupField(BfAstNode* targetSrc, BfTypedValue tar
mModule->PopulateType(startCheckType, BfPopulateType_BaseType);
}
if ((startCheckType != NULL) && (mModule->mContext->mCurTypeState != NULL))
{
// Don't allow lookups yet
if ((mModule->mContext->mCurTypeState->mResolveKind == BfTypeState::ResolveKind_Attributes) &&
(startCheckType == mModule->mContext->mCurTypeState->mTypeInstance))
return BfTypedValue();
}
String findName;
int varSkipCount = 0;
if (fieldName.StartsWith('@'))

View file

@ -13802,33 +13802,6 @@ BfTypedValue BfModule::GetThis()
return BfTypedValue();
}
// if (useMethodState->HasNonStaticMixin())
// {
// auto checkMethodState = useMethodState;
// while (checkMethodState != NULL)
// {
// for (int localIdx = (int)checkMethodState->mLocals.size() - 1; localIdx >= 0; localIdx--)
// {
// auto varDecl = checkMethodState->mLocals[localIdx];
// if (varDecl->mName == "this")
// {
// varDecl->mReadFromId = useMethodState->GetRootMethodState()->mCurAccessId++;
// if (varDecl->mIsSplat)
// {
// return BfTypedValue(varDecl->mValue, varDecl->mResolvedType, BfTypedValueKind_ThisSplatHead);
// }
// else if ((varDecl->mResolvedType->IsValueType()) && (varDecl->mAddr))
// {
// return BfTypedValue(varDecl->mAddr, varDecl->mResolvedType, BfTypedValueKind_ThisAddr);
// }
// return BfTypedValue(varDecl->mValue, varDecl->mResolvedType, varDecl->mResolvedType->IsValueType() ? BfTypedValueKind_ThisAddr : BfTypedValueKind_ThisValue);
// }
// }
//
// checkMethodState = checkMethodState->mPrevMethodState;
// }
// }
// Check mixin state for 'this'
{
auto checkMethodState = mCurMethodState;