| 1 |
-- main.mcl -- |
| 2 |
$x1 = "i am x1" # i am top-level |
| 3 |
$x2 = "i am x2" # i am top-level |
| 4 |
|
| 5 |
class c2() { |
| 6 |
$z = "i am y and " + $x1 |
| 7 |
|
| 8 |
$x1 = "hey" # shadow |
| 9 |
} |
| 10 |
|
| 11 |
include c2 as f1 |
| 12 |
|
| 13 |
test "${f1.z}" {} |
| 14 |
test "${f1.x1}" {} |
| 15 |
|
| 16 |
# the really tricky case |
| 17 |
# XXX: works atm, but not supported for now: could not set scope: variable f1.x2 not in scope |
| 18 |
# We currently re-export anything in the parent scope as available from our |
| 19 |
# current child scope, which makes this variable visible. Unfortunately, it does |
| 20 |
# not have the correct dependency (edge) present in the Ordering system, so it |
| 21 |
# is flaky depending on luck of the toposort. |
| 22 |
#test "${f1.x2}" {} |
| 23 |
|
| 24 |
-- OUTPUT -- |
| 25 |
Vertex: test[hey] |
| 26 |
Vertex: test[i am y and hey] |