clang-format: [JS] Clean up export declaration parsing.
NFC intended.
llvm-svn: 236982
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp
index 437d688..a2afcc0 100644
--- a/clang/lib/Format/UnwrappedLineParser.cpp
+++ b/clang/lib/Format/UnwrappedLineParser.cpp
@@ -1666,10 +1666,12 @@
assert(FormatTok->isOneOf(Keywords.kw_import, tok::kw_export));
nextToken();
- // Consume "function" and "default function", so that these get parsed as
- // free-standing JS functions, i.e. do not require a trailing semicolon.
+ // Consume the "default" in "export default class/function".
if (FormatTok->is(tok::kw_default))
nextToken();
+
+ // Consume "function" and "default function", so that these get parsed as
+ // free-standing JS functions, i.e. do not require a trailing semicolon.
if (FormatTok->is(Keywords.kw_function)) {
nextToken();
return;
@@ -1678,11 +1680,6 @@
if (FormatTok->isOneOf(tok::kw_const, tok::kw_class, Keywords.kw_var))
return; // Fall through to parsing the corresponding structure.
- if (FormatTok->is(tok::kw_default)) {
- nextToken(); // export default ..., fall through after eating 'default'.
- return;
- }
-
if (FormatTok->is(tok::l_brace)) {
FormatTok->BlockKind = BK_Block;
parseBracedList();