File tree Expand file tree Collapse file tree 1 file changed +47
-0
lines changed
test/built-ins/Iterator/concat Expand file tree Collapse file tree 1 file changed +47
-0
lines changed Original file line number Diff line number Diff line change 1+ // Copyright (C) 2025 Michael Ficarra. All rights reserved.
2+ // This code is governed by the BSD license found in the LICENSE file.
3+
4+ /*---
5+ esid: sec-iterator.concat
6+ description: >
7+ Iterator.concat accesses the value of a done IteratorResult, matching the behaviour of yield*
8+ info: |
9+ Iterator.concat ( ...items )
10+
11+ ...
12+ 3. Let closure be a new Abstract Closure with no parameters that captures iterables and performs the following steps when called:
13+ a. For each Record iterable of iterables, do
14+ ...
15+ v. Repeat, while innerAlive is true,
16+ 1. Let iteratorResult be ? IteratorNext(iteratorRecord).
17+ 2. Let done be Completion(IteratorComplete(iteratorResult)).
18+ 3. If done is a throw completion, then
19+ a. Set iteratorRecord.[[Done]] to true.
20+ b. Return ? done.
21+ 4. Set done to ! done.
22+ 5. If done is true, then
23+ a. Set iteratorRecord.[[Done]] to true.
24+ b. Perform ? IteratorValue(iteratorResult).
25+ ...
26+ features: [iterator-sequencing]
27+ ---*/
28+
29+ let valueAccesses = 0 ;
30+ let iter = {
31+ [ Symbol . iterator ] ( ) {
32+ return {
33+ next ( ) {
34+ return {
35+ get value ( ) {
36+ ++ valueAccesses ;
37+ } ,
38+ done : true ,
39+ } ;
40+ } ,
41+ } ;
42+ }
43+ } ;
44+
45+ Array . from ( Iterator . concat ( iter , iter , iter ) ) ;
46+
47+ assert . sameValue ( valueAccesses , 3 , 'Iterator.concat also accesses value getter after each iterator is done' ) ;
You can’t perform that action at this time.
0 commit comments