Skip to content
This repository was archived by the owner on Aug 1, 2024. It is now read-only.

Commit 8c9bb5d

Browse files
12wrigjacopybara-github
authored andcommitted
Clean up references to nextValueOrThrow and StopIteration from the ES4 Iteration protocol.
RELNOTES: n/a PiperOrigin-RevId: 436486224 Change-Id: I8c3bac4ed17277a6ddead69b91d87309e6904d76
1 parent 605aa47 commit 8c9bb5d

16 files changed

+24
-893
lines changed

closure/goog/date/daterange.js

-11
Original file line numberDiff line numberDiff line change
@@ -423,14 +423,3 @@ goog.date.DateRange.Iterator.prototype.next = function() {
423423
this.nextDate_.add(new goog.date.Interval(goog.date.Interval.DAYS, 1));
424424
return goog.iter.createEs6IteratorYield(rv);
425425
};
426-
427-
428-
/**
429-
* TODO(user): Please do not remove - this will be cleaned up centrally.
430-
* @override @see {!goog.iter.Iterator}
431-
* @return {!goog.date.Date}
432-
*/
433-
goog.date.DateRange.Iterator.prototype.nextValueOrThrow = function() {
434-
return goog.iter.toEs4IteratorNext(
435-
goog.date.DateRange.Iterator.prototype.next.call(this));
436-
};

closure/goog/dom/controlrange.js

-12
Original file line numberDiff line numberDiff line change
@@ -522,18 +522,6 @@ goog.dom.ControlRangeIterator.prototype.next = function() {
522522
};
523523

524524

525-
/**
526-
* TODO(user): Please do not remove - this will be cleaned up centrally.
527-
* @override @see {!goog.iter.Iterator}
528-
* @return {!Node}
529-
*/
530-
goog.dom.ControlRangeIterator.prototype.nextValueOrThrow = function() {
531-
return goog.iter.toEs4IteratorNext(
532-
goog.dom.ControlRangeIterator.prototype.next.call(this));
533-
};
534-
535-
536-
537525
/** @override */
538526
goog.dom.ControlRangeIterator.prototype.copyFrom = function(other) {
539527
'use strict';

closure/goog/dom/iter.js

+1-24
Original file line numberDiff line numberDiff line change
@@ -66,18 +66,6 @@ goog.dom.iter.SiblingIterator.prototype.next = function() {
6666
};
6767

6868

69-
/**
70-
* TODO(user): Please do not remove - this will be cleaned up centrally.
71-
* @override @see {!goog.iter.Iterator}
72-
* @return {!Node}
73-
*/
74-
goog.dom.iter.SiblingIterator.prototype.nextValueOrThrow = function() {
75-
return goog.iter.toEs4IteratorNext(
76-
goog.dom.iter.SiblingIterator.prototype.next.call(this));
77-
};
78-
79-
80-
8169
/**
8270
* Iterator over an Element's children.
8371
* @param {Element} element The element to iterate over.
@@ -139,15 +127,4 @@ goog.dom.iter.AncestorIterator.prototype.next = function() {
139127
}
140128
this.node_ = node.parentNode;
141129
return goog.iter.createEs6IteratorYield(node);
142-
};
143-
144-
145-
/**
146-
* TODO(user): Please do not remove - this will be cleaned up centrally.
147-
* @override @see {!goog.iter.Iterator}
148-
* @return {!Node}
149-
*/
150-
goog.dom.iter.AncestorIterator.prototype.nextValueOrThrow = function() {
151-
return goog.iter.toEs4IteratorNext(
152-
goog.dom.iter.AncestorIterator.prototype.next.call(this));
153-
};
130+
};

closure/goog/dom/multirange.js

-12
Original file line numberDiff line numberDiff line change
@@ -555,18 +555,6 @@ goog.dom.MultiRangeIterator.prototype.next = function() {
555555
};
556556

557557

