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