diff options
author | Daniel Jasper <djasper@google.com> | 2015-07-10 13:39:26 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2015-07-10 13:39:26 +0000 |
commit | b9a52814bf80e64583b13a137ed4a7768b2fa460 (patch) | |
tree | 3311918cb3e8ba832c40a6b17d072f6570b8faba /clang/lib/Format/TokenAnnotator.cpp | |
parent | 4f8d26230c83d630a7dbc0a7411beb9f25c4c6e0 (diff) | |
download | bcm5719-llvm-b9a52814bf80e64583b13a137ed4a7768b2fa460.tar.gz bcm5719-llvm-b9a52814bf80e64583b13a137ed4a7768b2fa460.zip |
clang-format: [JS] Assign proper penalties when breaking a type annotation
Before:
class Test {
aaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaa:
aaaaaaaaaaaaaaaaaaaaaaaa): aaaaaaaaaaaaaaaaaaaaaa {}
}
After:
class Test {
aaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaa: aaaaaaaaaaaaaaaaaaaaaaaa):
aaaaaaaaaaaaaaaaaaaaaa {}
}
llvm-svn: 241908
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 7664e530fbd..4734ff350d7 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -1628,6 +1628,8 @@ unsigned TokenAnnotator::splitPenalty(const AnnotatedLine &Line, } else if (Style.Language == FormatStyle::LK_JavaScript) { if (Right.is(Keywords.kw_function) && Left.isNot(tok::comma)) return 100; + if (Left.is(TT_JsTypeColon)) + return 100; } if (Left.is(tok::comma) || (Right.is(tok::identifier) && Right.Next && |