diff options
author | Daniel Jasper <djasper@google.com> | 2014-11-27 15:24:48 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2014-11-27 15:24:48 +0000 |
commit | 4087432f8b74f9f738604a064c37825dba57b7d1 (patch) | |
tree | b8cdf63b44a7a07ee4d61163249a1334f066ed02 /clang/lib/Format/TokenAnnotator.cpp | |
parent | 0d86c7623f6d0a338366b6e0ebdf9bd78c616278 (diff) | |
download | bcm5719-llvm-4087432f8b74f9f738604a064c37825dba57b7d1.tar.gz bcm5719-llvm-4087432f8b74f9f738604a064c37825dba57b7d1.zip |
clang-format: [JS] Try not to break in container literals.
Before:
var obj = {
fooooooooo:
function(x) { return x.zIsTooLongForOneLineWithTheDeclarationLine(); }
};
After:
var obj = {
fooooooooo: function(x) {
return x.zIsTooLongForOneLineWithTheDeclarationLine();
}
};
llvm-svn: 222892
Diffstat (limited to 'clang/lib/Format/TokenAnnotator.cpp')
-rw-r--r-- | clang/lib/Format/TokenAnnotator.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index d6c823e39b8..718a0193624 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -1548,6 +1548,8 @@ unsigned TokenAnnotator::splitPenalty(const AnnotatedLine &Line, return 0; if (Left.is(tok::colon) && Left.is(TT_ObjCMethodExpr)) return Line.MightBeFunctionDecl ? 50 : 500; + if (Left.is(tok::colon) && Left.is(TT_DictLiteral)) + return 100; if (Left.is(tok::l_paren) && InFunctionDecl && Style.AlignAfterOpenBracket) return 100; |