1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-09 03:52:19 +02:00

Fixed invalid underlying enum type error

This commit is contained in:
Brian Fiete 2021-12-14 11:26:24 -05:00
parent 8623f8f7e5
commit f85a4317fc

View file

@ -2927,6 +2927,9 @@ void BfModule::DoPopulateType(BfType* resolvedTypeRef, BfPopulateType populateTy
{
bool hadType = false;
BfAstNode* deferredErrorNode = NULL;
char* deferredError = NULL;
for (auto baseTypeRef : typeDef->mBaseTypes)
{
SetAndRestoreValue<BfTypeReference*> prevTypeRef(mContext->mCurTypeState->mCurBaseTypeRef, baseTypeRef);
@ -2946,12 +2949,14 @@ void BfModule::DoPopulateType(BfType* resolvedTypeRef, BfPopulateType populateTy
}
else
{
Fail("Underlying enum type already specified", baseTypeRef);
deferredError = "Underlying enum type already specified";
deferredErrorNode = baseTypeRef;
}
}
else
{
Fail("Invalid underlying enum type", baseTypeRef);
deferredError = "Invalid underlying enum type";
deferredErrorNode = baseTypeRef;
}
}
else
@ -2961,6 +2966,9 @@ void BfModule::DoPopulateType(BfType* resolvedTypeRef, BfPopulateType populateTy
}
}
if (deferredError != NULL)
Fail(deferredError, deferredErrorNode, true);
if (underlyingType == NULL)
{
underlyingType = GetPrimitiveType(BfTypeCode_Int64);