diff options
author | Daniel Jasper <djasper@google.com> | 2014-05-21 13:26:58 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2014-05-21 13:26:58 +0000 |
commit | 2a958321c8a149b3f4952dc78a8f6edcbcae1996 (patch) | |
tree | 0e6771c20033486e7a789b3eb911d2ab95430857 /clang/lib/Format/ContinuationIndenter.cpp | |
parent | 301a38b0b75600ecc7e1cec7568f11037ad69f94 (diff) | |
download | bcm5719-llvm-2a958321c8a149b3f4952dc78a8f6edcbcae1996.tar.gz bcm5719-llvm-2a958321c8a149b3f4952dc78a8f6edcbcae1996.zip |
clang-format: Fix corner case working around one-per-line dict literals.
Before:
var object_literal_with_long_name = {
a: 'aaaaaaaaaaaaaaaaaa', b: 'bbbbbbbbbbbbbbbbbb'
};
After:
var object_literal_with_long_name = {
a: 'aaaaaaaaaaaaaaaaaa',
b: 'bbbbbbbbbbbbbbbbbb'
};
llvm-svn: 209296
Diffstat (limited to 'clang/lib/Format/ContinuationIndenter.cpp')
-rw-r--r-- | clang/lib/Format/ContinuationIndenter.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp index 389047945c4..e1a559d0df1 100644 --- a/clang/lib/Format/ContinuationIndenter.cpp +++ b/clang/lib/Format/ContinuationIndenter.cpp @@ -444,11 +444,13 @@ unsigned ContinuationIndenter::addTokenOnNewLine(LineState &State, if (State.Stack.back().AvoidBinPacking) { // If we are breaking after '(', '{', '<', this is not bin packing - // unless AllowAllParametersOfDeclarationOnNextLine is false. + // unless AllowAllParametersOfDeclarationOnNextLine is false or this is a + // dict/object literal. if (!(Previous.isOneOf(tok::l_paren, tok::l_brace) || Previous.Type == TT_BinaryOperator) || (!Style.AllowAllParametersOfDeclarationOnNextLine && - State.Line->MustBeDeclaration)) + State.Line->MustBeDeclaration) || + Previous.Type == TT_DictLiteral) State.Stack.back().BreakBeforeParameter = true; } |