- allow 'const' on class functions. This is preferable to 'clearscope' so that the UI code can call getter functions without having to declare things as 'clearscope'.

Clearscope is a dangerous context and should be limited to the minimum extent possible and preferably be blocked in user code.
This may still need some work on const functions but better have it in now.
This commit is contained in:
Christoph Oelckers 2017-03-04 12:07:45 +01:00
commit b3ba5bfe2c
5 changed files with 14 additions and 10 deletions

View file

@ -2141,10 +2141,14 @@ void ZCCCompiler::CompileFunction(ZCC_StructWork *c, ZCC_FuncDeclarator *f, bool
// [ZZ] supporting const self for actors is quite a cumbersome task because there's no concept of a const pointer (?)
// either way, it doesn't make sense, because you can call any method on a readonly class instance.
// The above is nonsense. This needs to work and needs to be implemented properly.
/*
if ((f->Flags & ZCC_FuncConst) && (c->Type()->IsKindOf(RUNTIME_CLASS(PClass))))
{
Error(f, "'Const' on a method can only be used in structs");
}
*/
if ((f->Flags & ZCC_VarArg) && !(f->Flags & ZCC_Native))
{