mirror of
https://gitlab.labs.nic.cz/labs/bird.git
synced 2024-05-11 16:54:54 +00:00
Filter: Implement direct recursion
Direct recursion almost worked, just crashed on function signature check. Split function parsing such that function signature is saved before function body is processed. Recursive calls are marked so they can be avoided during f_same() and similar code walking. Also, include tower of hanoi solver as a test case.
This commit is contained in:
committed by
Ondrej Zajicek
parent
fb1d8f6513
commit
26bc4f9904
@@ -1165,11 +1165,16 @@
|
||||
whati->fvar = tmp;
|
||||
what->size += tmp->size;
|
||||
|
||||
/* Mark recursive calls, they have dummy f_line */
|
||||
if (!sym->function->len)
|
||||
what->flags |= FIF_RECURSIVE;
|
||||
|
||||
FID_SAME_BODY()
|
||||
if (!(f1->sym->flags & SYM_FLAG_SAME))
|
||||
return 0;
|
||||
if (!(f1->sym->flags & SYM_FLAG_SAME) && !(f1_->flags & FIF_RECURSIVE))
|
||||
return 0;
|
||||
|
||||
FID_ITERATE_BODY()
|
||||
if (!(what->flags & FIF_RECURSIVE))
|
||||
BUFFER_PUSH(fit->lines) = whati->sym->function;
|
||||
|
||||
FID_INTERPRET_BODY()
|
||||
|
Reference in New Issue
Block a user