Debian Codegraph @

src/test/01-Basic/170-depend-nest2.ck

raw
1 // unit test for dependency through transitive object instance
2 // i.e., in this case, nest() essentially inherits the dependencies
3 // of class Bar which includes 'foo'
4
5 // nest function definition
6 fun void nest()
7 {
8 // causes nest to inherit Bar's dependencies
9 Bar bar;
10 }
11
12 // initialize
13 5 => float foo;
14
15 // should work here, since nest() needs class Bar,
16 // which needs 'foo', but nest() is called after 'foo'
17 // initializes
18 nest();
19
20 // class definition
21 class Bar
22 {
23 // this should auto-run upon Bar instantiation
24 if( foo == 5 ) <<< "success" >>>;
25 }