src/test/01-Basic/246-depend-var-scope.ck
raw| 1 | // verify that accessing file-level var from function is allowed |
| 2 | // (FYI related to https://github.com/ccrma/chuck/issues/376) |
| 3 | |
| 4 | // a class |
| 5 | class Foo |
| 6 | { |
| 7 | // a func |
| 8 | fun void go() |
| 9 | { |
| 10 | // this shouldn't produce an error |
| 11 | <<< a >>>; |
| 12 | } |
| 13 | } |
| 14 | |
| 15 | // another func, non-class |
| 16 | fun void bar() |
| 17 | { |
| 18 | <<< a >>>; |
| 19 | } |
| 20 | |
| 21 | // decl and init |
| 22 | 5 => int a; |
| 23 | |
| 24 | // if we get here then consider success |
| 25 | <<< "success" >>>; |