src/test/06-Errors/error-depend-func.ck
raw| 1 | // dependency tracking for context-top-level variable |
| 2 | // PRC's error example |
| 3 | |
| 4 | // does not work here, since it precedes 'array' decl/initialization |
| 5 | printArray(); |
| 6 | |
| 7 | // where 'array' initializes |
| 8 | [1, 2, 3] @=> int array[]; |
| 9 | |
| 10 | // FYI calling printArray() works here because it's after array initializes |
| 11 | // printArray(); |
| 12 | |
| 13 | // the function definition |
| 14 | fun void printArray() |
| 15 | { |
| 16 | // needs 'array' to be initialized |
| 17 | <<< array[0], array[1], array[2] >>>; |
| 18 | } |