vxx2 / vlib / v / checker / tests / no_heap_struct.vv
25 lines · 21 sloc · 183 bytes · d26ac5692e174967d4c9caae2bf4d62f2fbe76e1
Raw
1struct Abc {
2mut:
3 n int
4}
5
6struct St {
7mut:
8 a &Abc
9}
10
11fn f(x &Abc) St {
12 s := St{
13 a: x
14 }
15 return s
16}
17
18fn g(mut x Abc) &Abc {
19 return x
20}
21
22fn h(x &Abc) &Abc {
23 y := x
24 return y
25}
26