Debian Codegraph @

lang/interpret_test/TestAstFunc2/class-include-as-class0.txtar

raw
1 -- main.mcl --
2 class c1 {
3 test "t1" {}
4 $y = "hello"
5 class c0 {
6 test "t2" {}
7 $x = "goodbye"
8 }
9 }
10 include c1 as i1 # has $y
11 include i1.c0 as i0 # has $x ...and $y
12
13 test "${i0.x}" {} # ok
14 test "${i1.y}" {} # ok
15 panic($i0.x != "goodbye")
16 panic($i1.y != "hello")
17
18 # the really tricky case
19 # XXX: works atm, but not supported for now: could not set scope: variable i0.y not in scope
20 # We currently re-export anything in the parent scope as available from our
21 # current child scope, which makes this variable visible. Unfortunately, it does
22 # not have the correct dependency (edge) present in the Ordering system, so it
23 # is flaky depending on luck of the toposort.
24 #test "${i0.y}" {}
25
26 -- OUTPUT --
27 Vertex: test[goodbye]
28 Vertex: test[hello]
29 Vertex: test[t1]
30 Vertex: test[t2]