Debian Codegraph @

terps/tads/tads3/test/data/modfunc1.t

raw
1 main(args)
2 {
3 "This is main...\n";
4 func('hello'); "\b";
5 g(111); "\b";
6 "calling h(1000):\n";
7 local res = h(1000);
8 "-> return value = <<res>>\n";
9 "\b";
10 }
11
12 /*
13 * test 1 - function with local modify
14 */
15 func(x)
16 {
17 "this is the original func(<<x>>)\n";
18 }
19
20 modify func(x)
21 {
22 "this is the modified func(<<x>>)\n";
23 replaced(x + '[1]');
24 }
25
26 /*
27 * test 2 - function with no local modify
28 */
29 g(x)
30 {
31 "this is the original g(<<x>>)\n";
32 }
33
34 /*
35 * test 3 - function with local modify
36 */
37 h(x)
38 {
39 "this is the original h(<<x>>)\n";
40 return x + 5;
41 }
42
43 modify h(x)
44 {
45 "this is the modified h(<<x>>)\n";
46 return replaced(x * 2);
47 }