Debian Codegraph @

src/test/01-Basic/212-use-before-extend.ck

raw
1 // this verifies that inheritance parent type is recognized if
2 // use before the class definition in file
3 // https://github.com/ccrma/chuck/issues/375
4
5 // instance of our event
6 TheEvent e;
7
8 // spork a shred to broadcast later
9 spork ~ timer( 1::samp );
10
11 // verify e can be recognized as child of Event,
12 // before TheEvent definition
13 e => now;
14
15 // if we got here, then done
16 <<< "success" >>>;
17
18 // custom Event class
19 class TheEvent extends Event { }
20
21 // a function to wait a bit and broadcast
22 fun void timer( dur T )
23 {
24 T => now;
25 e.broadcast();
26 }