Aul: Remove C4AulAccess enum

We're not doing access controls anyway, so tracking information about it
isn't useful.
Controls
Nicolas Hake 2015-03-25 22:23:42 +01:00
parent cd266d2352
commit be1a148915
2 changed files with 15 additions and 24 deletions

View File

@ -56,15 +56,6 @@ public:
C4AulExecError(const char *szError);
};
// function access
enum C4AulAccess
{
AA_PRIVATE,
AA_PROTECTED,
AA_PUBLIC,
AA_GLOBAL
};
// byte code chunk type
// some special script functions defined hard-coded to reduce the exec context
enum C4AulBCCType

View File

@ -1337,12 +1337,16 @@ void C4AulParse::Parse_Script(C4ScriptHost * scripthost)
void C4AulParse::Parse_Function()
{
C4AulAccess Acc = AA_PUBLIC;
// Access?
if (SEqual(Idtf, C4AUL_Private)) { Acc = AA_PRIVATE; Shift(); }
else if (SEqual(Idtf, C4AUL_Protected)) { Acc = AA_PROTECTED; Shift(); }
else if (SEqual(Idtf, C4AUL_Public)) { Acc = AA_PUBLIC; Shift(); }
else if (SEqual(Idtf, C4AUL_Global)) { Acc = AA_GLOBAL; Shift(); }
bool is_global = SEqual(Idtf, C4AUL_Global);
// skip access modifier
if (SEqual(Idtf, C4AUL_Private) ||
SEqual(Idtf, C4AUL_Protected) ||
SEqual(Idtf, C4AUL_Public) ||
SEqual(Idtf, C4AUL_Global))
{
Shift();
}
// check for func declaration
if (!SEqual(Idtf, C4AUL_Func))
throw new C4AulParseError(this, "Declaration expected, but found identifier ", Idtf);
@ -1350,17 +1354,13 @@ void C4AulParse::Parse_Function()
// get next token, must be func name
Check(ATT_IDTF, "function name");
// check: symbol already in use?
switch (Acc)
if (!is_global)
{
case AA_PRIVATE:
case AA_PROTECTED:
case AA_PUBLIC:
if (Host->LocalNamed.GetItemNr(Idtf) != -1)
throw new C4AulParseError(this, "function definition: name already in use (local variable)");
if (Host->GetPropList())
break;
// func in global context: fallthru
case AA_GLOBAL:
}
if (is_global || !Host->GetPropList())
{
if (Host != pOrgScript)
throw new C4AulParseError(this, "global func in appendto/included script: ", Idtf);
if (Engine->GlobalNamedNames.GetItemNr(Idtf) != -1)
@ -1370,7 +1370,7 @@ void C4AulParse::Parse_Function()
}
// get script fn
C4AulScript * owner;
if (Acc == AA_GLOBAL)
if (is_global)
owner = Engine;
else
owner = Host;