Debian Codegraph @

lang/interpret_test/TestAstFunc2/func-gen2.txtar

raw
1 -- main.mcl --
2 # This sort of thing is not currently supported, and not sure if it ever will.
3
4 # test generating a function with outside scoping
5 $const1 = "hello"
6 class funcgen2 {
7 func fun2() {
8 $const1 + " " + $const2
9 }
10 }
11 $const2 = "world" # added here to confirm any-order rules
12
13 include funcgen2
14 $x2 = fun2() # not funcgen2.fun2 since it's *not* an import!
15 test "${x2}" {} # hello world
16 -- OUTPUT --
17 # err: errSetScope: func `fun2` does not exist in this scope