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

more vfmt fixes

This commit is contained in:
Alexander Medvednikov
2019-11-09 22:05:44 +03:00
parent 30481a36dc
commit 3d4f85069f
11 changed files with 91 additions and 50 deletions

View File

@ -9,6 +9,7 @@ fn (p mut Parser) struct_decl() {
is_pub := p.tok == .key_pub
if is_pub {
p.next()
p.fspace()
}
// V can generate Objective C for integration with Cocoa
// `[objc_interface:ParentInterface]`
@ -220,7 +221,7 @@ fn (p mut Parser) struct_decl() {
if p.first_pass() {
p.table.add_field(typ.name, field_name, field_type, is_mut, attr, access_mod)
}
p.fgenln2('')
p.fgenln2('') // newline between struct fields
}
p.check(.rcbr)
if !is_c && !did_gen_something && p.first_pass() {
@ -272,6 +273,7 @@ fn (p mut Parser) struct_init(typ string) string {
}
p.fspace()
did_gen_something = true
p.fgenln2('') // newline between struct fields
}
// If we already set some fields, need to prepend a comma
if t.fields.len != inited_fields.len && inited_fields.len > 0 {
@ -308,6 +310,7 @@ fn (p mut Parser) struct_init(typ string) string {
p.gen(',')
}
did_gen_something = true
p.fgenln2('') // newline between struct fields
}
}
}