-
Notifications
You must be signed in to change notification settings - Fork 535
Expand file tree
/
Copy pathfresh-iterator-result.js
More file actions
49 lines (40 loc) · 1.12 KB
/
fresh-iterator-result.js
File metadata and controls
49 lines (40 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Copyright (C) 2024 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-iterator.concat
description: >
Returns a fresh iterator result object
info: |
Iterator.concat ( ...items )
...
3. Let closure be a new Abstract Closure with no parameters that captures iterables and performs the following steps when called:
a. For each Record iterable of iterables, do
...
v. Repeat, while innerAlive is true,
1. Let innerValue be ? IteratorStepValue(iteratorRecord).
2. If innerValue is done, then
...
3. Else,
a. Let completion be Completion(Yield(innerValue)).
...
features: [iterator-sequencing]
---*/
let oldIterResult = {
done: false,
value: 123,
};
let testIterator = {
next() {
return oldIterResult;
}
};
let iterable = {
[Symbol.iterator]() {
return testIterator;
}
};
let iterator = Iterator.concat(iterable);
let iterResult = iterator.next();
assert.sameValue(iterResult.done, false);
assert.sameValue(iterResult.value, 123);
assert.notSameValue(iterResult, oldIterResult);