From 0d53c00fc7a20a688fff42b6c00c6b59a3643c00 Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 7 Sep 2021 15:59:52 +0200 Subject: [PATCH] fix compileWithParameters --- apps/remix-ide/src/app/tabs/compile-tab.js | 4 ---- apps/solidity-compiler/src/app/compiler-api.ts | 17 +++++++---------- .../src/compiler/compiler-utils.ts | 3 ++- 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/apps/remix-ide/src/app/tabs/compile-tab.js b/apps/remix-ide/src/app/tabs/compile-tab.js index 159709c3cd..4441993d34 100644 --- a/apps/remix-ide/src/app/tabs/compile-tab.js +++ b/apps/remix-ide/src/app/tabs/compile-tab.js @@ -56,10 +56,6 @@ class CompileTab extends CompilerApiMixin(ViewPlugin) { // implements ICompilerA this.renderComponent() } - setSelectedVersion (version) { - this.selectedVersion = version - } - onSetWorkspace () { this.renderComponent() } diff --git a/apps/solidity-compiler/src/app/compiler-api.ts b/apps/solidity-compiler/src/app/compiler-api.ts index c001df228e..502ec33ac4 100644 --- a/apps/solidity-compiler/src/app/compiler-api.ts +++ b/apps/solidity-compiler/src/app/compiler-api.ts @@ -41,7 +41,6 @@ export const CompilerApiMixin = (Base) => class extends Base { this.compileErrors = {} this.compiledFileName = '' - this.selectedVersion = '' this.currentFile = '' } @@ -63,10 +62,6 @@ export const CompilerApiMixin = (Base) => class extends Base { return this.call('terminal', 'log', content) } - setSelectedVersion (version) { - this.selectedVersion = version - } - getCompilationResult () { return this.compileTabLogic.compiler.state.lastCompilationResult } @@ -99,18 +94,20 @@ export const CompilerApiMixin = (Base) => class extends Base { * @param {object} settings {evmVersion, optimize, runs, version, language} */ async compileWithParameters (compilationTargets, settings) { - settings.version = settings.version || this.selectedVersion + const compilerState = this.getCompilerState() + settings.version = settings.version || compilerState.currentVersion const res = await compile(compilationTargets, settings, (url, cb) => this.call('contentImport', 'resolveAndSave', url).then((result) => cb(null, result)).catch((error) => cb(error.message))) return res } // This function is used for passing the compiler configuration to 'remix-tests' getCurrentCompilerConfig () { + const compilerState = this.getCompilerState() return { - currentVersion: this.selectedVersion, - evmVersion: this.compileTabLogic.evmVersion, - optimize: this.compileTabLogic.optimize, - runs: this.compileTabLogic.runs + currentVersion: compilerState.currentVersion, + evmVersion: compilerState.evmVersion, + optimize: compilerState.optimize, + runs: compilerState.runs } } diff --git a/libs/remix-solidity/src/compiler/compiler-utils.ts b/libs/remix-solidity/src/compiler/compiler-utils.ts index 7e19ae7d8a..ef205c3ca8 100644 --- a/libs/remix-solidity/src/compiler/compiler-utils.ts +++ b/libs/remix-solidity/src/compiler/compiler-utils.ts @@ -12,7 +12,7 @@ export const pathToURL = {} * @param version is the version of compiler with or without 'soljson-v' prefix and .js postfix */ export function urlFromVersion (version) { - let url + let url if (version === 'builtin') { let location: string | Location = window.document.location let path = location.pathname @@ -22,6 +22,7 @@ export function urlFromVersion (version) { if (!location.endsWith('/')) location += '/' url = `${location}soljson.js` } else { + version = version.replace('.Emscripten.clang', '') if (!version.startsWith('soljson-v')) version = 'soljson-v' + version if (!version.endsWith('.js')) version = version + '.js' url = `${pathToURL[version]}/${version}`