archives

« Bugzilla Issues Index

#3942 — 13.6.4.13 ForIn/OfBodyEvaluation: Switch steps 5.b.iv-v


13.6.4.13 Runtime Semantics: ForIn/OfBodyEvaluation

Steps 5.b.iv-v should be switched for consistency with other lexical declaration binding instantiations.


Compare:
---
13.1.13 Runtime Semantics: Evaluation
3. Perform BlockDeclarationInstantiation(StatementList, blockEnv).
4. Set the running execution context’s LexicalEnvironment to blockEnv.

13.6.3.7 Runtime Semantics: LabelledEvaluation
5. For each element dn of boundNames do [...]
6. Set the running execution context’s LexicalEnvironment to loopEnv

13.6.3.9 Runtime Semantics: CreatePerIterationEnvironment
e. For each element bn of perIterationBindings do, [...]
f. Set the running execution context’s LexicalEnvironment to thisIterationEnv.

13.6.4.12 Runtime Semantics: ForIn/OfHeadEvaluation ( TDZnames, expr, iterationKind, labelSet)
c. For each string name in TDZnames, do [...]
d. Set the running execution context’s LexicalEnvironment to TDZ.

13.14.7 Runtime Semantics: CatchClauseEvaluation
3. For each element argName of the BoundNames of CatchParameter, do [...]
4. Set the running execution context’s LexicalEnvironment to catchEnv.
---

The new bindings are first created and then the lexical environment is applied.


In 13.6.4.13 these steps are reversed.
---
13.6.4.13 Runtime Semantics: ForIn/OfBodyEvaluation ( lhs, stmt, iterator, lhsKind, labelSet )
iv. Set the running execution context’s LexicalEnvironment to iterationEnv.
v. Perform BindingInstantiation for lhs passing iterationEnv as the argument.
---


(The evaluation order is not observable from user script, so this is just spec polishing...)


fixed in rev34 editor's draft


fixed in rev34