1
0
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:
Daniel Däschle
2020-08-13 20:05:59 +02:00
committed by GitHub
parent 1135dffe2d
commit 34b28cb68a
2 changed files with 16 additions and 5 deletions

View File

@@ -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)
mut name := f.short_module(node.name)
f.mark_module_as_used(name)
if node.name in f.mod2alias {
name = f.mod2alias[node.name]
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')
}
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))

View File

@@ -0,0 +1,7 @@
fn main() {
fn () {
for {
println('Hello V!')
}
}()
}