[PATCH] D19204: clang-format: [JS] generator and async functions.

Martin Probst via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 19 11:32:54 PDT 2016


mprobst marked an inline comment as done.

================
Comment at: unittests/Format/FormatTestJS.cpp:339
@@ +338,3 @@
+TEST_F(FormatTestJS, AsyncFunctions) {
+  verifyFormat("async function f() {\n"
+               "  let x = 1;\n"
----------------
djasper wrote:
> Fundamentally, I think there is two things we might need to do:
> 1. Not allow wrapping it. I am ok with keeping that based on the operator wrapping for now, but it seems a bit dodgy.
> 2. The ExpressionParser in TokenAnnotator.cpp must not treat this as a binary operator or else it might do weird things with indentation. What't the token type at the moment?
For (1) if needed we can detect the immediately preceding `function`.
For (2), token type is `tok::star`. Indentation in the wrapping example seems fine.

Overall I find it highly unlikely that this becomes a problem, having generator functions that wrap is unlikely, they tend to be top level functions.


http://reviews.llvm.org/D19204





More information about the cfe-commits mailing list