mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
v.fmt: keep comments after struct embeds
This commit is contained in:
@@ -187,12 +187,7 @@ fn (mut p Parser) struct_decl() ast.StructDecl {
|
||||
// struct embedding
|
||||
type_pos = p.tok.position()
|
||||
typ = p.parse_type()
|
||||
for p.tok.kind == .comment {
|
||||
comments << p.comment()
|
||||
if p.tok.kind == .rcbr {
|
||||
break
|
||||
}
|
||||
}
|
||||
ecomments := p.eat_comments({})
|
||||
type_pos = type_pos.extend(p.prev_tok.position())
|
||||
if !is_on_top {
|
||||
p.error_with_pos('struct embedding must be declared at the beginning of the struct body',
|
||||
@@ -214,6 +209,7 @@ fn (mut p Parser) struct_decl() ast.StructDecl {
|
||||
embeds << ast.Embed{
|
||||
typ: typ
|
||||
pos: type_pos
|
||||
comments: ecomments
|
||||
}
|
||||
} else {
|
||||
// struct field
|
||||
|
||||
Reference in New Issue
Block a user