Closed simonbuchan closed 7 years ago
Wow. Thanks for finding these cases. I recently had a go at getting destructuring to work, but clearly missed quite a few cases. I'm away for 10 days, but will try and patch these up when I'm back
@simonbuchan - I've fixed most of these issues, but const [a, ...b, c] = [1, 2, 3, 4]
fails in acorn, and according to http://astexplorer.net, almost everything else (babylon, traceur, shift, esprima). Are you sure that is syntactically vaild (in particular the rest identifier should be the final declaration and cannot be followed by another identifier, as in const [a, ...b] = [1,2,3,4]
)?
Fixed in fast-async@6.0.32
fast-async badly transforms destructuring initializers using anything other than the trivial forms
const [a, b, c] = ...
orconst { a, b, c } = ...;
inside any async functions, even if the RHS is not an await expression. Further, it fails to parse array rest (ES2015, so not #6), and fails while transforming array eliding.Output is:
Array rest gives error:
Without
fast-async
:Array elide gives error: