1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

vfmt: skip {} for pure fn declarations (let the bodies hit the floor)

This commit is contained in:
Delyan Angelov 2020-11-05 18:59:36 +02:00
parent e80487b35c
commit 3f9b05a876
2 changed files with 10 additions and 3 deletions

View File

@ -1219,9 +1219,11 @@ pub fn (mut f Fmt) fn_decl(node ast.FnDecl) {
f.attrs(node.attrs)
f.write(node.stringify(f.table, f.cur_mod)) // `Expr` instead of `ast.Expr` in mod ast
if node.language == .v {
f.writeln(' {')
f.stmts(node.stmts)
f.write('}')
if !node.no_body {
f.writeln(' {')
f.stmts(node.stmts)
f.write('}')
}
if !node.is_anon {
f.writeln('\n')
}

View File

@ -0,0 +1,5 @@
fn proc_pidpath(int, voidptr, int) int
fn C.realpath(charptr, charptr) &char
fn C.chmod(byteptr, int) int