CompilerAbstract updated

pull/2112/head
aniket-engg 3 years ago committed by Aniket
parent f20c384d86
commit bb251e9f9d
  1. 2
      libs/remix-core-plugin/src/lib/compiler-metadata.ts
  2. 8
      libs/remix-solidity/src/compiler/compiler-abstract.ts
  3. 4
      libs/remix-solidity/src/compiler/compiler-helpers.ts
  4. 6
      libs/remix-ui/run-tab/src/lib/actions/index.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) => {

@ -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
}

@ -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, ''))
})

@ -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

Loading…
Cancel
Save