Debian Codegraph @

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

raw
1 // it's possible for a function or class def to have multiple dependencies;
2 // here printArray() needs both 'foo' and 'bar' to be initialized -- it
3 // is called AFTER foo initializes (good), but BEFORE 'bar' initializes,
4 // and should lead to a compiler error regarding 'bar'
5
6 // declare/initialize 'foo'
7 1 => int foo;
8
9 // does not work here, since printArray() needs 'foo' and 'bar' to be initialized
10 printArray();
11
12 // declare/initialize 'bar'
13 2 => int bar;
14
15 // works here, since it's after both 'foo' and 'bar' initialize
16 // printArray();
17
18 // function definition
19 fun void printArray()
20 {
21 // need both 'foo' and 'bar' to be initialized
22 <<< foo, bar >>>;
23 }