| 1 | struct Context { |
| 2 | } |
| 3 | |
| 4 | struct Input { |
| 5 | } |
| 6 | |
| 7 | struct Block { |
| 8 | x int |
| 9 | y int |
| 10 | mut: |
| 11 | children []Element |
| 12 | } |
| 13 | |
| 14 | type Element = Block | Input |
| 15 | |
| 16 | fn (input Input) draw(mut ctx Context, x int, y int) {} |
| 17 | |
| 18 | fn (block Block) draw(mut ctx Context, x int, y int) { |
| 19 | for child in block.children { |
| 20 | child.draw(mut ctx, block.x + x, block.y + y) |
| 21 | } |
| 22 | } |
| 23 | |
| 24 | fn (elt Element) draw(mut ctx Context, x int, y int) { |
| 25 | $for T in Element.variants { |
| 26 | if elt is T { |
| 27 | elt.draw(mut ctx, x, y) |
| 28 | return |
| 29 | } |
| 30 | } |
| 31 | } |
| 32 | |
| 33 | fn test_main() { |
| 34 | assert true |
| 35 | } |
| 36 | |