r236982 - clang-format: [JS] Clean up export declaration parsing.
Daniel Jasper
djasper at google.com
Mon May 11 02:14:50 PDT 2015
Author: djasper
Date: Mon May 11 04:14:50 2015
New Revision: 236982
URL: http://llvm.org/viewvc/llvm-project?rev=236982&view=rev
Log:
clang-format: [JS] Clean up export declaration parsing.
NFC intended.
Modified:
cfe/trunk/lib/Format/UnwrappedLineParser.cpp
Modified: cfe/trunk/lib/Format/UnwrappedLineParser.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/UnwrappedLineParser.cpp?rev=236982&r1=236981&r2=236982&view=diff
==============================================================================
--- cfe/trunk/lib/Format/UnwrappedLineParser.cpp (original)
+++ cfe/trunk/lib/Format/UnwrappedLineParser.cpp Mon May 11 04:14:50 2015
@@ -1666,10 +1666,12 @@ void UnwrappedLineParser::parseJavaScrip
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::parseJavaScrip
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();
More information about the cfe-commits
mailing list