php7: implement array destructuring
Summary:
Goal is to allow `[$a, [$b, $c]] = [1, [2, 3]]`. This is done by:
- making `list()` an array literal
- allow assigning to array literals
- when we attempt to assign to an array literal, validate that it's a valid LHS
- allow any number of commas at any point in the literal in the parser as `[,,$three,,] = [1,2,3,4,5]` is valid
- in the emitter, raise a fatal if we have any empty values on an RHS, and ignore a single trailing comma
Making `[$a, $b]` a valid assignment_list isn't practical as that makes the
grammar ambiguous.
Not supported in HackC or the typechecker; that doesn't seem practical with the
3.25 timeline.
fixes facebook/hhvm#7535
Differential Revision:
D7057672
fbshipit-source-id:
2447406b4665d0ab1930036517fe17601a23b1b3