mirror of https://github.com/webpack/webpack.git
Refactor Queue class: remove unnecessary iterator property, streamline dequeue method
This commit is contained in:
parent
96c543c0a9
commit
affadffeec
|
@ -18,11 +18,6 @@ class Queue {
|
|||
* @type {Set<T>}
|
||||
*/
|
||||
this._set = new Set(items);
|
||||
/**
|
||||
* @private
|
||||
* @type {Iterator<T>}
|
||||
*/
|
||||
this._iterator = this._set[Symbol.iterator]();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -47,7 +42,7 @@ class Queue {
|
|||
* @returns {T | undefined} The head of the queue of `undefined` if this queue is empty.
|
||||
*/
|
||||
dequeue() {
|
||||
const result = this._iterator.next();
|
||||
const result = this._set[Symbol.iterator]().next();
|
||||
if (result.done) return;
|
||||
this._set.delete(result.value);
|
||||
return result.value;
|
||||
|
|
Loading…
Reference in New Issue