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

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

Issue 1829963003: Formatter: Handle the case where you have a whole line of forward slashes. (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
« no previous file with comments | « mojo/public/tools/bindings/mojom_tool/bin/mac64/mojom.sha1 ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojom/mojom_parser/formatter/printer.go
diff --git a/mojom/mojom_parser/formatter/printer.go b/mojom/mojom_parser/formatter/printer.go
index db79f4e42be7d3fa5826874e06739cb187e24788..adcca5353eafb705c30ed3e0141a0020aab693a5 100644
--- a/mojom/mojom_parser/formatter/printer.go
+++ b/mojom/mojom_parser/formatter/printer.go
@@ -668,7 +668,8 @@ func (p *printer) writeSingleLineComment(comment lexer.Token) {
// We expect that the first 2 characters are // followed by a space or tab.
// If the third character is not a space or tab, we insert a space.
- if len(commentText) > 2 && commentText[2] != ' ' && commentText[2] != '\t' {
+ // There is an exception for three forward slashes which are allowed.
+ if len(commentText) > 2 && !strings.ContainsAny(" \t/", commentText[2:3]) {
commentText = "// " + commentText[2:]
}
p.write(commentText)
« no previous file with comments | « mojo/public/tools/bindings/mojom_tool/bin/mac64/mojom.sha1 ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698