fmt: keep comments after struct decl default value (#7648)
parent
ecc7c27c9c
commit
ef6011b94c
|
@ -1,8 +1,14 @@
|
||||||
struct Foo {
|
struct Foo {
|
||||||
i int = 1
|
i int = 1 // A comment
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Bar {
|
struct Bar {
|
||||||
f Foo = &Foo(0)
|
f Foo = &Foo(0)
|
||||||
z int [skip] = -1
|
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
|
||||||
|
}
|
||||||
|
|
|
@ -229,6 +229,7 @@ fn (mut p Parser) struct_decl() ast.StructDecl {
|
||||||
else {}
|
else {}
|
||||||
}
|
}
|
||||||
has_default_expr = true
|
has_default_expr = true
|
||||||
|
comments << p.eat_comments()
|
||||||
}
|
}
|
||||||
// TODO merge table and ast Fields?
|
// TODO merge table and ast Fields?
|
||||||
ast_fields << ast.StructField{
|
ast_fields << ast.StructField{
|
||||||
|
|
|
@ -31,8 +31,7 @@ pub:
|
||||||
id string // unique id of client
|
id string // unique id of client
|
||||||
pub mut:
|
pub mut:
|
||||||
conn net.TcpConn // underlying TCP socket connection
|
conn net.TcpConn // underlying TCP socket connection
|
||||||
// size of nounce used for masking
|
nonce_size int = 16 // size of nounce used for masking
|
||||||
nonce_size int = 16
|
|
||||||
panic_on_callback bool // set to true of callbacks can panic
|
panic_on_callback bool // set to true of callbacks can panic
|
||||||
state State // current state of connection
|
state State // current state of connection
|
||||||
logger &log.Log // logger used to log messages
|
logger &log.Log // logger used to log messages
|
||||||
|
|
Loading…
Reference in New Issue