update compilationFinished

pull/2112/head
aniket-engg 3 years ago committed by Aniket
parent bb251e9f9d
commit abbb4a1d4e
  1. 4
      apps/remix-ide/src/app/tabs/test-tab.js
  2. 14
      libs/remix-core-plugin/src/lib/compiler-artefacts.ts
  3. 2
      libs/remix-core-plugin/src/lib/editor-context-listener.ts
  4. 2
      libs/remix-core-plugin/src/lib/offset-line-to-column-converter.ts
  5. 2
      libs/remix-debug/src/source/offsetToLineColumnConverter.ts
  6. 7
      libs/remix-solidity/src/compiler/compiler.ts
  7. 6
      libs/remix-tests/src/compiler.ts
  8. 4
      libs/remix-ui/solidity-compiler/src/lib/actions/compiler.ts
  9. 4
      libs/remix-ui/static-analyser/src/lib/actions/staticAnalysisActions.ts
  10. 4
      libs/remix-ui/static-analyser/src/lib/reducers/staticAnalysisReducer.ts

@ -89,12 +89,12 @@ module.exports = class TestTab extends ViewPlugin {
this.createTestLibs()
})
this.testRunner.event.on('compilationFinished', (success, data, source) => {
this.testRunner.event.on('compilationFinished', (success, data, source, input, version) => {
if (success) {
this.allFilesInvolved.push(...Object.keys(data.sources))
// forwarding the event to the appManager infra
// This is listened by compilerArtefacts to show data while debugging
this.emit('compilationFinished', source.target, source, 'soljson', data)
this.emit('compilationFinished', source.target, source, 'soljson', data, input, version)
}
})
}

@ -24,12 +24,12 @@ export class CompilerArtefacts extends Plugin {
}
onActivation () {
const saveCompilationPerFileResult = (file, source, languageVersion, data) => {
this.compilersArtefactsPerFile[file] = new CompilerAbstract(languageVersion, data, source)
const saveCompilationPerFileResult = (file, source, languageVersion, data, input?) => {
this.compilersArtefactsPerFile[file] = new CompilerAbstract(languageVersion, data, source, input)
}
this.on('solidity', 'compilationFinished', (file, source, languageVersion, data) => {
this.compilersArtefacts.__last = new CompilerAbstract(languageVersion, data, source)
this.on('solidity', 'compilationFinished', (file, source, languageVersion, data, input, version) => {
this.compilersArtefacts.__last = new CompilerAbstract(languageVersion, data, source, input)
saveCompilationPerFileResult(file, source, languageVersion, data)
})
@ -48,9 +48,9 @@ export class CompilerArtefacts extends Plugin {
saveCompilationPerFileResult(file, source, languageVersion, data)
})
this.on('solidityUnitTesting', 'compilationFinished', (file, source, languageVersion, data) => {
this.compilersArtefacts.__last = new CompilerAbstract(languageVersion, data, source)
saveCompilationPerFileResult(file, source, languageVersion, data)
this.on('solidityUnitTesting', 'compilationFinished', (file, source, languageVersion, data, input, version) => {
this.compilersArtefacts.__last = new CompilerAbstract(languageVersion, data, source, input)
saveCompilationPerFileResult(file, source, languageVersion, data, input)
})
}

@ -42,7 +42,7 @@ export class EditorContextListener extends Plugin {
onActivation () {
this.on('editor', 'contentChanged', () => { this._stopHighlighting() })
this.on('solidity', 'compilationFinished', (file, source, languageVersion, data) => {
this.on('solidity', 'compilationFinished', (file, source, languageVersion, data, input, version) => {
if (languageVersion.indexOf('soljson') !== 0) return
this._stopHighlighting()
this._index = {

@ -70,7 +70,7 @@ export class OffsetToLineColumnConverter extends Plugin {
* called by plugin API
*/
activate () {
this.on('solidity', 'compilationFinished', () => {
this.on('solidity', 'compilationFinished', (success, data, source, input, version) => {
this.clear()
})
}

@ -8,7 +8,7 @@ export class OffsetToColumnConverter {
constructor (compilerEvent) {
this.lineBreakPositionsByContent = {}
if (compilerEvent) {
compilerEvent.register('compilationFinished', (success, data, source) => {
compilerEvent.register('compilationFinished', (success, data, source, input, version) => {
this.clear()
})
}

@ -9,8 +9,7 @@ import {
Source, SourceWithTarget, MessageFromWorker, CompilerState, CompilationResult,
visitContractsCallbackParam, visitContractsCallbackInterface, CompilationError,
gatherImportsCallbackInterface,
isFunctionDescription,
CompilerInput
isFunctionDescription
} from './types'
/*
@ -38,7 +37,7 @@ export class Compiler {
}
}
this.event.register('compilationFinished', (success: boolean, data: CompilationResult, source: SourceWithTarget) => {
this.event.register('compilationFinished', (success: boolean, data: CompilationResult, source: SourceWithTarget, input: string, version: string) => {
if (success && this.state.compilationStartTime) {
this.event.trigger('compilationDuration', [(new Date().getTime()) - this.state.compilationStartTime])
}
@ -71,7 +70,7 @@ export class Compiler {
this.gatherImports(files, missingInputs, (error, input) => {
if (error) {
this.state.lastCompilationResult = null
this.event.trigger('compilationFinished', [false, { error: { formattedMessage: error, severity: 'error' } }, files])
this.event.trigger('compilationFinished', [false, { error: { formattedMessage: error, severity: 'error' } }, files, input, this.state.currentVersion])
} else if (this.state.compileJSON && input) { this.state.compileJSON(input) }
})
}

@ -142,7 +142,7 @@ export function compileFileOrFiles (filename: string, isDirectory: boolean, opts
},
function doCompilation (next) {
// @ts-ignore
compiler.event.register('compilationFinished', this, (success, data, source) => {
compiler.event.register('compilationFinished', this, (success, data, source, input, version) => {
next(null, data)
})
compiler.compile(sources, filepath)
@ -201,10 +201,10 @@ export function compileContractSources (sources: SrcIfc, newCompConfig: any, imp
}
},
(next) => {
const compilationFinishedCb = (success, data, source) => {
const compilationFinishedCb = (success, data, source, input, version) => {
// data.error usually exists for exceptions like worker error etc.
if (!data.error) UTRunner.compiler = compiler
if (opts && opts.event) opts.event.emit('compilationFinished', success, data, source)
if (opts && opts.event) opts.event.emit('compilationFinished', success, data, source, input, version)
next(null, data)
}
compiler.event.unregister('compilationFinished', compilationFinishedCb)

@ -50,7 +50,7 @@ export const listenToEvents = (compileTabLogic: CompileTabLogic, api) => (dispat
dispatch(setCompilerMode('compilerLoaded'))
})
compileTabLogic.compiler.event.register('compilationFinished', (success, data, source) => {
dispatch(setCompilerMode('compilationFinished', success, data, source))
compileTabLogic.compiler.event.register('compilationFinished', (success, data, source, input, version) => {
dispatch(setCompilerMode('compilationFinished', success, data, source, input, version))
})
}

@ -5,9 +5,9 @@ export const compilation = (analysisModule, dispatch) => {
analysisModule.on(
'solidity',
'compilationFinished',
(file, source, languageVersion, data) => {
(file, source, languageVersion, data, input, version) => {
if (languageVersion.indexOf('soljson') !== 0) return
dispatch({ type: 'compilationFinished', payload: { file, source, languageVersion, data } })
dispatch({ type: 'compilationFinished', payload: { file, source, languageVersion, data, input, version } })
}
)
}

@ -13,7 +13,9 @@ export const analysisReducer = (state, action) => {
file: action.payload.file,
source: action.payload.source,
languageVersion: action.payload.languageVersion,
data: action.payload.data
data: action.payload.data,
input: action.payload.input,
version: action.payload.version
}
default:
return initialState

Loading…
Cancel
Save