Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Merge pull request #2398 from ethereum/compiler_from_pragma" #2442

Merged
merged 1 commit into from
Nov 15, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions src/app/tabs/compileTab/compilerContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ class CompilerContainer {
* Update the compilation button with the name of the current file
*/
set currentFile (name = '') {
if (name && name !== '') {
this._setCompilerVersionFromPragma(name)
}
if (!this._view.compilationButton) return
const button = this.compilationButton(name.split('/').pop())
yo.update(this._view.compilationButton, button)
Expand Down Expand Up @@ -116,23 +113,6 @@ class CompilerContainer {
return el
}

_setCompilerVersionFromPragma (filename) {
this.compileTabLogic.fileManager.getFile(filename).then(data => {
const pragmaArr = data.match(/(pragma solidity (.+?);)/g)
if (pragmaArr && pragmaArr.length === 1) {
const pragmaStr = pragmaArr[0].replace('pragma solidity', '').trim()
const pragma = pragmaStr.substring(0, pragmaStr.length - 1)
const fixedVersions = this.data.allversions.filter(obj => !obj.prerelease).map(obj => obj.version)
const compilerToLoad = semver.maxSatisfying(fixedVersions, pragma)
const compilerPath = this.data.allversions.filter(obj => !obj.prerelease && obj.version === compilerToLoad)[0].path
if (this.data.selectedVersion !== compilerPath) {
this.data.selectedVersion = compilerPath
this._updateVersionSelector()
}
}
})
}

_retrieveVersion () {
let version = this._view.versionSelector.value
return version.substring(9, version.length)
Expand Down Expand Up @@ -263,9 +243,6 @@ class CompilerContainer {

compile (event) {
if (this.config.get('currentFile')) {
if (!this.data.selectedVersion.includes('nightly')) {
this._setCompilerVersionFromPragma(this.config.get('currentFile'))
}
this.compileTabLogic.runCompiler()
}
}
Expand Down