summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/ContinuationIndenter.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2015-05-27 05:37:40 +0000
committerDaniel Jasper <djasper@google.com>2015-05-27 05:37:40 +0000
commit3e0dcc27d5eae976d1028f81813158c75a4b37a4 (patch)
tree521fe62a116585b8d0f3f3b3c100a908250522b3 /clang/lib/Format/ContinuationIndenter.cpp
parent7c3bad52dd0bab7e4e9c14e4d21fff0b8d530a29 (diff)
downloadbcm5719-llvm-3e0dcc27d5eae976d1028f81813158c75a4b37a4.tar.gz
bcm5719-llvm-3e0dcc27d5eae976d1028f81813158c75a4b37a4.zip
clang-format: [JS] Fix incorrect detection of ternary expressions.
A definintion like this could not be formatted at all: constructor({aa}: { aa?: string, aaaaaaaa?: string, aaaaaaaaaaaaaaa?: boolean, aaaaaa?: List<string> }) { } llvm-svn: 238291
Diffstat (limited to 'clang/lib/Format/ContinuationIndenter.cpp')
-rw-r--r--clang/lib/Format/ContinuationIndenter.cpp7
1 files changed, 3 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;
OpenPOWER on IntegriCloud