[PATCH] D33193: clang-format: [JS] for async loops.

Daniel Jasper via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 15 06:29:24 PDT 2017


djasper accepted this revision.
djasper added inline comments.
This revision is now accepted and ready to land.


================
Comment at: lib/Format/TokenAnnotator.cpp:583
       Contexts.back().ColonIsForRangeExpr = true;
+      // for async ( ...
+      if (CurrentToken->is(Keywords.kw_async))
----------------
Can we make this JS specific, e.g. by turning l. 579 into:

  if (Style.Language == FormatStyle::LK_JavaScript) {
    if (Tok->Previous && Tok->Previous->is(tok::period))
      break;
    if (CurrentToken->is(Keywords.kw_async))
      next();
  }

Alternatively, leave a comment that this is JavaScript's "async"


================
Comment at: lib/Format/UnwrappedLineParser.cpp:1638
   nextToken();
+  if (FormatTok->is(Keywords.kw_async))
+    nextToken();
----------------
Same here.. Make this JS specific or at least leave a comment.


https://reviews.llvm.org/D33193





More information about the cfe-commits mailing list