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:
parent
e80487b35c
commit
3f9b05a876
@ -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')
|
||||
}
|
||||
|
5
vlib/v/fmt/tests/fn_headers_with_no_bodies_keep.vv
Normal file
5
vlib/v/fmt/tests/fn_headers_with_no_bodies_keep.vv
Normal file
@ -0,0 +1,5 @@
|
||||
fn proc_pidpath(int, voidptr, int) int
|
||||
|
||||
fn C.realpath(charptr, charptr) &char
|
||||
|
||||
fn C.chmod(byteptr, int) int
|
Loading…
Reference in New Issue
Block a user