Protected on methods of StaticEventHandler is completely useless

This commit is contained in:
ZZYZX 2017-03-05 00:52:43 +02:00 committed by Christoph Oelckers
commit 9d4179ca06
3 changed files with 19 additions and 5 deletions

View file

@ -195,6 +195,8 @@ PFunction *FindClassMemberFunction(PStruct *selfcls, PStruct *funccls, FName nam
if (symbol != nullptr)
{
PClass* cls_ctx = dyn_cast<PClass>(selfcls);
PClass* cls_target = dyn_cast<PClass>(funccls);
if (funcsym == nullptr)
{
sc.Message(MSG_ERROR, "%s is not a member function of %s", name.GetChars(), selfcls->TypeName.GetChars());
@ -204,6 +206,11 @@ PFunction *FindClassMemberFunction(PStruct *selfcls, PStruct *funccls, FName nam
// private access is only allowed if the symbol table belongs to the class in which the current function is being defined.
sc.Message(MSG_ERROR, "%s is declared private and not accessible", symbol->SymbolName.GetChars());
}
else if ((funcsym->Variants[0].Flags & VARF_Protected) && (!cls_ctx || !cls_target || cls_ctx->IsDescendantOf((PClass*)cls_target)))
{
sc.Message(MSG_ERROR, "%s is declared protected and not accessible", symbol->SymbolName.GetChars());
return nullptr;
}
else if (funcsym->Variants[0].Flags & VARF_Deprecated)
{
sc.Message(MSG_WARNING, "Call to deprecated function %s", symbol->SymbolName.GetChars());