| 1 | struct Foo { |
| 2 | mut: |
| 3 | test string |
| 4 | name string |
| 5 | } |
| 6 | |
| 7 | fn (f Foo) print() { |
| 8 | println('test') |
| 9 | } |
| 10 | |
| 11 | fn test[T]() { |
| 12 | mut t := T{} |
| 13 | t.name = '2' |
| 14 | $for f in T.fields { |
| 15 | $if f.typ is string { |
| 16 | println(t.$(f.name)) |
| 17 | } |
| 18 | } |
| 19 | } |
| 20 | |
| 21 | fn main() { |
| 22 | test[Foo]() |
| 23 | } |
| 24 | |