archives

« Bugzilla Issues Index

#3531 — 12.14.1, 12.14.5.1 Early Errors: Unnecessary Early Errors rules


12.14.1 Static Semantics: Early Errors

`AssignmentExpression : LeftHandSideExpression = AssignmentExpression`

The second bullet item can be removed.



12.14.5.1 Static Semantics: Early Errors

`AssignmentProperty : IdentifierReference Initializer_opt`

The second bullet item can be removed, static resolution has been removed.


`DestructuringAssignmentTarget : LeftHandSideExpression`

The third bullet item and its corresponding note can be removed.


Somewhat related: `[...([])] = []` is a syntax error, right?


fixed in rev31 editor's draft

`[...([])] = []` is valid syntax. It eventually evaluates using second rule in 12.14.5.2


In `[...([])]`, DestructuringAssignmentTarget : LeftHandSideExpression is `([])`. `([])` is neither an ObjectLiteral nor an ArrayLiteral, so the second early error restriction in 12.14.5.1 applies. And IsValidSimpleAssignmentTarget of `([])` is false, so an early error should be thrown.

---

AssignmentRestElement[Yield] :
... DestructuringAssignmentTarget[?Yield]

DestructuringAssignmentTarget[Yield] :
LeftHandSideExpression[?Yield]


12.14.5.1 Static Semantics: Early Errors

- It is a Syntax Error if LeftHandSideExpression is either an ObjectLiteral or an ArrayLiteral and if the lexical token sequence matched by LeftHandSideExpression cannot be parsed with no tokens left over using AssignmentPattern as the goal symbol.

- It is a Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral and IsValidSimpleAssignmentTarget(LeftHandSideExpression) is false.

---


In Rev31