Skip to content

Commit 60580a0

Browse files
1 parent 99867ff commit 60580a0

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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');

0 commit comments

Comments
 (0)