[PATCH] clang-format: [js] Support template strings.

Daniel Jasper djasper at google.com
Fri Feb 20 04:38:28 PST 2015


Looks good, I'll add the test and commit.


================
Comment at: lib/Format/Format.cpp:798
@@ +797,3 @@
+          IsMultiline || I[0]->NewlinesBefore > 0 || I[0]->IsMultiline;
+      if (I[0]->isNot(tok::unknown) || I[0]->TokenText != "`")
+        continue;
----------------
mprobst wrote:
> djasper wrote:
> > Can you add a test with two template strings? I think that might do the wrong thing as you need to abort when you find a TT_TemplateString.
> It's not strictly needed - if there was a preceding template string, it cannot just equals "`", it must have at least opener and closer "``". But it's a reasonable optimization and IMHO adds clarity.
I agree. Still seems useful to have a test ;-).

http://reviews.llvm.org/D7763

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






More information about the cfe-commits mailing list