IteratorClose on spread expression
# Claude Pache (9 years ago)
Le 23 juin 2015 à 14:58, Gary Guo <nbdd0121 at hotmail.com> a écrit :
To me it seems that spread expression will not call IteratorClose (neither in ArrayLiteral nor in Argument List), but IteratorClose is called in other places in the spec where iterators are used, ex. for-of, destructuring, builtin functions). Is this intended or this is a bug in the spec?
Gary Guo
In spread expressions for instance, the iterator is supposed to close itself, either when it is exhausted or when it throws an exception.
But in some places, like for/of loops or destructuring assignments, an abrupt completion may come from an other source than the iterator being traversed; in which case (and only in that case) the iterator is explicitly closed.
To me it seems that spread expression will not call IteratorClose (neither in ArrayLiteral nor in Argument List), but IteratorClose is called in other places in the spec where iterators are used, ex. for-of, destructuring, builtin functions). Is this intended or this is a bug in the spec? Gary Guo