|
|
@ -29,6 +29,8 @@ function Compiler (handleImportCall) { |
|
|
|
|
|
|
|
|
|
|
|
var evmVersion = null |
|
|
|
var evmVersion = null |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var language = 'Solidity' |
|
|
|
|
|
|
|
|
|
|
|
this.setOptimize = function (_optimize) { |
|
|
|
this.setOptimize = function (_optimize) { |
|
|
|
optimize = _optimize |
|
|
|
optimize = _optimize |
|
|
|
} |
|
|
|
} |
|
|
@ -37,6 +39,10 @@ function Compiler (handleImportCall) { |
|
|
|
evmVersion = _evmVersion |
|
|
|
evmVersion = _evmVersion |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.setLanguage = function (_language) { |
|
|
|
|
|
|
|
language = _language |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var compilationStartTime = null |
|
|
|
var compilationStartTime = null |
|
|
|
this.event.register('compilationFinished', (success, data, source) => { |
|
|
|
this.event.register('compilationFinished', (success, data, source) => { |
|
|
|
if (success && compilationStartTime) { |
|
|
|
if (success && compilationStartTime) { |
|
|
@ -94,7 +100,7 @@ function Compiler (handleImportCall) { |
|
|
|
|
|
|
|
|
|
|
|
var result |
|
|
|
var result |
|
|
|
try { |
|
|
|
try { |
|
|
|
var input = compilerInput(source.sources, {optimize: optimize, evmVersion: evmVersion, target: source.target}) |
|
|
|
var input = compilerInput(source.sources, {optimize: optimize, evmVersion: evmVersion, language: language, target: source.target}) |
|
|
|
result = compiler.compile(input, missingInputsCallback) |
|
|
|
result = compiler.compile(input, missingInputsCallback) |
|
|
|
result = JSON.parse(result) |
|
|
|
result = JSON.parse(result) |
|
|
|
} catch (exception) { |
|
|
|
} catch (exception) { |
|
|
@ -301,7 +307,7 @@ function Compiler (handleImportCall) { |
|
|
|
compileJSON = function (source) { |
|
|
|
compileJSON = function (source) { |
|
|
|
jobs.push({sources: source}) |
|
|
|
jobs.push({sources: source}) |
|
|
|
worker.postMessage({cmd: 'compile', job: jobs.length - 1, input: compilerInput(source.sources, |
|
|
|
worker.postMessage({cmd: 'compile', job: jobs.length - 1, input: compilerInput(source.sources, |
|
|
|
{optimize: optimize, evmVersion: evmVersion, target: source.target})}) |
|
|
|
{optimize: optimize, evmVersion: evmVersion, language: language, target: source.target})}) |
|
|
|
} |
|
|
|
} |
|
|
|
worker.postMessage({cmd: 'loadVersion', data: url}) |
|
|
|
worker.postMessage({cmd: 'loadVersion', data: url}) |
|
|
|
} |
|
|
|
} |
|
|
|