Skip to content

Commit e3a1a98

Browse files
author
Andy Hanson
committed
Remove last external use of unorderedRemoveFirstItemWhere
1 parent d6aa65d commit e3a1a98

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/compiler/core.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1415,7 +1415,7 @@ namespace ts {
14151415
}
14161416

14171417
/** Remove the *first* element satisfying `predicate`. */
1418-
export function unorderedRemoveFirstItemWhere<T>(array: T[], predicate: (element: T) => boolean): void {
1418+
function unorderedRemoveFirstItemWhere<T>(array: T[], predicate: (element: T) => boolean): void {
14191419
for (let i = 0; i < array.length; i++) {
14201420
if (predicate(array[i])) {
14211421
unorderedRemoveItemAt(array, i);

src/harness/unittests/tsserverProjectSystem.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,12 +209,13 @@ namespace ts {
209209
watchDirectory(directoryName: string, callback: DirectoryWatcherCallback, recursive: boolean): DirectoryWatcher {
210210
const path = this.toPath(directoryName);
211211
const callbacks = lookUp(this.watchedDirectories, path) || (this.watchedDirectories[path] = []);
212-
callbacks.push({ cb: callback, recursive });
212+
const cbWithRecursive = { cb: callback, recursive };
213+
callbacks.push(cbWithRecursive);
213214
return {
214215
referenceCount: 0,
215216
directoryName,
216217
close: () => {
217-
unorderedRemoveFirstItemWhere(callbacks, cb => cb.cb === callback);
218+
unorderedRemoveItem(cbWithRecursive, callbacks);
218219
if (!callbacks.length) {
219220
delete this.watchedDirectories[path];
220221
}

0 commit comments

Comments
 (0)