Merge pull request #1217 from ethereum/setLanguage

Set language for solidity compiler
pull/7/head
yann300 5 years ago committed by GitHub
commit cece68833e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  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) {
o.settings.evmVersion = opts.evmVersion
}
if (opts.language) {
o.language = opts.language
}
return JSON.stringify(o)
}

@ -29,6 +29,8 @@ function Compiler (handleImportCall) {
var evmVersion = null
var language = 'Solidity'
this.setOptimize = function (_optimize) {
optimize = _optimize
}
@ -37,6 +39,10 @@ function Compiler (handleImportCall) {
evmVersion = _evmVersion
}
this.setLanguage = function (_language) {
language = _language
}
var compilationStartTime = null
this.event.register('compilationFinished', (success, data, source) => {
if (success && compilationStartTime) {
@ -94,7 +100,7 @@ function Compiler (handleImportCall) {
var result
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 = JSON.parse(result)
} catch (exception) {
@ -301,7 +307,7 @@ function Compiler (handleImportCall) {
compileJSON = function (source) {
jobs.push({sources: source})
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})
}

Loading…
Cancel
Save