Debian Codegraph @

lang/interpret_test/TestAstFunc2/import-scope-classes3.txtar

raw
1 -- main.mcl --
2 $x = "i am x" # i am top-level
3
4 class c2() {
5 $z = "i am y and " + $x
6
7 # Since $x is pulled in from top-level automatically, we don't allow the
8 # re-definition by shadowing of the same variable.
9 $x = $x # not allowed
10 #$x = $x + "wow" # allowed?
11 }
12
13 include c2 as f1
14
15 test "${f1.z}" {}
16 test "${f1.x}" {} # tricky
17 test "${f1.newx}" {}
18
19 -- OUTPUT --
20 # err: errSetScope: recursive reference while setting scope: not a dag