summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Format/ContinuationIndenter.cpp7
-rw-r--r--clang/unittests/Format/FormatTestJS.cpp7
2 files changed, 10 insertions, 4 deletions
diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp
index 3234e084f2f..4e8f5af263d 100644
--- a/clang/lib/Format/ContinuationIndenter.cpp
+++ b/clang/lib/Format/ContinuationIndenter.cpp
@@ -143,11 +143,10 @@ bool ContinuationIndenter::mustBreak(const LineState &State) {
if (Previous.is(tok::semi) && State.LineContainsContinuedForLoopSection)
return true;
if ((startsNextParameter(Current, Style) || Previous.is(tok::semi) ||
- (Style.BreakBeforeTernaryOperators &&
- (Current.is(tok::question) ||
- (Current.is(TT_ConditionalExpr) && Previous.isNot(tok::question)))) ||
+ (Style.BreakBeforeTernaryOperators && Current.is(TT_ConditionalExpr) &&
+ Previous.isNot(tok::question)) ||
(!Style.BreakBeforeTernaryOperators &&
- (Previous.is(tok::question) || Previous.is(TT_ConditionalExpr)))) &&
+ Previous.is(TT_ConditionalExpr))) &&
State.Stack.back().BreakBeforeParameter && !Current.isTrailingComment() &&
!Current.isOneOf(tok::r_paren, tok::r_brace))
return true;
diff --git a/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp
index d5625a27976..a06daac24ec 100644
--- a/clang/unittests/Format/FormatTestJS.cpp
+++ b/clang/unittests/Format/FormatTestJS.cpp
@@ -753,6 +753,13 @@ TEST_F(FormatTestJS, OptionalTypes) {
" y?(): z;\n"
"}");
verifyFormat("x ? 1 : 2;");
+ verifyFormat("constructor({aa}: {\n"
+ " aa?: string,\n"
+ " aaaaaaaa?: string,\n"
+ " aaaaaaaaaaaaaaa?: boolean,\n"
+ " aaaaaa?: List<string>\n"
+ "}) {\n"
+ "}");
}
TEST_F(FormatTestJS, IndexSignature) {
OpenPOWER on IntegriCloud