archives

« Bugzilla Issues Index

#4091 — Inconsistent definitions of for-in and for-of loops.


The grammar of for-in and for-of loops defined inconsistently throughout the spec. Furthermore, the normative definition of for-in loop is problematic.

1. In [13.6 Iteration Statements], there is no lookahead before LHSExpr in for-in loop but a [lookahead ≠ let] before LHSExpr in a for-of loop.

2. In [13.6.0.1 Static Semantics: Early Errors] and [A.3 Statements], there is a "let [" lookahead before LHSExpr in for-in loop but no before LHSExpr in a for-of loop.

3. In any other places, there is no lookahead restrictions when for-in or for-of loops are mentioned.

According to https://bugs.ecmascript.org/show_bug.cgi?id=2768, there should be a lookahead "let [" in for-in loop and a lookahead "let" in for-of loop.


fixed in rev35 editor's draft

note that the convention the spec. is supposed to be following is that lookahead restrictions are only listed in the actual grammar definitions. They are supposed to be left out when listing productions in the static or run-time semantic rules.


fixed in rev35