Debian Codegraph @

src/test/01-Basic/165-depend-class-before.ck

raw
1 // separate dependency tracking for context-top-level vars and class-top-level vars
2
3 // instantiate Foo
4 Foo foo;
5 // call go(), which needs myVal
6 // this function calls happens BEFORE myVal initialization in the code...
7 // but OKAY here since my Val is in class definition
8 if( foo.go() == 5 ) <<< "success" >>>;
9
10 // class definition
11 class Foo
12 {
13 // member
14 5 => int myVal;
15
16 // member func
17 fun int go()
18 {
19 // myVal should be initialized at this point
20 return myVal;
21 }
22 }