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

Added warnings for illegal type specifiers

This commit is contained in:
Brian Fiete 2020-09-24 05:11:49 -07:00
parent 3e5c5e402c
commit 7f56fecc6c

View file

@ -1553,6 +1553,34 @@ void BfDefBuilder::Visit(BfTypeDeclaration* typeDeclaration)
else
BF_FATAL("Unknown type token");
if (mCurTypeDef->mIsStatic)
{
if ((mCurTypeDef->mTypeCode != BfTypeCode_Object) &&
(mCurTypeDef->mTypeCode != BfTypeCode_Struct))
{
mPassInstance->Warn(0, StrFormat("Types declared as '%s' cannot be 'static'", BfTokenToString(typeToken)).c_str(), typeDeclaration->mStaticSpecifier);
mCurTypeDef->mIsStatic = false;
}
}
if (mCurTypeDef->mIsAbstract)
{
if (mCurTypeDef->mTypeCode != BfTypeCode_Object)
{
mPassInstance->Warn(0, StrFormat("Types declared as '%s' cannot be 'abstract'", BfTokenToString(typeToken)).c_str(), typeDeclaration->mStaticSpecifier);
mCurTypeDef->mIsAbstract = false;
}
}
if (mCurTypeDef->mIsConcrete)
{
if (mCurTypeDef->mTypeCode != BfTypeCode_Interface)
{
mPassInstance->Warn(0, StrFormat("Types declared as '%s' cannot be 'concrete'", BfTokenToString(typeToken)).c_str(), typeDeclaration->mStaticSpecifier);
mCurTypeDef->mIsConcrete = false;
}
}
if (!isAutoCompleteTempType)
{
BfTypeDef* prevDef = NULL;