-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Use specified solc version range to determine which solc to download #1480
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Just a couple thoughts
if (satisfyingVersions.length > 0) { | ||
return satisfyingVersions.reduce((newestVersion, version) => { | ||
if (semver.gtr(version, newestVersion)) return version; | ||
}, "0.0.0"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice reduce
solcVersion => { | ||
if (semver.satisfies(solcVersion, version)) return solcVersion; | ||
} | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can use const
instead of let
here if you just tack the filter onto the end... can even get rid of the extra if
in the filter
); | |
).filter(v => v); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh that is a nice, concise solution.
if (semver.satisfies(solcVersion, version)) return solcVersion; | ||
} | ||
); | ||
satisfyingVersions = satisfyingVersions.filter(solcVersion => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
satisfyingVersions = satisfyingVersions.filter(solcVersion => { |
} | ||
); | ||
satisfyingVersions = satisfyingVersions.filter(solcVersion => { | ||
if (solcVersion) return solcVersion; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (solcVersion) return solcVersion; |
); | ||
satisfyingVersions = satisfyingVersions.filter(solcVersion => { | ||
if (solcVersion) return solcVersion; | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I wish I could do a multi-line suggestion)
.catch(err => { | ||
spinner.stop(); | ||
throw self.errors("noRequest", url, err); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wanna make this await
-y?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes
Update the compilerSupplier to support version constraints.