2.1.2 [ECMA-262/7] Section 7.4.6 IteratorClose ( iterator, completion )
V0187: IteratorClose is not correctly implemented
The specification states:
7.4.6 IteratorClose( iterator..., completion ) The abstract operation IteratorClose with arguments iteratorRecord ["iterator" in specs prior to 2018] and completion is used to notify an iterator that it should perform any actions it would normally perform when it has reached its completed state: ... Assert: Type... is Object. ... Assert: completion is a Completion Record. ... ... ... Let return be ? GetMethod(iterator, "return"). ... If return is undefined, return Completion(completion). ... Let innerResult be Call(return, iterator, « »). ... If completion.[[type]] is throw, return Completion(completion). ... If innerResult.[[type]] is throw, return Completion(innerResult). ... If Type(innerResult.[[value]]) is not Object, throw a TypeError exception. ... Return Completion(completion).
IteratorClose is not correctly implemented. It behaves as follows:
7.4.6 IteratorClose( iteratorRecord, completion )
1. Assert: Type... is Object.
2. Assert: completion is a Completion Record.
3. Return Completion(completion).