summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2016-03-05 18:34:26 +0000
committerDaniel Jasper <djasper@google.com>2016-03-05 18:34:26 +0000
commitacffeb8b633d6d81e63f1d12d35507c38423ffc8 (patch)
treeb1c7bd9a7c1ecd536deb6e207d8b461d1674c6d6 /clang/lib
parentce608690e1098301df73eb25d57b570a30bdd610 (diff)
downloadbcm5719-llvm-acffeb8b633d6d81e63f1d12d35507c38423ffc8.tar.gz
bcm5719-llvm-acffeb8b633d6d81e63f1d12d35507c38423ffc8.zip
clang-format: [JS] Support destructuring assignments in for loops.
Before: for (let { a, b } of x) { } After: for (let {a, b} of x) { } llvm-svn: 262776
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Format/UnwrappedLineParser.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp
index 0c94c52622a..f36b2c8a73d 100644
--- a/clang/lib/Format/UnwrappedLineParser.cpp
+++ b/clang/lib/Format/UnwrappedLineParser.cpp
@@ -363,6 +363,8 @@ void UnwrappedLineParser::calculateBraceTypes(bool ExpectClassBody) {
//
// We exclude + and - as they can be ObjC visibility modifiers.
ProbablyBracedList =
+ (Style.Language == FormatStyle::LK_JavaScript &&
+ NextTok->isOneOf(Keywords.kw_of, Keywords.kw_in)) ||
NextTok->isOneOf(tok::comma, tok::period, tok::colon,
tok::r_paren, tok::r_square, tok::l_brace,
tok::l_square, tok::l_paren, tok::ellipsis) ||
OpenPOWER on IntegriCloud