| 1 | module main |
| 2 | |
| 3 | struct Particle { |
| 4 | name string |
| 5 | } |
| 6 | |
| 7 | struct ParticleSystem { |
| 8 | name string |
| 9 | particle &Particle |
| 10 | } |
| 11 | |
| 12 | struct Ship { |
| 13 | name string |
| 14 | particle_system &ParticleSystem |
| 15 | } |
| 16 | |
| 17 | fn test_main() { |
| 18 | ship := &Ship{ |
| 19 | name: 'ship' |
| 20 | particle_system: &ParticleSystem{ |
| 21 | name: 'thrust' |
| 22 | particle: &Particle{ |
| 23 | name: 'thrust_particle' |
| 24 | } |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | ship_clone := &Ship{ |
| 29 | ...ship |
| 30 | } |
| 31 | assert ship_clone.particle_system.particle == ship.particle_system.particle |
| 32 | } |
| 33 |