Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1269)

Unified Diff: mojom/mojom_parser/formatter/printer.go

Issue 1833493002: Replace ErrorExit with log.Fatal in the mojom tool. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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.

Powered by Google App Engine
This is Rietveld 408576698