so, the big problem with eagerly rewriting destructuring assignment, is the
ambiguity with arrow functions:


`({ x } = { x: 1 }) => x` -> rewriting the destructuring assignment early breaks
things, because binding patterns need to be rewritten differently


So there are a few ways to solve this:

1. Track whether we might be parsing something that is actually a binding
pattern (this is half-done in the current implementation). This is probably
going to slow down code load a fair bit, and it's a more complicated solution
with different parts all over the place.

2. Keep a list of assignments with an AssignmentPattern LHS, the scope they
occur in, and the expression they belong to (full-parser only), and lazily
rewrite these when parsing a FunctionLiteral, or once parsing is finished.

3. Have a mix of both, and only track pattern-like assignments which occur in ambiguous situations (OTOH, the only ambiguity is assignments where the LHS is an ObjectLiteral or ArrayLiteral, which at the top level of a comma-separated
list of expressions to rewrite lazily.

No matter what is picked, it likely has a negative impact on code load, but it
would be nice to minimize it

https://codereview.chromium.org/1309813007/

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to