mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 12:32:20 +02:00
Fixed crash during attempt to derive from 'Base[Value]'
This commit is contained in:
parent
966b886fcc
commit
da29d695dd
3 changed files with 12 additions and 3 deletions
|
@ -3304,8 +3304,15 @@ BfTypedValue BfExprEvaluator::LookupField(BfAstNode* targetSrc, BfTypedValue tar
|
||||||
startCheckType = target.mType->ToTypeInstance();
|
startCheckType = target.mType->ToTypeInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((startCheckType != NULL) && (startCheckType->mBaseType == NULL))
|
if ((startCheckType != NULL) && (startCheckType->mBaseType == NULL))
|
||||||
mModule->PopulateType(startCheckType, BfPopulateType_BaseType);
|
{
|
||||||
|
if (startCheckType->mDefineState == BfTypeDefineState_ResolvingBaseType)
|
||||||
|
{
|
||||||
|
// Fixes cases where we have something like 'Base[Value]' as a base typeref
|
||||||
|
return BfTypedValue();
|
||||||
|
}
|
||||||
|
mModule->PopulateType(startCheckType, BfPopulateType_BaseType);
|
||||||
|
}
|
||||||
|
|
||||||
String findName;
|
String findName;
|
||||||
int varSkipCount = 0;
|
int varSkipCount = 0;
|
||||||
|
|
|
@ -1614,7 +1614,7 @@ bool BfModule::DoPopulateType(BfType* resolvedTypeRef, BfPopulateType populateTy
|
||||||
if (typeDef->mIsCombinedPartial)
|
if (typeDef->mIsCombinedPartial)
|
||||||
declTypeDef = typeDef->mPartials.front();
|
declTypeDef = typeDef->mPartials.front();
|
||||||
SetAndRestoreValue<BfTypeDef*> prevTypeDef(mContext->mCurTypeState->mCurTypeDef, declTypeDef);
|
SetAndRestoreValue<BfTypeDef*> prevTypeDef(mContext->mCurTypeState->mCurTypeDef, declTypeDef);
|
||||||
|
SetAndRestoreValue<BfTypeDefineState> prevDefineState(typeInstance->mDefineState, BfTypeDefineState_ResolvingBaseType);
|
||||||
SetAndRestoreValue<BfTypeReference*> prevTypeRef(mContext->mCurTypeState->mCurBaseTypeRef, baseTypeRef);
|
SetAndRestoreValue<BfTypeReference*> prevTypeRef(mContext->mCurTypeState->mCurBaseTypeRef, baseTypeRef);
|
||||||
// We ignore errors here to avoid double-errors for type lookups, but this is where data cycles are detected
|
// We ignore errors here to avoid double-errors for type lookups, but this is where data cycles are detected
|
||||||
// but that type of error supersedes the mIgnoreErrors setting
|
// but that type of error supersedes the mIgnoreErrors setting
|
||||||
|
@ -1850,6 +1850,7 @@ bool BfModule::DoPopulateType(BfType* resolvedTypeRef, BfPopulateType populateTy
|
||||||
if (typeDef->mIsCombinedPartial)
|
if (typeDef->mIsCombinedPartial)
|
||||||
declTypeDef = typeDef->mPartials.front();
|
declTypeDef = typeDef->mPartials.front();
|
||||||
SetAndRestoreValue<BfTypeDef*> prevTypeDef(mContext->mCurTypeState->mCurTypeDef, declTypeDef);
|
SetAndRestoreValue<BfTypeDef*> prevTypeDef(mContext->mCurTypeState->mCurTypeDef, declTypeDef);
|
||||||
|
SetAndRestoreValue<BfTypeDefineState> prevDefineState(typeInstance->mDefineState, BfTypeDefineState_ResolvingBaseType);
|
||||||
|
|
||||||
bool populateBase = !typeInstance->mTypeFailed;
|
bool populateBase = !typeInstance->mTypeFailed;
|
||||||
auto checkType = ResolveTypeRef(checkTypeRef, populateBase ? BfPopulateType_Data : BfPopulateType_Declaration);
|
auto checkType = ResolveTypeRef(checkTypeRef, populateBase ? BfPopulateType_Data : BfPopulateType_Declaration);
|
||||||
|
|
|
@ -381,6 +381,7 @@ enum BfTypeDefineState : uint8
|
||||||
{
|
{
|
||||||
BfTypeDefineState_Undefined,
|
BfTypeDefineState_Undefined,
|
||||||
BfTypeDefineState_Declared,
|
BfTypeDefineState_Declared,
|
||||||
|
BfTypeDefineState_ResolvingBaseType,
|
||||||
BfTypeDefineState_HasInterfaces,
|
BfTypeDefineState_HasInterfaces,
|
||||||
BfTypeDefineState_Defined,
|
BfTypeDefineState_Defined,
|
||||||
BfTypeDefineState_DefinedAndMethodsSlotted,
|
BfTypeDefineState_DefinedAndMethodsSlotted,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue