Files
mgmt/lang/interpret_test/TestAstFunc2/import-scope-classes4.txtar
James Shubin 51cf1e2921 lang: ast: The res and edge names should not use exclusives
This removes the exclusive from the res names and edge names. We now
require that the names should be lists of strings, however they can
still be single strings if that can be determined statically.
Programmers should explicitly wrap their variables in a string by
interpolation to force this, or in square brackets to force a list. The
former is generally preferable because it generates a small function
graph since it doesn't need to build a list.
2024-04-18 00:07:53 -04:00

27 lines
685 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: could not set scope: variable f1.x2 not in 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]