Debian Codegraph @

src/test/06-Errors/error-depend-mutual.ck

raw
1 // mutual recursion + dependency tracking
2
3 // this should not work
4 foo();
5
6 // shared variable init
7 5 => int n;
8
9 // foo(), calls bar()
10 fun void foo()
11 {
12 // condition
13 if( n > 0 )
14 {
15 n--;
16 bar();
17 }
18 }
19
20 // bar(), calls foo()
21 fun void bar()
22 {
23 // condition
24 if( n > 0 )
25 {
26 n--;
27 foo();
28 }
29 }
30
31 if( n == 0 ) <<< "success" >>>;