mirror of
https://github.com/ZDoom/acc.git
synced 2025-02-11 22:37:54 +00:00
Fix wrong function index on some recursive calls
- problem: function index for recursive calls does not get updated in cases when the definition of the function comes before its use - solution: treat the function as predefined until we process the whole of its body so that a ref gets added if a recusive call is encountered
This commit is contained in:
parent
ae5f03691a
commit
ae6b71612e
1 changed files with 12 additions and 2 deletions
14
parse.c
14
parse.c
|
@ -825,8 +825,18 @@ static void OuterFunction(void)
|
|||
else
|
||||
{
|
||||
sym = SY_InsertGlobal(tk_String, SY_SCRIPTFUNC);
|
||||
sym->info.scriptFunc.address = (importing == IMPORT_Importing ? 0 : pc_Address);
|
||||
sym->info.scriptFunc.predefined = NO;
|
||||
if (importing == IMPORT_Importing)
|
||||
{
|
||||
sym->info.scriptFunc.address = 0;
|
||||
sym->info.scriptFunc.predefined = NO;
|
||||
}
|
||||
else
|
||||
{
|
||||
sym->info.scriptFunc.address = pc_Address;
|
||||
sym->info.scriptFunc.predefined = YES;
|
||||
// only for consistency with other speculated functions and pretty logs
|
||||
sym->info.scriptFunc.funcNumber = 0;
|
||||
}
|
||||
}
|
||||
defLine = tk_Line;
|
||||
|
||||
|
|
Loading…
Reference in a new issue