]> granicus.if.org Git - clang/commitdiff
clang-format: [JS] Clean up export declaration parsing.
authorDaniel Jasper <djasper@google.com>
Mon, 11 May 2015 09:14:50 +0000 (09:14 +0000)
committerDaniel Jasper <djasper@google.com>
Mon, 11 May 2015 09:14:50 +0000 (09:14 +0000)
NFC intended.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236982 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Format/UnwrappedLineParser.cpp

index 437d688dc57bd9354cd7c83ed5bf7c6a1c579e16..a2afcc0fd5beb003001ec6eb4f160b755966937d 100644 (file)
@@ -1666,10 +1666,12 @@ void UnwrappedLineParser::parseJavaScriptEs6ImportExport() {
   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 @@ void UnwrappedLineParser::parseJavaScriptEs6ImportExport() {
   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();