set language for solidity compiler

pull/5370/head
yann300 6 years ago
parent 4ee057bae0
commit fb905dc00f
  1. 3
      remix-solidity/src/compiler/compiler-input.js
  2. 10
      remix-solidity/src/compiler/compiler.js

@ -21,5 +21,8 @@ module.exports = (sources, opts) => {
if (opts.evmVersion) { if (opts.evmVersion) {
o.settings.evmVersion = opts.evmVersion o.settings.evmVersion = opts.evmVersion
} }
if (opts.language) {
o.language = opts.language
}
return JSON.stringify(o) return JSON.stringify(o)
} }

@ -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})
} }

Loading…
Cancel
Save