archives

« Bugzilla Issues Index

#4378 — 13.7.5.1: suggested restructuring of early errors


In 13.7.5.1 "Static Semantics: Early Errors",
group 1 would be easier to understand if the rules were written more like this:

- If LeftHandSideExpression is either an ObjectLiteral or an ArrayLiteral,
then
- If the lexical token sequence matched by LeftHandSideExpression
can be parsed with no tokens left over using AssignmentPattern
as the goal symbol, then
Apply the Early Error rules for AssignmentPattern to the result of
that parse.
- Else
It is a Syntax Error
- Else
- If IsValidSimpleAssignmentTarget of LeftHandSideExpression is false,
it is a Syntax Error.

- If the LeftHandSideExpression is
CoverParenthesizedExpressionAndArrowParameterList : ( Expression )
and [etc].
[This rule could be at this level or the outer level, to taste.]

I realize that no set of Early Error rules is currently written this way (though there are hints of it in 14.1.2, 14.2.1, 14.5.1, and 15.2.3.1), but I think the flat-list-of-bullets format is getting in the way of clarity here.