mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-11 07:12:16 +00:00
Protected on methods of StaticEventHandler is completely useless
This commit is contained in:
parent
a43bc279a3
commit
9d4179ca06
3 changed files with 19 additions and 5 deletions
|
@ -6082,6 +6082,13 @@ FxExpression *FxIdentifier::ResolveMember(FCompileContext &ctx, PStruct *classct
|
||||||
ScriptPosition.Message(MSG_ERROR, "Private member %s not accessible", vsym->SymbolName.GetChars());
|
ScriptPosition.Message(MSG_ERROR, "Private member %s not accessible", vsym->SymbolName.GetChars());
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
PClass* cls_ctx = dyn_cast<PClass>(classctx);
|
||||||
|
PClass* cls_target = dyn_cast<PClass>(objtype);
|
||||||
|
if ((vsym->Flags & VARF_Protected) && (!cls_ctx || !cls_target || cls_ctx->IsDescendantOf(cls_target)))
|
||||||
|
{
|
||||||
|
ScriptPosition.Message(MSG_ERROR, "Protected member %s not accessible", vsym->SymbolName.GetChars());
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
auto x = isclass ? new FxClassMember(object, vsym, ScriptPosition) : new FxStructMember(object, vsym, ScriptPosition);
|
auto x = isclass ? new FxClassMember(object, vsym, ScriptPosition) : new FxStructMember(object, vsym, ScriptPosition);
|
||||||
object = nullptr;
|
object = nullptr;
|
||||||
|
|
|
@ -195,6 +195,8 @@ PFunction *FindClassMemberFunction(PStruct *selfcls, PStruct *funccls, FName nam
|
||||||
|
|
||||||
if (symbol != nullptr)
|
if (symbol != nullptr)
|
||||||
{
|
{
|
||||||
|
PClass* cls_ctx = dyn_cast<PClass>(selfcls);
|
||||||
|
PClass* cls_target = dyn_cast<PClass>(funccls);
|
||||||
if (funcsym == nullptr)
|
if (funcsym == nullptr)
|
||||||
{
|
{
|
||||||
sc.Message(MSG_ERROR, "%s is not a member function of %s", name.GetChars(), selfcls->TypeName.GetChars());
|
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.
|
// 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());
|
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)
|
else if (funcsym->Variants[0].Flags & VARF_Deprecated)
|
||||||
{
|
{
|
||||||
sc.Message(MSG_WARNING, "Call to deprecated function %s", symbol->SymbolName.GetChars());
|
sc.Message(MSG_WARNING, "Call to deprecated function %s", symbol->SymbolName.GetChars());
|
||||||
|
|
|
@ -283,12 +283,12 @@ class StaticEventHandler : Object native play
|
||||||
{
|
{
|
||||||
// static event handlers CAN register other static event handlers.
|
// static event handlers CAN register other static event handlers.
|
||||||
// unlike EventHandler.Create that will not create them.
|
// unlike EventHandler.Create that will not create them.
|
||||||
clearscope protected static native StaticEventHandler Create(class<StaticEventHandler> type);
|
clearscope static native StaticEventHandler Create(class<StaticEventHandler> type);
|
||||||
clearscope protected static native StaticEventHandler CreateOnce(class<StaticEventHandler> type);
|
clearscope static native StaticEventHandler CreateOnce(class<StaticEventHandler> type);
|
||||||
clearscope protected static native StaticEventHandler Find(Class<StaticEventHandler> type); // just for convenience. who knows.
|
clearscope static native StaticEventHandler Find(Class<StaticEventHandler> type); // just for convenience. who knows.
|
||||||
|
|
||||||
clearscope protected static native bool Register(StaticEventHandler handler);
|
clearscope static native bool Register(StaticEventHandler handler);
|
||||||
clearscope protected static native bool Unregister(StaticEventHandler handler);
|
clearscope static native bool Unregister(StaticEventHandler handler);
|
||||||
|
|
||||||
// these are called when the handler gets registered or unregistered
|
// these are called when the handler gets registered or unregistered
|
||||||
// you can set Order/IsUiProcessor here.
|
// you can set Order/IsUiProcessor here.
|
||||||
|
|
Loading…
Reference in a new issue