fmt: keep comments after struct decl default value (#7648)

pull/7650/head^2
Lukas Neubert 2020-12-28 14:38:21 +01:00 committed by GitHub
parent ecc7c27c9c
commit ef6011b94c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 3 deletions

View File

@ -1,8 +1,14 @@
struct Foo {
i int = 1
i int = 1 // A comment
}
struct Bar {
f Foo = &Foo(0)
z int [skip] = -1
}
struct Baz {
x int = 1 // It's one
y string = 'one' // It's one written out
z bool = true // Also one
}

View File

@ -229,6 +229,7 @@ fn (mut p Parser) struct_decl() ast.StructDecl {
else {}
}
has_default_expr = true
comments << p.eat_comments()
}
// TODO merge table and ast Fields?
ast_fields << ast.StructField{

View File

@ -31,8 +31,7 @@ pub:
id string // unique id of client
pub mut:
conn net.TcpConn // underlying TCP socket connection
// size of nounce used for masking
nonce_size int = 16
nonce_size int = 16 // size of nounce used for masking
panic_on_callback bool // set to true of callbacks can panic
state State // current state of connection
logger &log.Log // logger used to log messages