From db949cc58c1f7d01b2422ad670db0314eb07f6b6 Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 23 Feb 2023 12:22:36 +0100 Subject: [PATCH] fix using compiler worker --- apps/remix-ide/src/app/plugins/solidity-script.tsx | 3 +-- libs/remix-solidity/src/compiler/compiler-helpers.ts | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/apps/remix-ide/src/app/plugins/solidity-script.tsx b/apps/remix-ide/src/app/plugins/solidity-script.tsx index 40493a37d8..549fe51d88 100644 --- a/apps/remix-ide/src/app/plugins/solidity-script.tsx +++ b/apps/remix-ide/src/app/plugins/solidity-script.tsx @@ -29,10 +29,9 @@ export class SolidityScript extends Plugin { const targets = { 'script.sol': { content } } // compile - const compiler = await this.call('solidity', 'getCompiler') const compilation = await compile(targets, params, async (url, cb) => { await this.call('contentImport', 'resolveAndSave', url).then((result) => cb(null, result)).catch((error) => cb(error.message)) - }, compiler.state.worker) + }) // get the vm provider const contract = compilation.getContract('SolidityScript') diff --git a/libs/remix-solidity/src/compiler/compiler-helpers.ts b/libs/remix-solidity/src/compiler/compiler-helpers.ts index 6957cc9beb..3097eeab28 100644 --- a/libs/remix-solidity/src/compiler/compiler-helpers.ts +++ b/libs/remix-solidity/src/compiler/compiler-helpers.ts @@ -3,14 +3,14 @@ import { canUseWorker, urlFromVersion } from './compiler-utils' import { CompilerAbstract } from './compiler-abstract' import { Compiler } from './compiler' -export const compile = (compilationTargets, settings, contentResolverCallback, worker?: any): Promise => { +export const compile = (compilationTargets, settings, contentResolverCallback): Promise => { return new Promise((resolve, reject) => { const compiler = new Compiler(contentResolverCallback) compiler.set('evmVersion', settings.evmVersion) compiler.set('optimize', settings.optimize) compiler.set('language', settings.language) compiler.set('runs', settings.runs) - compiler.loadVersion(canUseWorker(settings.version), urlFromVersion(settings.version), worker) + compiler.loadVersion(canUseWorker(settings.version), urlFromVersion(settings.version)) compiler.event.register('compilationFinished', (success, compilationData, source, input, version) => { resolve(new CompilerAbstract(settings.version, compilationData, source, input)) })