| 1 |
-- main.mcl -- |
| 2 |
import "fmt" |
| 3 |
|
| 4 |
# we should only see one copy of $s1, $s2 and $fn |
| 5 |
$s1 = "hello" |
| 6 |
$fn = func() { |
| 7 |
$s1 + " " + $s2 |
| 8 |
} |
| 9 |
$s2 = "world" |
| 10 |
|
| 11 |
test "greeting1" { |
| 12 |
anotherstr => $fn(), |
| 13 |
} |
| 14 |
test "greeting2" { |
| 15 |
anotherstr => $fn(), |
| 16 |
} |
| 17 |
test "greeting3" { |
| 18 |
anotherstr => $fn(), |
| 19 |
} |
| 20 |
-- OUTPUT -- |
| 21 |
Edge: FuncValue -> call # fn |
| 22 |
Edge: FuncValue -> call # fn |
| 23 |
Edge: FuncValue -> call # fn |
| 24 |
Vertex: FuncValue |
| 25 |
Vertex: call |
| 26 |
Vertex: call |
| 27 |
Vertex: call |
| 28 |
Vertex: const |
| 29 |
Vertex: const |
| 30 |
Vertex: const |