mprobst marked an inline comment as done.

================
Comment at: unittests/Format/FormatTestJS.cpp:339
@@ +338,3 @@
+               "}");
+  verifyFormat("async function* f() {\n"
+               "  yield fetch(x);\n"
----------------
djasper wrote:
> What does the star mean here? Should we actually introduce a token type or do 
> you think it's just going to work? Specifically, what happens if you need to 
> line-wrap?
The star indicates that this is a function that returns a generator, i.e. 
implicitly returns an iterator in which you shove values with `yield`. I think 
you wouldn't want to wrap between `function` and `*`. We currently don't, but 
more by chance - it's a side effect of not breaking before a binary operator.

`function*` cannot be one token, there may be whitespace and comments in 
between. We could have a `generator star` token, but there are places where 
that'd be hard for us to detect, e.g. the class method above. Having a 
`generator star` only occasionally be recognized of course would be rather 
confusing.

So I'd punt on this for the time beimg. I've added a test to make sure we 
correctly wrap above. Does that make sense?


http://reviews.llvm.org/D19204



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

Reply via email to