| 1 |
// verify a system-invoked member function can properly access |
| 2 |
// variables at different relative scopes |
| 3 |
|
| 4 |
// event |
| 5 |
EventFoo e; |
| 6 |
|
| 7 |
// file-scope |
| 8 |
1 => int fileVar; |
| 9 |
// global |
| 10 |
2 => global float globalVar; |
| 11 |
|
| 12 |
// class def |
| 13 |
class EventFoo extends Event |
| 14 |
{ |
| 15 |
// member variable |
| 16 |
3 => int memberVar; |
| 17 |
// static variable |
| 18 |
4 => static int staticVar; |
| 19 |
|
| 20 |
// VM calls this special function when a shred waits on events |
| 21 |
fun void waiting_on() |
| 22 |
{ |
| 23 |
// print different scopes |
| 24 |
<<< fileVar, globalVar, memberVar, staticVar >>>; |
| 25 |
// this should reactivate the shred |
| 26 |
this.broadcast(); |
| 27 |
} |
| 28 |
} |
| 29 |
|
| 30 |
// wait to trigger the waiting_on() |
| 31 |
e => now; |