Fix extra newline after multiline select case bodies

Bug: 346922064
Test: go test
Change-Id: I0587ab04d463a1923440564647d0f1e1bf6d216b
This commit is contained in:
Cole Faust 2024-06-13 15:12:04 -07:00
parent 6dd9fcc314
commit 63acbad058
2 changed files with 38 additions and 1 deletions

View file

@ -227,7 +227,7 @@ func (p *printer) printSelect(s *Select) {
} else {
p.printExpression(c.Value)
}
p.printToken(",", c.Value.Pos())
p.printToken(",", c.Value.End())
}
p.requestNewline()
p.unindent(s.RBracePos)

View file

@ -696,6 +696,43 @@ foo {
(default, default): "b",
}),
}
`,
},
{
name: "Select with multiline inner expression",
input: `
foo {
cflags: [
"-DPRODUCT_COMPATIBLE_PROPERTY",
"-DRIL_SHLIB",
"-Wall",
"-Wextra",
"-Werror",
] + select(soong_config_variable("sim", "sim_count"), {
"2": [
"-DANDROID_MULTI_SIM",
"-DANDROID_SIM_COUNT_2",
],
default: [],
}),
}
`,
output: `
foo {
cflags: [
"-DPRODUCT_COMPATIBLE_PROPERTY",
"-DRIL_SHLIB",
"-Wall",
"-Werror",
"-Wextra",
] + select(soong_config_variable("sim", "sim_count"), {
"2": [
"-DANDROID_MULTI_SIM",
"-DANDROID_SIM_COUNT_2",
],
default: [],
}),
}
`,
},
}