forked from Mirrors/openclonk
Don't crash on functions declared inside other functions
Declaring a local variable inside any function works the same way as declaring it in top-level scope, which gets a bit weird if done inside a function inside a constant proplist, but is at least consistent. Thanks to Flinti for reporting this.qteditor
parent
a71ca69f1d
commit
57a35bf01b
|
@ -2175,6 +2175,7 @@ C4Value C4AulParse::Parse_ConstExpression(C4PropListStatic * parent, C4String *
|
||||||
throw C4AulParseError(this, "global functions must be declared with 'global func'");
|
throw C4AulParseError(this, "global functions must be declared with 'global func'");
|
||||||
if (!Name)
|
if (!Name)
|
||||||
throw C4AulParseError(this, "functions must have a name");
|
throw C4AulParseError(this, "functions must have a name");
|
||||||
|
C4AulScriptFunc * prev_Fn = Fn;
|
||||||
if (Type == PREPARSER)
|
if (Type == PREPARSER)
|
||||||
{
|
{
|
||||||
Fn = new C4AulScriptFunc(parent, pOrgScript, Name ? Name->GetCStr() : NULL, SPos);
|
Fn = new C4AulScriptFunc(parent, pOrgScript, Name ? Name->GetCStr() : NULL, SPos);
|
||||||
|
@ -2192,6 +2193,7 @@ C4Value C4AulParse::Parse_ConstExpression(C4PropListStatic * parent, C4String *
|
||||||
Store_Const(parent, Name, r);
|
Store_Const(parent, Name, r);
|
||||||
Shift();
|
Shift();
|
||||||
Parse_FuncBody();
|
Parse_FuncBody();
|
||||||
|
Fn = prev_Fn;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue