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

Added warnings for invalid interface method decls

This commit is contained in:
Brian Fiete 2020-10-26 15:32:10 -07:00
parent 710d7636d6
commit 5167298ab2

View file

@ -21462,9 +21462,20 @@ void BfModule::DoMethodDeclaration(BfMethodDeclaration* methodDeclaration, bool
}
}
if ((typeInstance->IsInterface()) && (methodDef->mMethodType == BfMethodType_Ctor))
if (typeInstance->IsInterface())
{
Fail("Interfaces cannot contain constructors", methodDeclaration);
if (methodDef->mMethodType == BfMethodType_Ctor)
Fail("Interfaces cannot contain constructors", methodDeclaration);
if (methodDeclaration != NULL)
{
if (methodDef->mBody == NULL)
{
if (methodDef->mProtection != BfProtection_Public) //TODO: MAKE AN ERROR
Warn(0, "Protection specifiers can only be used with interface methods containing a default implementation body", methodDeclaration->mProtectionSpecifier);
if ((methodDeclaration->mVirtualSpecifier != NULL) && (methodDeclaration->mVirtualSpecifier->mToken != BfToken_Abstract)) //TODO: MAKE AN ERROR
Warn(0, "Virtual specifiers can only be used with interface methods containing a default implementation body", methodDeclaration->mVirtualSpecifier);
}
}
}
bool foundHiddenMethod = false;