Skip to content

Commit db6794a

Browse files
committed
Minor cleanup
1 parent 560cffd commit db6794a

2 files changed

Lines changed: 14 additions & 14 deletions

File tree

src/harness/collections.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ namespace collections {
5353
}
5454

5555
/**
56-
* A collection of key/value pairs sorted by key.
56+
* A collection of key/value pairs internally sorted by key.
5757
*/
58-
export class SortedCollection<K, V> {
58+
export class KeyedCollection<K, V> {
5959
private _comparer: (a: K, b: K) => number;
6060
private _keys: K[] = [];
6161
private _values: V[] = [];

src/harness/vfs.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
/// <reference path="../compiler/commandLineParser.ts"/>
66
namespace vfs {
77
import compareStrings = collections.compareStrings;
8-
import SortedCollection = collections.SortedCollection;
8+
import KeyedCollection = collections.KeyedCollection;
99
import Metadata = collections.Metadata;
1010
import EventEmitter = events.EventEmitter;
1111
import IO = Harness.IO;
@@ -123,8 +123,8 @@ namespace vfs {
123123
private _currentDirectory: string;
124124
private _currentDirectoryStack: string[] | undefined;
125125
private _shadowRoot: VirtualFileSystem | undefined;
126-
private _watchedFiles: SortedCollection<string, FileWatcherEntry[]> | undefined;
127-
private _watchedDirectories: SortedCollection<string, DirectoryWatcherEntryArray> | undefined;
126+
private _watchedFiles: KeyedCollection<string, FileWatcherEntry[]> | undefined;
127+
private _watchedDirectories: KeyedCollection<string, DirectoryWatcherEntryArray> | undefined;
128128
private _onRootFileSystemChange: (path: string, change: FileSystemChange) => void;
129129

130130
constructor(currentDirectory: string, useCaseSensitiveFileNames: boolean) {
@@ -410,7 +410,7 @@ namespace vfs {
410410
public watchFile(path: string, watcher: (path: string, change: FileSystemChange) => void): ts.FileWatcher {
411411
if (!this._watchedFiles) {
412412
const pathComparer = this.useCaseSensitiveFileNames ? vpath.compare.caseSensitive : vpath.compare.caseInsensitive;
413-
this._watchedFiles = new SortedCollection<string, FileWatcherEntry[]>(pathComparer);
413+
this._watchedFiles = new KeyedCollection<string, FileWatcherEntry[]>(pathComparer);
414414
}
415415

416416
path = vpath.resolve(this.currentDirectory, path);
@@ -439,7 +439,7 @@ namespace vfs {
439439
public watchDirectory(path: string, watcher: (path: string) => void, recursive?: boolean) {
440440
if (!this._watchedDirectories) {
441441
const pathComparer = this.useCaseSensitiveFileNames ? vpath.compare.caseSensitive : vpath.compare.caseInsensitive;
442-
this._watchedDirectories = new SortedCollection<string, DirectoryWatcherEntryArray>(pathComparer);
442+
this._watchedDirectories = new KeyedCollection<string, DirectoryWatcherEntryArray>(pathComparer);
443443
}
444444

445445
path = vpath.resolve(this.currentDirectory, path);
@@ -641,7 +641,7 @@ namespace vfs {
641641
export class VirtualDirectory extends VirtualFileSystemEntry {
642642
protected _shadowRoot: VirtualDirectory | undefined;
643643
private _parent: VirtualDirectory;
644-
private _entries: SortedCollection<string, VirtualEntry> | undefined;
644+
private _entries: KeyedCollection<string, VirtualEntry> | undefined;
645645
private _resolver: FileSystemResolver | undefined;
646646
private _onChildFileSystemChange: (path: string, change: FileSystemChange) => void;
647647

@@ -907,7 +907,7 @@ namespace vfs {
907907

908908
protected getOwnEntries() {
909909
if (!this._entries) {
910-
const entries = new SortedCollection<string, VirtualEntry>(this.fileSystem.stringComparer);
910+
const entries = new KeyedCollection<string, VirtualEntry>(this.fileSystem.stringComparer);
911911
const resolver = this._resolver;
912912
const shadowRoot = this._shadowRoot;
913913
if (resolver) {
@@ -1053,16 +1053,16 @@ namespace vfs {
10531053
export class VirtualDirectorySymlink extends VirtualDirectory {
10541054
private _targetPath: string;
10551055
private _target: VirtualDirectory | undefined;
1056-
private _views: SortedCollection<string, VirtualEntryView> | undefined;
1057-
private _allViews: SortedCollection<string, VirtualEntryView> | undefined;
1056+
private _views: KeyedCollection<string, VirtualEntryView> | undefined;
1057+
private _allViews: KeyedCollection<string, VirtualEntryView> | undefined;
10581058
private _onTargetParentChildRemoved: (entry: VirtualEntry) => void;
10591059
private _onTargetChildRemoved: (entry: VirtualEntry) => void;
10601060
private _onTargetChildAdded: (entry: VirtualEntry) => void;
10611061
private _onTargetFileSystemChange: (path: string, change: FileSystemChange) => void;
10621062

10631063
constructor(parent: VirtualDirectory, name: string, target: string) {
10641064
super(parent, name);
1065-
this._views = new SortedCollection<string, VirtualEntryView>(this.fileSystem.stringComparer);
1065+
this._views = new KeyedCollection<string, VirtualEntryView>(this.fileSystem.stringComparer);
10661066
this._targetPath = target;
10671067
this._onTargetParentChildRemoved = entry => this.onTargetParentChildRemoved(entry);
10681068
this._onTargetChildAdded = entry => this.onTargetChildAdded(entry);
@@ -1142,9 +1142,9 @@ namespace vfs {
11421142
return target && target.removeFile(name) || false;
11431143
}
11441144

1145-
protected getOwnEntries(): SortedCollection<string, VirtualEntryView> {
1145+
protected getOwnEntries(): KeyedCollection<string, VirtualEntryView> {
11461146
if (!this._allViews) {
1147-
this._allViews = new SortedCollection<string, VirtualEntryView>(this.fileSystem.stringComparer);
1147+
this._allViews = new KeyedCollection<string, VirtualEntryView>(this.fileSystem.stringComparer);
11481148
const target = this.target;
11491149
if (target) {
11501150
for (const entry of target.getEntries()) {

0 commit comments

Comments
 (0)