summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/UnwrappedLineParser.cpp
diff options
context:
space:
mode:
authorMartin Probst <martin@probst.io>2017-05-18 21:19:29 +0000
committerMartin Probst <martin@probst.io>2017-05-18 21:19:29 +0000
commita050f41c3c9b9bd4f3bbad48e029309eae0be05c (patch)
tree9c4d04d95f3b086cf617dbd4b4832b5daec28307 /clang/lib/Format/UnwrappedLineParser.cpp
parent5e456b943a479e08e3f59e3520ff73f1cbf94e33 (diff)
downloadbcm5719-llvm-a050f41c3c9b9bd4f3bbad48e029309eae0be05c.tar.gz
bcm5719-llvm-a050f41c3c9b9bd4f3bbad48e029309eae0be05c.zip
clang-format: [JS] for await, and fix a crash with for loops.
Summary: The syntax is actually `for await (const x of y)` (d'oh). This also fixes a crash for `for` tokens not followed by additional tokens. Reviewers: djasper Subscribers: cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D33329 llvm-svn: 303382
Diffstat (limited to 'clang/lib/Format/UnwrappedLineParser.cpp')
-rw-r--r--clang/lib/Format/UnwrappedLineParser.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp
index e2762cd42c4..5758854e7c8 100644
--- a/clang/lib/Format/UnwrappedLineParser.cpp
+++ b/clang/lib/Format/UnwrappedLineParser.cpp
@@ -1636,9 +1636,9 @@ void UnwrappedLineParser::parseForOrWhileLoop() {
assert(FormatTok->isOneOf(tok::kw_for, tok::kw_while, TT_ForEachMacro) &&
"'for', 'while' or foreach macro expected");
nextToken();
- // JS' for async ( ...
+ // JS' for await ( ...
if (Style.Language == FormatStyle::LK_JavaScript &&
- FormatTok->is(Keywords.kw_async))
+ FormatTok->is(Keywords.kw_await))
nextToken();
if (FormatTok->Tok.is(tok::l_paren))
parseParens();
OpenPOWER on IntegriCloud