|
|
@@ -1177,7 +1177,8 @@ public:
|
|
|
Expect(_SC('('));
|
|
|
//the following is an attempt to allow local declared functions be called recursivelly
|
|
|
SQInteger old_pos = _fs->GetCurrentPos(); //save current instructions position
|
|
|
- _fs->PushLocalVariable(varname, _scope.nested, _VAR_CLOSURE); //add function name to find it as outer var if needed
|
|
|
+ _fs->PushLocalVariable(varname, _scope.nested, _VAR_CLOSURE); //add function name to find it as outer var if needed
|
|
|
+ //-1 to compensate default parameters when relocating
|
|
|
CreateFunction(varname,false, -1);
|
|
|
_fs->AddInstruction(_OP_CLOSURE, _fs->PushTarget(), _fs->_functions.size() - 1, 0);
|
|
|
//rellocate any stack operation (default parameters & _OP_Closure)
|
|
|
@@ -1744,6 +1745,7 @@ if(color == "yellow"){
|
|
|
Lex();
|
|
|
if(_token == _SC('[') || _token == _SC('{')) Error(_SC("default parameter with array/table values not supported"));
|
|
|
Expression();
|
|
|
+ //stack_offset to compensate for local functions been relocated to allow recursion
|
|
|
funcstate->AddDefaultParam(_fs->TopTarget()+stack_offset);
|
|
|
defparams++;
|
|
|
}
|