lang/interpret_test/TestAstFunc2/class-include-as-vars2.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 | $y = if $b { |
| 10 | "hello" |
| 11 | } else { |
| 12 | "goodbye" |
| 13 | } |
| 14 | } |
| 15 | class c1($b) { |
| 16 | test "t4" {} |
| 17 | if $b { |
| 18 | test "t5" {} |
| 19 | } else { |
| 20 | test "t6" {} |
| 21 | } |
| 22 | include c0($b) as i0 |
| 23 | $x = $i0.y |
| 24 | } |
| 25 | include c1(true) as i1 |
| 26 | include c1(false) as i2 |
| 27 | |
| 28 | test "${i1.x}" {} |
| 29 | test "${i2.x}" {} |
| 30 | test "${i1.i0.y}" {} # I think these should work directly too. Do we want them to? |
| 31 | test "${i2.i0.y}" {} |
| 32 | -- OUTPUT -- |
| 33 | Vertex: test[goodbye] |
| 34 | Vertex: test[hello] |
| 35 | Vertex: test[t1] |
| 36 | Vertex: test[t2] |
| 37 | Vertex: test[t3] |
| 38 | Vertex: test[t4] |
| 39 | Vertex: test[t5] |
| 40 | Vertex: test[t6] |