Closed Bug 1157419 Opened 10 years ago Closed 10 years ago

Elision following AssignmentRestElement should not be permitted

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1041341

People

(Reporter: jugglinmike, Unassigned)

References

(Blocks 1 open bug)

Details

$ js -e "[...x , ] = [1, 2, 3];" Expected: SyntaxError Actual: successful execution (an new array, `[1, 2, 3]` is assigned to `x`) Additional elisions are incorrectly rejected, i.e. $ js -e "[...x , , ] = [1,2,3]; print(x);" -e:1:8 SyntaxError: parameter after rest parameter: -e:1:8 [...x , , ] = [1,2,3]; print(x); -e:1:8 ........^ Relevant grammar (ES6 12.14.5 Destructuring Assignment): > ArrayAssignmentPattern[Yield] : > [ Elisionopt AssignmentRestElement[?Yield]opt ] > [ AssignmentElementList[?Yield] ] > [ AssignmentElementList[?Yield] , Elisionopt AssignmentRestElement[?Yield]opt ] > > AssignmentRestElement[Yield] : > ... DestructuringAssignmentTarget[?Yield] > > DestructuringAssignmentTarget[Yield] : > LeftHandSideExpression[?Yield] Source: https://people.mozilla.org/~jorendorff/es6-draft.html#sec-destructuring-assignment Build details: commit 07bb578e6a93d11a3e1365e2b0d9296a755543ee Date: Fri Apr 17 13:52:50 2015 -0700
Updating to confirm that this is still an issue with the latest build: $ js -e "[...x , ] = [1]; print(x);" 1 $ js -e "[...x , , ] = [1]; print(x);" -e:1:8 SyntaxError: parameter after rest parameter: -e:1:8 [...x , , ] = [1]; print(x); -e:1:8 ........^ commit 09631fba2e955162f3ffbbdc4f4a5c8b9c926ead Date Mon May 18 13:43:01 2015 +0200
This is basically a dupe of bug 1041341.
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.