[PATCH] D20198: clang-format: [JS] sort ES6 imports.

Martin Probst via cfe-commits cfe-commits at lists.llvm.org
Tue May 17 00:10:33 PDT 2016


mprobst marked an inline comment as done.

================
Comment at: lib/Format/SortJavaScriptImports.cpp:77
@@ +76,3 @@
+    return false;
+  // NB: empty URLs sort *last* (for export {...};).
+  if (LHS.URL.empty() != RHS.URL.empty())
----------------
djasper wrote:
> NB?
"Nota bene". Seems to be uncommon in this code base, so removed.

================
Comment at: lib/Format/SortJavaScriptImports.cpp:255
@@ +254,3 @@
+    // * as prefix from '...';
+    if (Current->is(tok::star)) {
+      if (!nextToken())
----------------
djasper wrote:
> We probably should really have a variant of AnnotatedLine::startsWith() that can start at an arbitrary token. But we can try that in a follow-up.
Maybe that should be a function on FormatToken itself, that searches the linked list rooted at it?

`Current->startsSequence(tok::star, Keywords.kw_as, tok::identifier)`?

I'll take a stab at that.


http://reviews.llvm.org/D20198





More information about the cfe-commits mailing list