refactor to setConfiguration

pull/5370/head
yann300 5 years ago committed by ioedeveloper
parent c2ebfd7404
commit fe589269ec
  1. 5
      apps/remix-ide/src/app/tabs/compile-tab.js
  2. 7
      apps/remix-ide/src/app/tabs/compileTab/compilerContainer.js

@ -246,10 +246,7 @@ class CompileTab extends ViewPlugin {
setCompilerConfig (settings) { setCompilerConfig (settings) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
addTooltip(yo`<div><b>${this.currentRequest.from}</b> is updating the <b>Solidity compiler configuration</b>.<pre class="text-left">${JSON.stringify(settings, null, '\t')}</pre></div>`) addTooltip(yo`<div><b>${this.currentRequest.from}</b> is updating the <b>Solidity compiler configuration</b>.<pre class="text-left">${JSON.stringify(settings, null, '\t')}</pre></div>`)
this.compilerContainer.setLanguage(settings.language) this.compilerContainer.setConfiguration(settings)
this.compilerContainer.setEvmVersion(settings.evmVersion)
this.compilerContainer.setOptimize(settings.optimize)
this.compilerContainer.setVersion(settings.version)
// @todo(#2875) should use loading compiler return value to check whether the compiler is loaded instead of "setInterval" // @todo(#2875) should use loading compiler return value to check whether the compiler is loaded instead of "setInterval"
let timeout = 0 let timeout = 0
const id = setInterval(() => { const id = setInterval(() => {

@ -353,6 +353,13 @@ class CompilerContainer {
They are an external API for modifying the compiler configuration. They are an external API for modifying the compiler configuration.
*/ */
setConfiguration (settings) {
this.setLanguage(settings.language)
this.setEvmVersion(settings.evmVersion)
this.setOptimize(settings.optimize)
this.setVersion(settings.version)
}
setOptimize (enabled) { setOptimize (enabled) {
this._view.optimize.checked = enabled this._view.optimize.checked = enabled
this.onchangeOptimize() this.onchangeOptimize()

Loading…
Cancel
Save