[PATCH] D37142: clang-format: [JS] simplify template string wrapping.
Daniel Jasper via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 28 02:12:33 PDT 2017
djasper added inline comments.
================
Comment at: lib/Format/ContinuationIndenter.cpp:1139
+
+ // On lines containing template strings, propagate NoLineBreak even for dict
+ // and array literals. This is to force wrapping an initial function call if
----------------
This is not the right way to implement this:
- This is a static computation that we could do ahead of time. Doing it inside the combinatorial exploration of solutions is a waste.
- You are doing this always, even in code that doesn't have template strings or isn't even JavaScript.
- This can lead to unexpected behavior if the template string is in a completely unrelated part of the statement. E.g.
someFunction(`test`, { ... });
will be formatted differently from
someFunction('test', { ... });
https://reviews.llvm.org/D37142
More information about the cfe-commits
mailing list