Kevin Smith wrote:
async function af() {}
{ async af() { } }
This lines up with what Luke Hoban presented at the last TC39 meeting.
So far, so good (but not a done deal by any means, of course). The main
bone of contention is the use of ! in promises future-proposed syntax.
The hard part is arrow functions. One possibility would be to use
another cover grammar and place the modifier to the left of the arrow
function:
modifier [NoNewLine] Identifier =>
modifier [NoNewLine] ArgumentList =>
We could do this.
We could probably reuse some of the existing arrow function parsing
strategy to back up the input stream or transform the AST.
It smells, but we're used to it!
Another possibility would be to place the modifier to the right of the
argument list:
Identifier [NoNewLine] modifier => ...
ArgumentList [NoNewLine] modifier => ...
e.g.
x async=> {}
(a, b, c) async=> {}
This would be easier to parse, and would align with a potential
"generator arrow":
x *=> {}
(Presuming that we can give up on arrows with empty parameter lists.)
Bletch, and don't multiple risks unnecesasrily by entangling with
opposition to empty arrow param list elision.
/be
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss