lang/interpret_test/TestAstFunc2/class-include-as-func2.txtar
raw| 1 | -- main.mcl -- |
| 2 | class c0($b) { |
| 3 | test "t1" {} |
| 4 | if $b { |
| 5 | test "t2" {} |
| 6 | } else { |
| 7 | test "t3" {} |
| 8 | } |
| 9 | func f0() { |
| 10 | if $b { |
| 11 | "hello" |
| 12 | } else { |
| 13 | "goodbye" |
| 14 | } |
| 15 | } |
| 16 | } |
| 17 | class c1($b) { |
| 18 | test "t4" {} |
| 19 | if $b { |
| 20 | test "t5" {} |
| 21 | } else { |
| 22 | test "t6" {} |
| 23 | } |
| 24 | include c0($b) as i0 |
| 25 | func f1() { i0.f0() } |
| 26 | } |
| 27 | include c1(true) as i1 |
| 28 | include c1(false) as i2 |
| 29 | |
| 30 | test [i1.f1(),] {} |
| 31 | test [i2.f1(),] {} |
| 32 | test [i1.i0.f0(),] {} # I think these might work directly too. Do we want them to? |
| 33 | test [i2.i0.f0(),] {} |
| 34 | -- OUTPUT -- |
| 35 | Vertex: test[goodbye] |
| 36 | Vertex: test[hello] |
| 37 | Vertex: test[t1] |
| 38 | Vertex: test[t2] |
| 39 | Vertex: test[t3] |
| 40 | Vertex: test[t4] |
| 41 | Vertex: test[t5] |
| 42 | Vertex: test[t6] |