From bcf5047e44649a95a482e75c667b1ad6a8bbfa16 Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 17 Jun 2019 10:10:53 +0200 Subject: [PATCH] set language for solidity compiler --- remix-solidity/src/compiler/compiler-input.js | 3 +++ remix-solidity/src/compiler/compiler.js | 10 ++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/remix-solidity/src/compiler/compiler-input.js b/remix-solidity/src/compiler/compiler-input.js index 6060e4a70e..6911617861 100644 --- a/remix-solidity/src/compiler/compiler-input.js +++ b/remix-solidity/src/compiler/compiler-input.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) } diff --git a/remix-solidity/src/compiler/compiler.js b/remix-solidity/src/compiler/compiler.js index f8ffc1e7f7..7876480383 100644 --- a/remix-solidity/src/compiler/compiler.js +++ b/remix-solidity/src/compiler/compiler.js @@ -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}) }