Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

Commit

Permalink
Fix loop contructs that got borked by decaffeinate
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonrudolph committed Oct 15, 2017
1 parent 790e202 commit 5937b95
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/project.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ class Project extends Model {
for (let repository of this.repositories.slice()) {
if (repository != null) repository.destroy()
}
for (let watcher = 0; watcher < this.watcherPromisesByPath.length; watcher++) { _ = this.watcherPromisesByPath[watcher]; watcher.dispose() }
for (let path in this.watcherPromisesByPath) {
this.watcherPromisesByPath[path].then(watcher => { watcher.dispose() })
}
this.rootDirectories = []
this.repositories = []
}
Expand Down Expand Up @@ -277,7 +279,9 @@ class Project extends Model {
this.rootDirectories = []
this.repositories = []

for (let watcher = 0; watcher < this.watcherPromisesByPath.length; watcher++) { _ = this.watcherPromisesByPath[watcher]; watcher.then(w => w.dispose()) }
for (let path in this.watcherPromisesByPath) {
this.watcherPromisesByPath[path].then(watcher => { watcher.dispose() })
}
this.watcherPromisesByPath = {}

const missingProjectPaths = []
Expand Down Expand Up @@ -342,10 +346,9 @@ class Project extends Model {
}
})

for (let watcherPromise = 0; watcherPromise < this.watcherPromisesByPath.length; watcherPromise++) {
const root = this.watcherPromisesByPath[watcherPromise]
if (!this.rootDirectories.includes(root)) {
watcherPromise.then(watcher => watcher.dispose())
for (let path in this.watcherPromisesByPath) {
if (!this.rootDirectories.includes(path)) {
this.watcherPromisesByPath[path].then(watcher => { watcher.dispose() })
}
}

Expand Down

0 comments on commit 5937b95

Please sign in to comment.