Compare commits

..

No commits in common. "c1c66a473b6be0e99ce899d64ee5bc63f8f22eba" and "018a0091f382e0baac7aef43b6501f4357075fa8" have entirely different histories.

View File

@ -54,22 +54,19 @@ export abstract class PhasePriorityQueue {
* @todo Remove this eventually once the patchwork bug this is used for is fixed
*/
public tryRemovePhase(phaseFilter: (phase: Phase) => boolean, removeCount: number | "all" = 1): number {
if (removeCount === "all") {
removeCount = Number.MAX_SAFE_INTEGER;
} else if (removeCount < 1) {
return 0;
if (typeof removeCount === "string") {
removeCount = Number.MAX_SAFE_INTEGER; // For the lulz
}
let numRemoved = 0;
let phaseIndex = this.queue.findIndex(phaseFilter);
if (phaseIndex === -1) {
return 0;
}
while (numRemoved < removeCount && phaseIndex !== -1) {
do {
this.queue.splice(phaseIndex, 1);
numRemoved++;
phaseIndex = this.queue.findIndex(phaseFilter);
}
return numRemoved;
} while (numRemoved < removeCount || (phaseIndex = this.queue.findIndex(phaseFilter)) !== -1);
return removeCount;
}
}