Skip to content

Commit

Permalink
Merge pull request #2116 from ethereum/master_li
Browse files Browse the repository at this point in the history
added checks before compilation
  • Loading branch information
yann300 committed Jun 27, 2019
2 parents 1afc556 + 2b84d96 commit 2772c4a
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions src/app/tabs/compileTab/compilerContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class CompilerContainer {

this._view.versionSelector = yo`
<select onchange="${this.onchangeLoadVersion.bind(this)}" class="custom-select" id="versionSelector" disabled>
<option disabled selected>Select new compiler version</option>
<option disabled selected>${this.data.defaultVersion}</option>
</select>`
this._view.languageSelector = yo`
<select onchange="${this.onchangeLanguage.bind(this)}" class="custom-select" id="compilierLanguageSelector" title="Available since v0.5.7">
Expand Down Expand Up @@ -234,22 +234,30 @@ class CompilerContainer {
}

compile (event) {
this.compileTabLogic.runCompiler()
if (this.config.get('currentFile')) {
this.compileTabLogic.runCompiler()
}
}

compileIfAutoCompileOn () {
if (this.config.get('autoCompile')) {
this.compile()
}
}

hideWarnings (event) {
this.config.set('hideWarnings', this._view.hideWarningsBox.checked)
this.compile()
this.compileIfAutoCompileOn()
}

onchangeOptimize () {
this.compileTabLogic.setOptimize(!!this._view.optimize.checked)
this.compileTabLogic.runCompiler()
this.compileIfAutoCompileOn()
}

onchangeLanguage (event) {
this.compileTabLogic.setLanguage(event.target.value)
this.compile()
this.compileIfAutoCompileOn()
}

onchangeEvmVersion (_) {
Expand All @@ -259,7 +267,7 @@ class CompilerContainer {
v = null
}
this.compileTabLogic.setEvmVersion(v)
this.compile()
this.compileIfAutoCompileOn()
}

onchangeLoadVersion (event) {
Expand Down Expand Up @@ -343,7 +351,7 @@ class CompilerContainer {
scheduleCompilation () {
if (!this.config.get('autoCompile')) return
if (this.data.compileTimeout) window.clearTimeout(this.data.compileTimeout)
this.data.compileTimeout = window.setTimeout(() => this.compileTabLogic.runCompiler(), this.data.timeout)
this.data.compileTimeout = window.setTimeout(() => this.compileIfAutoCompileOn(), this.data.timeout)
}

}
Expand Down

0 comments on commit 2772c4a

Please sign in to comment.