558-
/**
559-
* TODO(user): Please do not remove - this will be cleaned up centrally.
560-
* @override @see {!goog.iter.Iterator}
561-
* @return {!Node}
562-
*/
563-
goog.dom.MultiRangeIterator.prototype.nextValueOrThrow = function() {
564-
return goog.iter.toEs4IteratorNext(
565-
goog.dom.MultiRangeIterator.prototype.next.call(this));
566-
};
567-
568-
569-
570558
/** @override */
571559
goog.dom.MultiRangeIterator.prototype.copyFrom = function(other) {
572560
'use strict';

closure/goog/dom/nodeiterator.js

-11
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,3 @@ goog.dom.NodeIterator.prototype.next = function() {
7979

8080
return goog.iter.createEs6IteratorYield(/** @type {!Node} */ (this.node));
8181
};
82-
83-
84-
/**
85-
* TODO(user): Please do not remove - this will be cleaned up centrally.
86-
* @override @see {!goog.iter.Iterator}
87-
* @return {!Node}
88-
*/
89-
goog.dom.NodeIterator.prototype.nextValueOrThrow = function() {
90-
return goog.iter.toEs4IteratorNext(
91-
goog.dom.NodeIterator.prototype.next.call(this));
92-
};

closure/goog/dom/tagiterator.js

-12
Original file line numberDiff line numberDiff line change
@@ -285,18 +285,6 @@ goog.dom.TagIterator.prototype.next = function() {
285285
};
286286

287287

288-
/**
289-
* TODO(user): Please do not remove - this will be cleaned up centrally.
290-
* @override @see {!goog.iter.Iterator}
291-
* @return {!Node}
292-
*/
293-
goog.dom.TagIterator.prototype.nextValueOrThrow = function() {
294-
return goog.iter.toEs4IteratorNext(
295-
goog.dom.TagIterator.prototype.next.call(this));
296-
};
297-
298-
299-
300288
/**
301289
* @return {boolean} Whether next has ever been called on this iterator.
302290
* @protected

closure/goog/dom/textrangeiterator.js

+4-15
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,8 @@ goog.dom.TextRangeIterator.prototype.isLast = function() {
196196
};
197197

198198
/**
199-
* Returns true if the iterator is on the last step before StopIteration is
200-
* thrown, otherwise false.
199+
* Returns true if the iterator is on the last step before iteration finishes,
200+
* false otherwise.
201201
* @return {boolean}
202202
* @private
203203
*/
@@ -218,8 +218,8 @@ goog.dom.TextRangeIterator.prototype.isLastTag_ = function() {
218218
};
219219

220220
/**
221-
* Move to the next position in the selection.
222-
* Throws `goog.iter.StopIteration` when it passes the end of the range.
221+
* Move to the next position in the selection. Returns `{done: true}` when it
222+
* passes the end of the range.
223223
* @return {!IIterableResult<!Node>} The node at the next position.
224224
* @override
225225
*/
@@ -234,17 +234,6 @@ goog.dom.TextRangeIterator.prototype.next = function() {
234234
};
235235

236236

237-
/**
238-
* TODO(user): Please do not remove - this will be cleaned up centrally.
239-
* @override @see {!goog.iter.Iterator}
240-
* @return {!Node}
241-
*/
242-
goog.dom.TextRangeIterator.prototype.nextValueOrThrow = function() {
243-
return goog.iter.toEs4IteratorNext(
244-
goog.dom.TextRangeIterator.prototype.next.call(this));
245-
};
246-
247-
248237
/**
249238
* Get the last node the iterator will hit.
250239
* @return {?Node} The last node the iterator will hit.

closure/goog/iter/es6.js

-7
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ goog.module.declareLegacyNamespace();
1313

1414
const GoogIterable = goog.require('goog.iter.Iterable');
1515
const GoogIterator = goog.require('goog.iter.Iterator');
16-
const StopIteration = goog.require('goog.iter.StopIteration');
1716

1817

1918
/**
@@ -121,12 +120,6 @@ class ShimGoogIterator extends GoogIterator {
121120
this.iter_ = iter;
122121
}
123122

124-
/** @override */
125-
nextValueOrThrow() {
126-
const result = this.iter_.next();
127-
if (result.done) throw StopIteration;
128-
return result.value;
129-
}
130123
/**
131124
* @override @see {!goog.iter.Iterator}
132125
* @return {!IIterableResult<VALUE>}

0 commit comments

Comments
 (0)