mprobst 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
----------------
djasper wrote:
> 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', { ... });
Ack. Do you have suggestions?

I could introduce a `bool  ParenState::NoLineBreakMustPropagate;` that controls 
this behaviour.


https://reviews.llvm.org/D37142



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to