remove loadCompiler use compiler directly

pull/3094/head
yann300 7 years ago
parent c8a59e9479
commit 7d9cf4e8dc
  1. 9
      src/app.js
  2. 12
      src/app/tabs/settings-tab.js

@ -767,17 +767,11 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
compiler.setOptimize(optimize) compiler.setOptimize(optimize)
if (runCompilation) runCompiler() if (runCompilation) runCompiler()
}, },
loadCompiler: (usingWorker, url) => {
compiler.loadVersion(usingWorker, url)
},
runCompiler: () => { runCompiler: () => {
runCompiler() runCompiler()
}, },
logMessage: (msg) => { logMessage: (msg) => {
self._components.editorpanel.log({type: 'log', value: msg}) self._components.editorpanel.log({type: 'log', value: msg})
},
getCompilationResult: () => {
return compiler.lastCompilationResult
} }
} }
var rhpEvents = { var rhpEvents = {
@ -789,7 +783,8 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
} }
var rhpOpts = { var rhpOpts = {
pluginAPI: new PluginAPI(self, compiler), pluginAPI: new PluginAPI(self, compiler),
udapp: udapp udapp: udapp,
compiler: compiler
} }
self._components.righthandpanel = new RighthandPanel(rhpAPI, rhpEvents, rhpOpts) self._components.righthandpanel = new RighthandPanel(rhpAPI, rhpEvents, rhpOpts)

@ -178,7 +178,7 @@ function SettingsTab (appAPI = {}, appEvents = {}, opts = {}) {
// load the new version upon change // load the new version upon change
versionSelector.addEventListener('change', function () { versionSelector.addEventListener('change', function () {
loadVersion(versionSelector.value, queryParams, appAPI, el) loadVersion(versionSelector.value, queryParams, opts.compiler, el)
}) })
var header = new Option('Select new compiler version') var header = new Option('Select new compiler version')
@ -195,7 +195,7 @@ function SettingsTab (appAPI = {}, appEvents = {}, opts = {}) {
// loading failed for some reason, fall back to local compiler // loading failed for some reason, fall back to local compiler
versionSelector.append(new Option('latest local version', 'builtin')) versionSelector.append(new Option('latest local version', 'builtin'))
loadVersion('builtin', queryParams, appAPI, el) loadVersion('builtin', queryParams, opts.compiler, el)
return return
} }
@ -217,7 +217,7 @@ function SettingsTab (appAPI = {}, appEvents = {}, opts = {}) {
selectedVersion = queryParams.get().version selectedVersion = queryParams.get().version
} }
loadVersion(selectedVersion, queryParams, appAPI, el) loadVersion(selectedVersion, queryParams, opts.compiler, el)
}) })
return { render () { return el } } return { render () { return el } }
@ -227,7 +227,7 @@ function setVersionText (text, el) {
el.querySelector('#version').innerText = text el.querySelector('#version').innerText = text
} }
function loadVersion (version, queryParams, appAPI, el) { function loadVersion (version, queryParams, compiler, el) {
queryParams.update({ version: version }) queryParams.update({ version: version })
var url var url
if (version === 'builtin') { if (version === 'builtin') {
@ -253,10 +253,10 @@ function loadVersion (version, queryParams, appAPI, el) {
// Workers cannot load js on "file:"-URLs and we get a // Workers cannot load js on "file:"-URLs and we get a
// "Uncaught RangeError: Maximum call stack size exceeded" error on Chromium, // "Uncaught RangeError: Maximum call stack size exceeded" error on Chromium,
// resort to non-worker version in that case. // resort to non-worker version in that case.
appAPI.loadCompiler(true, url) compiler.loadVersion(true, url)
setVersionText('(loading using worker)', el) setVersionText('(loading using worker)', el)
} else { } else {
appAPI.loadCompiler(false, url) compiler.loadVersion(false, url)
setVersionText('(loading)', el) setVersionText('(loading)', el)
} }
} }

Loading…
Cancel
Save