| 1 | struct Foo {} |
| 2 | |
| 3 | fn (f Foo) a() string { |
| 4 | return 'method_a' |
| 5 | } |
| 6 | |
| 7 | fn (f Foo) b() string { |
| 8 | return 'method_b' |
| 9 | } |
| 10 | |
| 11 | fn test_comptime_call_in_fn_call() { |
| 12 | f := Foo{} |
| 13 | |
| 14 | mut rets := []string{} |
| 15 | |
| 16 | $for method in Foo.methods { |
| 17 | x := f.$method() |
| 18 | println(x) |
| 19 | println(f.$method()) |
| 20 | rets << get_string(f.$method()) |
| 21 | } |
| 22 | assert rets.len == 2 |
| 23 | assert rets[0] == 'method_a' |
| 24 | assert rets[1] == 'method_b' |
| 25 | } |
| 26 | |
| 27 | fn get_string(s string) string { |
| 28 | return s |
| 29 | } |
| 30 |