From db6794a4f4e78d2ee45eab0ac76700814920a920 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Thu, 19 Oct 2017 18:06:48 -0700 Subject: [PATCH] Minor cleanup --- src/harness/collections.ts | 4 ++-- src/harness/vfs.ts | 24 ++++++++++++------------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/harness/collections.ts b/src/harness/collections.ts index 7d661cdeacc..8bdbb453c98 100644 --- a/src/harness/collections.ts +++ b/src/harness/collections.ts @@ -53,9 +53,9 @@ namespace collections { } /** - * A collection of key/value pairs sorted by key. + * A collection of key/value pairs internally sorted by key. */ - export class SortedCollection { + export class KeyedCollection { private _comparer: (a: K, b: K) => number; private _keys: K[] = []; private _values: V[] = []; diff --git a/src/harness/vfs.ts b/src/harness/vfs.ts index 6f32477d60f..dbdb685d1af 100644 --- a/src/harness/vfs.ts +++ b/src/harness/vfs.ts @@ -5,7 +5,7 @@ /// namespace vfs { import compareStrings = collections.compareStrings; - import SortedCollection = collections.SortedCollection; + import KeyedCollection = collections.KeyedCollection; import Metadata = collections.Metadata; import EventEmitter = events.EventEmitter; import IO = Harness.IO; @@ -123,8 +123,8 @@ namespace vfs { private _currentDirectory: string; private _currentDirectoryStack: string[] | undefined; private _shadowRoot: VirtualFileSystem | undefined; - private _watchedFiles: SortedCollection | undefined; - private _watchedDirectories: SortedCollection | undefined; + private _watchedFiles: KeyedCollection | undefined; + private _watchedDirectories: KeyedCollection | undefined; private _onRootFileSystemChange: (path: string, change: FileSystemChange) => void; constructor(currentDirectory: string, useCaseSensitiveFileNames: boolean) { @@ -410,7 +410,7 @@ namespace vfs { public watchFile(path: string, watcher: (path: string, change: FileSystemChange) => void): ts.FileWatcher { if (!this._watchedFiles) { const pathComparer = this.useCaseSensitiveFileNames ? vpath.compare.caseSensitive : vpath.compare.caseInsensitive; - this._watchedFiles = new SortedCollection(pathComparer); + this._watchedFiles = new KeyedCollection(pathComparer); } path = vpath.resolve(this.currentDirectory, path); @@ -439,7 +439,7 @@ namespace vfs { public watchDirectory(path: string, watcher: (path: string) => void, recursive?: boolean) { if (!this._watchedDirectories) { const pathComparer = this.useCaseSensitiveFileNames ? vpath.compare.caseSensitive : vpath.compare.caseInsensitive; - this._watchedDirectories = new SortedCollection(pathComparer); + this._watchedDirectories = new KeyedCollection(pathComparer); } path = vpath.resolve(this.currentDirectory, path); @@ -641,7 +641,7 @@ namespace vfs { export class VirtualDirectory extends VirtualFileSystemEntry { protected _shadowRoot: VirtualDirectory | undefined; private _parent: VirtualDirectory; - private _entries: SortedCollection | undefined; + private _entries: KeyedCollection | undefined; private _resolver: FileSystemResolver | undefined; private _onChildFileSystemChange: (path: string, change: FileSystemChange) => void; @@ -907,7 +907,7 @@ namespace vfs { protected getOwnEntries() { if (!this._entries) { - const entries = new SortedCollection(this.fileSystem.stringComparer); + const entries = new KeyedCollection(this.fileSystem.stringComparer); const resolver = this._resolver; const shadowRoot = this._shadowRoot; if (resolver) { @@ -1053,8 +1053,8 @@ namespace vfs { export class VirtualDirectorySymlink extends VirtualDirectory { private _targetPath: string; private _target: VirtualDirectory | undefined; - private _views: SortedCollection | undefined; - private _allViews: SortedCollection | undefined; + private _views: KeyedCollection | undefined; + private _allViews: KeyedCollection | undefined; private _onTargetParentChildRemoved: (entry: VirtualEntry) => void; private _onTargetChildRemoved: (entry: VirtualEntry) => void; private _onTargetChildAdded: (entry: VirtualEntry) => void; @@ -1062,7 +1062,7 @@ namespace vfs { constructor(parent: VirtualDirectory, name: string, target: string) { super(parent, name); - this._views = new SortedCollection(this.fileSystem.stringComparer); + this._views = new KeyedCollection(this.fileSystem.stringComparer); this._targetPath = target; this._onTargetParentChildRemoved = entry => this.onTargetParentChildRemoved(entry); this._onTargetChildAdded = entry => this.onTargetChildAdded(entry); @@ -1142,9 +1142,9 @@ namespace vfs { return target && target.removeFile(name) || false; } - protected getOwnEntries(): SortedCollection { + protected getOwnEntries(): KeyedCollection { if (!this._allViews) { - this._allViews = new SortedCollection(this.fileSystem.stringComparer); + this._allViews = new KeyedCollection(this.fileSystem.stringComparer); const target = this.target; if (target) { for (const entry of target.getEntries()) {