ecma262
ecma262 copied to clipboard
ArrayIterator and RegExpStringIterator are no longer reentrant
#2045 made ArrayIterator and RegExpStringIterator no longer reentrant, which doesn't match implementations.
The following test case should throw a TypeError per the current spec, but does throw "unreachable" in all engines.
let obj = {
get 0() {
it.next(); // <-- Should throw a TypeError per current spec!
},
get 1() {
throw "unreachable"; // <-- Unreachable per current spec.
},
length: 2,
};
let it = Array.prototype.values.call(obj);
[...it];
Relevant steps:
- %ArrayIteratorPrototype%.next ( ) calls
GeneratorResume.- GeneratorResume, performs
generator.[[GeneratorState]] to executing.- Side-effects in the ArrayIterator abstract closure call
%ArrayIteratorPrototype%.next.- GeneratorResume calls
GeneratorValidate.- GeneratorValidate throws a TypeError because
state is executing.
- GeneratorValidate throws a TypeError because
- GeneratorResume calls
- Side-effects in the ArrayIterator abstract closure call
- GeneratorResume, performs