| | 1 | /* |
| | 2 | * This tests using 'replaced()' (i.e., a call to the original version of |
| | 3 | * a function that was replaced with 'modify') from within an anonymous |
| | 4 | * function within the modifier function. |
| | 5 | */ |
| | 6 | |
| | 7 | main(args) |
| | 8 | { |
| | 9 | myfunc(); |
| | 10 | } |
| | 11 | |
| | 12 | myfunc() |
| | 13 | { |
| | 14 | "This is the original myfunc().\n"; |
| | 15 | } |
| | 16 | |
| | 17 | modify myfunc() |
| | 18 | { |
| | 19 | "This is the replaced myfunc().\n"; |
| | 20 | "Calling replaced()...[\n"; |
| | 21 | replaced(); |
| | 22 | "]... back from replaced()\n"; |
| | 23 | |
| | 24 | local f = new function() |
| | 25 | { |
| | 26 | "In anon - calling replaced...[\n"; |
| | 27 | replaced(); |
| | 28 | "]...back in anon\n"; |
| | 29 | }; |
| | 30 | |
| | 31 | "Again, using an anonymous function...[\n"; |
| | 32 | f(); |
| | 33 | "]...back from anon\n"; |
| | 34 | } |
| | 35 | |