Get rid of some extra newlines in bpfmt
Bug: 323382414 Test: go tests, and I also ran both the old/new bpfmts on the whole aosp source tree, and the only difference between the results was one extra removed line in external/uwb Change-Id: I4942c9247a66f1de5028de39caa5cd34b66093c3
This commit is contained in:
parent
a962edf763
commit
d2f1141871
2 changed files with 5 additions and 7 deletions
|
@ -144,6 +144,7 @@ func (p *printer) printSelect(s *Select) {
|
||||||
}
|
}
|
||||||
if len(s.Cases) == 1 && s.Cases[0].Pattern.Value == "__soong_conditions_default__" {
|
if len(s.Cases) == 1 && s.Cases[0].Pattern.Value == "__soong_conditions_default__" {
|
||||||
p.printExpression(s.Cases[0].Value)
|
p.printExpression(s.Cases[0].Value)
|
||||||
|
p.pos = s.RBracePos
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
p.requestSpace()
|
p.requestSpace()
|
||||||
|
@ -317,8 +318,8 @@ func (p *printer) printEndOfLineCommentsBefore(pos scanner.Position) {
|
||||||
if len(p.skippedComments) > 0 {
|
if len(p.skippedComments) > 0 {
|
||||||
for _, c := range p.skippedComments {
|
for _, c := range p.skippedComments {
|
||||||
p.printComment(c)
|
p.printComment(c)
|
||||||
|
p._requestNewline()
|
||||||
}
|
}
|
||||||
p._requestNewline()
|
|
||||||
p.skippedComments = nil
|
p.skippedComments = nil
|
||||||
}
|
}
|
||||||
for p.curComment < len(p.comments) && p.comments[p.curComment].Pos().Line < pos.Line {
|
for p.curComment < len(p.comments) && p.comments[p.curComment].Pos().Line < pos.Line {
|
||||||
|
@ -406,7 +407,9 @@ func (p *printer) printComment(cg *CommentGroup) {
|
||||||
p._requestNewline()
|
p._requestNewline()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
p.pos = comment.End()
|
if p.pos.Offset < comment.End().Offset {
|
||||||
|
p.pos = comment.End()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -281,7 +281,6 @@ module // test
|
||||||
output: `
|
output: `
|
||||||
// test
|
// test
|
||||||
module { // test
|
module { // test
|
||||||
|
|
||||||
srcs: [
|
srcs: [
|
||||||
"src1.c",
|
"src1.c",
|
||||||
"src2.c",
|
"src2.c",
|
||||||
|
@ -356,9 +355,7 @@ test // test
|
||||||
`,
|
`,
|
||||||
output: `
|
output: `
|
||||||
test { // test
|
test { // test
|
||||||
|
|
||||||
// test
|
// test
|
||||||
|
|
||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
},
|
},
|
||||||
|
@ -598,12 +595,10 @@ foo {
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
// TODO(b/323382414): This shouldn't have an empty newline after stuff
|
|
||||||
output: `
|
output: `
|
||||||
// test
|
// test
|
||||||
foo {
|
foo {
|
||||||
stuff: "c2", // test2
|
stuff: "c2", // test2
|
||||||
|
|
||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue