Files
mgmt/lang/interpret_test/TestAstFunc2/import-scope-classes4.txtar
2025-03-12 03:33:08 -04:00

28 lines
711 B
Plaintext

-- main.mcl --
$x1 = "i am x1" # i am top-level
$x2 = "i am x2" # i am top-level
class c2() {
$z = "i am y and " + $x1
$x1 = "hey" # shadow
}
include c2 as f1
test "${f1.z}" {}
test "${f1.x1}" {}
# the really tricky case
# XXX: works atm, but not supported for now, error is:
# could not set scope: var `$f1.x2` does not exist in this scope
# We currently re-export anything in the parent scope as available from our
# current child scope, which makes this variable visible. Unfortunately, it does
# not have the correct dependency (edge) present in the Ordering system, so it
# is flaky depending on luck of the toposort.
#test "${f1.x2}" {}
-- OUTPUT --
Vertex: test[hey]
Vertex: test[i am y and hey]