[PATCH] clang-format: [js] Support ES6 module imports.

Martin Probst martinprobst at google.com
Thu Feb 19 07:52:54 PST 2015


================
Comment at: lib/Format/UnwrappedLineParser.cpp:1607
@@ +1606,3 @@
+void UnwrappedLineParser::parseJavaScriptEs6Import() {
+  nextToken();  // 'import'
+  if (FormatTok->is(tok::l_brace)) {
----------------
djasper wrote:
> Maybe:
> 
>   assert(FormatTok->is(Keywords.kw_import));
> 
> instead of the comment?
Done.

================
Comment at: unittests/Format/FormatTestJS.cpp:529
@@ +528,3 @@
+  verifyFormat("import {X, Y} from 'some/module.js';");
+  // TODO(martinprobst): +2 indent only, and handle lists w/o trailing comma.
+  verifyFormat("import {\n"
----------------
djasper wrote:
> The first part seems obsolete and I am not sure what you mean by the second.
Dropped, obsolete indeed.

http://reviews.llvm.org/D7753

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list