I'm trying to understand the behavior of iterables in Firefox Nightly and V8. Specifically, I am looking at how the runtime is supposed to behave when the iterable's Symbol.iterator
method returns a non-object value. Here are the relevant parts of the specification (as I understand it):
13.6.4.13 Runtime Semantics: ForIn/OfBodyEvaluation
The abstract operation ForIn/OfBodyEvaluation is called with arguments lhs, stmt, iterator, lhsKind, and labelSet. The value of lhsKind is either assignment, varBinding or lexicalBinding.
- Let oldEnv be the running execution context’s LexicalEnvironment.
- Let V = undefined .
- Let destructuring be IsDestructuring of lhs.
- If destructuring is true and if lhsKind is assignment, then