- declared most native getters in Actor as const.

- made the self pointer of const functions readonly.

This seems to work fine. Both calling a non-const function and trying to assign a value to a member fail with an error message.
This commit is contained in:
Christoph Oelckers 2017-03-04 12:43:07 +01:00
commit 7dbc6939c4
3 changed files with 31 additions and 21 deletions

View file

@ -2156,6 +2156,15 @@ void ZCCCompiler::CompileFunction(ZCC_StructWork *c, ZCC_FuncDeclarator *f, bool
}
if (f->Flags & ZCC_Action)
{
if (varflags & VARF_ReadOnly)
{
Error(f, "Action functions cannot be declared const");
varflags &= ~VARF_ReadOnly;
}
if (varflags & VARF_UI)
{
Error(f, "Action functions cannot be declared UI");
}
// Non-Actors cannot have action functions.
if (!c->Type()->IsKindOf(RUNTIME_CLASS(PClassActor)))
{