v2 / vlib / v / fmt / tests / anon_fn_as_param_keep.vv
20 lines · 14 sloc · 473 bytes · c0843af4f7f926adf35648c79931d41ae32c963e
Raw
1import v.ast
2
3struct Data {
4 a fn (stmt ast.Stmt, vp voidptr) bool
5}
6
7pub fn (a []Data) reduce(iter fn (int, int) int, accum_start int) int {
8 iter(accum_start)
9}
10
11pub fn test_anon_fn_void(func fn ()) int {
12 return 0
13}
14
15fn C.HasAnonFnWithNamedParams(cb fn (c C.bar, d voidptr))
16
17// NB: the signature of both anonymous functions should only differs in the param name
18fn anon_fn_param_has_no_name(f fn (int) string) {}
19
20fn anon_fn_with_named_param(func fn (a int) string) {}
21