| Index: mojom/mojom_parser/formatter/printer.go
|
| diff --git a/mojom/mojom_parser/formatter/printer.go b/mojom/mojom_parser/formatter/printer.go
|
| index 6de06c3c2e80b2fc60eee83fb434b0f5f2de99f5..db79f4e42be7d3fa5826874e06739cb187e24788 100644
|
| --- a/mojom/mojom_parser/formatter/printer.go
|
| +++ b/mojom/mojom_parser/formatter/printer.go
|
| @@ -574,7 +574,11 @@ func (p *printer) writeAboveComments(el mojom.MojomElement) {
|
| func (p *printer) writeFinalComments(container mojom.DeclaredObjectsContainer) {
|
| el := container.(mojom.MojomElement)
|
| attachedComments := el.AttachedComments()
|
| - if attachedComments == nil || len(attachedComments.Final) == 0 {
|
| + if attachedComments == nil {
|
| + return
|
| + }
|
| + finalComments := trimEmptyLinesEnd(attachedComments.Final)
|
| + if len(finalComments) == 0 {
|
| return
|
| }
|
|
|
| @@ -582,11 +586,11 @@ func (p *printer) writeFinalComments(container mojom.DeclaredObjectsContainer) {
|
| // container.
|
| if len(container.GetDeclaredObjects()) > 0 {
|
| p.nl()
|
| - if attachedComments.Final[0].Kind == lexer.EmptyLine {
|
| + if finalComments[0].Kind == lexer.EmptyLine {
|
| p.nl()
|
| }
|
| }
|
| - p.writeCommentBlocks(attachedComments.Final, false)
|
| + p.writeCommentBlocks(finalComments, false)
|
| }
|
|
|
| // writeLeftComments writes the comments left of a MojomElement.
|
|
|