diff --git a/libs/remix-core-plugin/src/lib/compiler-metadata.ts b/libs/remix-core-plugin/src/lib/compiler-metadata.ts index 3f2e2430bd..e7c5f3eec6 100644 --- a/libs/remix-core-plugin/src/lib/compiler-metadata.ts +++ b/libs/remix-core-plugin/src/lib/compiler-metadata.ts @@ -31,7 +31,7 @@ export class CompilerMetadata extends Plugin { const self = this this.on('solidity', 'compilationFinished', async (file, source, languageVersion, data, input, version) => { if (!await this.call('settings', 'get', 'settings/generate-contract-metadata')) return - const compiler = new CompilerAbstract(languageVersion, data, source) + const compiler = new CompilerAbstract(languageVersion, data, source, input) const path = self._extractPathOf(source.target) await this.setBuildInfo(version, input, data, path) compiler.visitContracts((contract) => { diff --git a/libs/remix-solidity/src/compiler/compiler-abstract.ts b/libs/remix-solidity/src/compiler/compiler-abstract.ts index 81cd33db28..8a7c25f72f 100644 --- a/libs/remix-solidity/src/compiler/compiler-abstract.ts +++ b/libs/remix-solidity/src/compiler/compiler-abstract.ts @@ -5,10 +5,12 @@ export class CompilerAbstract { languageversion: any data: any source: any - constructor (languageversion, data, source) { + input: any + constructor (languageversion, data, source, input?) { this.languageversion = languageversion this.data = data this.source = source // source code + this.input = input // source code } getContracts () { @@ -27,6 +29,10 @@ export class CompilerAbstract { return this.data } + getInput () { + return this.input + } + getAsts () { return this.data.sources // ast } diff --git a/libs/remix-solidity/src/compiler/compiler-helpers.ts b/libs/remix-solidity/src/compiler/compiler-helpers.ts index 8a70e6be4f..ae7af0e0f1 100644 --- a/libs/remix-solidity/src/compiler/compiler-helpers.ts +++ b/libs/remix-solidity/src/compiler/compiler-helpers.ts @@ -12,8 +12,8 @@ export const compile = async (compilationTargets, settings, contentResolverCallb compiler.set('language', settings.language) compiler.set('runs', settings.runs) compiler.loadVersion(canUseWorker(settings.version), urlFromVersion(settings.version)) - compiler.event.register('compilationFinished', (success, compilationData, source) => { - resolve(new CompilerAbstract(settings.version, compilationData, source)) + compiler.event.register('compilationFinished', (success, compilationData, source, input, version) => { + resolve(new CompilerAbstract(settings.version, compilationData, source, input)) }) compiler.event.register('compilerLoaded', _ => compiler.compile(compilationTargets, '')) }) diff --git a/libs/remix-ui/run-tab/src/lib/actions/index.ts b/libs/remix-ui/run-tab/src/lib/actions/index.ts index 18635bb1d7..464a68eed0 100644 --- a/libs/remix-ui/run-tab/src/lib/actions/index.ts +++ b/libs/remix-ui/run-tab/src/lib/actions/index.ts @@ -66,7 +66,7 @@ const setupEvents = () => { plugin.on('manager', 'pluginDeactivated', removePluginProvider.bind(plugin)) - plugin.on('solidity', 'compilationFinished', (file, source, languageVersion, data) => broadcastCompilationResult(file, source, languageVersion, data)) + plugin.on('solidity', 'compilationFinished', (file, source, languageVersion, data, input, version) => broadcastCompilationResult(file, source, languageVersion, data, input)) plugin.on('vyper', 'compilationFinished', (file, source, languageVersion, data) => broadcastCompilationResult(file, source, languageVersion, data)) @@ -301,9 +301,9 @@ export const signMessageWithAddress = (account: string, message: string, modalCo }) } -const broadcastCompilationResult = (file, source, languageVersion, data) => { +const broadcastCompilationResult = (file, source, languageVersion, data, input?) => { // TODO check whether the tab is configured - const compiler = new CompilerAbstract(languageVersion, data, source) + const compiler = new CompilerAbstract(languageVersion, data, source, input) plugin.compilersArtefacts[languageVersion] = compiler plugin.compilersArtefacts.__last = compiler