diff options
author | Martin Probst <martin@probst.io> | 2017-05-22 14:58:26 +0000 |
---|---|---|
committer | Martin Probst <martin@probst.io> | 2017-05-22 14:58:26 +0000 |
commit | ab60acb6983250940093d81117f6bb3fe873e8df (patch) | |
tree | 4aee730d0089df44a77ee50b447de6f9b722c370 /clang/lib/Format/ContinuationIndenter.cpp | |
parent | a881be87ca7eb5f3806bb7e7daa0a0055eff7418 (diff) | |
download | bcm5719-llvm-ab60acb6983250940093d81117f6bb3fe873e8df.tar.gz bcm5719-llvm-ab60acb6983250940093d81117f6bb3fe873e8df.zip |
clang-format: [JS] avoid line breaks before unindented r_parens.
The change that enabled wrapping at the previous scope's indentation had
unintended side-effects in that clang-format would prefer to wrap
closing parentheses to the next line if it avoided a wrap on the next
line (assuming very narrow lines):
fooObject
.someCall(barbazbam)
.then(bam);
Would get formatted as:
fooObject.someCall(barbazbam
).then(bam);
Because the ')' is now indented at the parent level (fooObject).
Normally formatting a builder pattern style call sequence like that is
outlawed in clang-format anyway. However for JavaScript this is special
cased to support trailing .bind calls.
This change disallows this special case when following a closing ')' to
avoid the problem.
Included are some random comment fixes.
Reviewers: djasper
Subscribers: klimek, cfe-commits
Differential Revision: https://reviews.llvm.org/D33399
llvm-svn: 303557
Diffstat (limited to 'clang/lib/Format/ContinuationIndenter.cpp')
-rw-r--r-- | clang/lib/Format/ContinuationIndenter.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp index e99193791f0..006a9710148 100644 --- a/clang/lib/Format/ContinuationIndenter.cpp +++ b/clang/lib/Format/ContinuationIndenter.cpp @@ -207,7 +207,7 @@ bool ContinuationIndenter::mustBreak(const LineState &State) { // ... // }.bind(...)); // FIXME: We should find a more generic solution to this problem. - !(State.Column <= NewLineColumn && + !(State.Column <= NewLineColumn && Previous.isNot(tok::r_paren) && Style.Language == FormatStyle::LK_JavaScript)) return true; |