mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
fmt: fix anon fn call (#6120)
This commit is contained in:
@@ -1456,12 +1456,16 @@ pub fn (mut f Fmt) call_expr(node ast.CallExpr) {
|
||||
f.or_expr(node.or_block)
|
||||
} else {
|
||||
f.write_language_prefix(node.language)
|
||||
if node.left is ast.AnonFn as anon_fn {
|
||||
f.fn_decl(anon_fn.decl)
|
||||
} else {
|
||||
mut name := f.short_module(node.name)
|
||||
f.mark_module_as_used(name)
|
||||
if node.name in f.mod2alias {
|
||||
name = f.mod2alias[node.name]
|
||||
}
|
||||
f.write('$name')
|
||||
}
|
||||
if node.generic_type != 0 && node.generic_type != table.void_type {
|
||||
f.write('<')
|
||||
f.write(f.type_to_str(node.generic_type))
|
||||
|
||||
7
vlib/v/fmt/tests/anon_fn_call_keep.vv
Normal file
7
vlib/v/fmt/tests/anon_fn_call_keep.vv
Normal file
@@ -0,0 +1,7 @@
|
||||
fn main() {
|
||||
fn () {
|
||||
for {
|
||||
println('Hello V!')
|
||||
}
|
||||
}()
|
||||
}
|
||||
Reference in New Issue
Block a user