Skip to content

Commit 6f959ae

Browse files
committed
Iterator.concat no longer reuses IteratorResult object of concatenated iterators
tc39/proposal-iterator-sequencing#26
1 parent f9f15c2 commit 6f959ae

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
## Changelog
22
##### Unreleased
3-
- `clamp` no longer throws an error on `NaN` as `min` or `max`, following [proposal-math-clamp#d2387791c265edf66fbe2455eab919016717ce6f](https://github.com/tc39/proposal-math-clamp/commit/d2387791c265edf66fbe2455eab919016717ce6f)
4-
- Use `Get` in `Iterator.zipKeyed`, following [proposal-joint-iteration#43](https://github.com/tc39/proposal-joint-iteration/pull/43)
3+
- `clamp` no longer throws an error on `NaN` as `min` or `max`, following [tc39/proposal-math-clamp#d2387791c265edf66fbe2455eab919016717ce6f](https://github.com/tc39/proposal-math-clamp/commit/d2387791c265edf66fbe2455eab919016717ce6f)
4+
- `Iterator.concat` no longer reuses `IteratorResult` object of concatenated iterators, following [tc39/proposal-iterator-sequencing#26](https://github.com/tc39/proposal-iterator-sequencing/pull/26)
5+
- Use `Get` in `Iterator.zipKeyed`, following [tc39/proposal-joint-iteration#43](https://github.com/tc39/proposal-joint-iteration/pull/43)
56
- Fixed [several V8 bugs](https://github.com/zloirock/core-js/issues/1439) in `Uint8Array.fromHex` and `Uint8Array.prototype.{ setFromBase64, toBase64, toHex }`, thanks [**@brc-dd**](https://github.com/brc-dd)
67
- Fixed some cases of `Set.prototype.{ symmetricDifference, union }` detection
78
- Added missing dependencies to some entries of static `Iterator` methods

packages/core-js/modules/esnext.iterator.concat.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ var aCallable = require('../internals/a-callable');
55
var anObject = require('../internals/an-object');
66
var getIteratorMethod = require('../internals/get-iterator-method');
77
var createIteratorProxy = require('../internals/iterator-create-proxy');
8-
var createIterResultObject = require('../internals/create-iter-result-object');
98

109
var $Array = Array;
1110

@@ -17,7 +16,7 @@ var IteratorProxy = createIteratorProxy(function () {
1716
var iterables = this.iterables;
1817
if (iterableIndex >= iterables.length) {
1918
this.done = true;
20-
return createIterResultObject(undefined, true);
19+
return;
2120
}
2221
var entry = iterables[iterableIndex];
2322
this.iterables[iterableIndex] = null;
@@ -30,9 +29,9 @@ var IteratorProxy = createIteratorProxy(function () {
3029
this.next = null;
3130
continue;
3231
}
33-
return result;
32+
return result.value;
3433
}
35-
}, false, true);
34+
});
3635

3736
// `Iterator.concat` method
3837
// https://github.com/tc39/proposal-iterator-sequencing

tests/unit-global/esnext.iterator.concat.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ QUnit.test('Iterator.concat', assert => {
8181
const iterResult = iterator.next();
8282
assert.same(iterResult.done, false);
8383
assert.same(iterResult.value, 123);
84-
assert.same(iterResult, oldIterResult);
84+
// https://github.com/tc39/proposal-iterator-sequencing/pull/26
85+
assert.notSame(iterResult, oldIterResult);
8586

8687
assert.throws(() => concat(createIterator([1, 2, 3])), TypeError, 'non-iterable iterator #1');
8788
assert.throws(() => concat([], createIterator([1, 2, 3])), TypeError, 'non-iterable iterator #2');

tests/unit-pure/esnext.iterator.concat.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ QUnit.test('Iterator.concat', assert => {
8080
const iterResult = iterator.next();
8181
assert.same(iterResult.done, false);
8282
assert.same(iterResult.value, 123);
83-
assert.same(iterResult, oldIterResult);
83+
// https://github.com/tc39/proposal-iterator-sequencing/pull/26
84+
assert.notSame(iterResult, oldIterResult);
8485

8586
assert.throws(() => concat(createIterator([1, 2, 3])), TypeError, 'non-iterable iterator #1');
8687
assert.throws(() => concat([], createIterator([1, 2, 3])), TypeError, 'non-iterable iterator #2');

0 commit comments

Comments
 (0)