Commit 30243b3a authored by yann300's avatar yann300

refactor to setConfiguration

parent 3115d202
...@@ -246,10 +246,7 @@ class CompileTab extends ViewPlugin { ...@@ -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 { ...@@ -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()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment