Commit be2d4f15 authored by Alex Beregszaszi's avatar Alex Beregszaszi

Compiler: use a single copy of the solc url

parent d18ba015
...@@ -136,14 +136,16 @@ function Compiler (editor, handleGithubCall, outputField, hidingRHP, updateFiles ...@@ -136,14 +136,16 @@ function Compiler (editor, handleGithubCall, outputField, hidingRHP, updateFiles
} }
this.loadVersion = function (usingWorker, version, setVersionText) { this.loadVersion = function (usingWorker, version, setVersionText) {
var url = 'https://ethereum.github.io/solc-bin/bin/' + version;
if (usingWorker) { if (usingWorker) {
loadWorker(version, setVersionText); loadWorker(url, setVersionText);
} else { } else {
loadInternal(version, setVersionText); loadInternal(url, setVersionText);
} }
}; };
function loadInternal (version, setVersionText) { function loadInternal (url, setVersionText) {
Module = null; Module = null;
// Set a safe fallback until the new one is loaded // Set a safe fallback until the new one is loaded
compileJSON = function(source, optimize) { compilationFinished('{}'); }; compileJSON = function(source, optimize) { compilationFinished('{}'); };
...@@ -161,7 +163,7 @@ function Compiler (editor, handleGithubCall, outputField, hidingRHP, updateFiles ...@@ -161,7 +163,7 @@ function Compiler (editor, handleGithubCall, outputField, hidingRHP, updateFiles
}, 200); }, 200);
} }
function loadWorker (version, setVersionText) { function loadWorker (url, setVersionText) {
if (worker !== null) { if (worker !== null) {
worker.terminate(); worker.terminate();
} }
...@@ -183,7 +185,7 @@ function Compiler (editor, handleGithubCall, outputField, hidingRHP, updateFiles ...@@ -183,7 +185,7 @@ function Compiler (editor, handleGithubCall, outputField, hidingRHP, updateFiles
compileJSON = function (source, optimize) { compileJSON = function (source, optimize) {
worker.postMessage({cmd: 'compile', source: source, optimize: optimize}); worker.postMessage({cmd: 'compile', source: source, optimize: optimize});
}; };
worker.postMessage({cmd: 'loadVersion', data: 'https://ethereum.github.io/solc-bin/bin/' + version}); worker.postMessage({cmd: 'loadVersion', data: url});
}; };
function gatherImports (files, importHints, cb) { function gatherImports (files, importHints, cb) {
......
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