boolean check

pull/5370/head
filip mertens 2 years ago committed by Aniket
parent 040f21a889
commit 1d3df9e83c
  1. 13
      apps/remix-ide/src/app/plugins/contractFlattener.tsx

@ -15,6 +15,8 @@ const profile = {
} }
export class ContractFlattener extends Plugin { export class ContractFlattener extends Plugin {
triggerFlattenContract: boolean = false
constructor() { constructor() {
super(profile) super(profile)
} }
@ -22,13 +24,21 @@ export class ContractFlattener extends Plugin {
onActivation(): void { onActivation(): void {
this.on('solidity', 'compilationFinished', async (file, source, languageVersion, data, input, version) => { this.on('solidity', 'compilationFinished', async (file, source, languageVersion, data, input, version) => {
if(data.sources && Object.keys(data.sources).length > 1) { if(data.sources && Object.keys(data.sources).length > 1) {
await this.flattenContract(source, file, data) if(this.triggerFlattenContract) {
this.triggerFlattenContract = false
await this.flattenContract(source, file, data)
}
} }
}) })
_paq.push(['trackEvent', 'plugin', 'activated', 'contractFlattener']) _paq.push(['trackEvent', 'plugin', 'activated', 'contractFlattener'])
} }
onDeactivation(): void {
this.off('solidity', 'compilationFinished')
}
async flattenAContract(action: customAction) { async flattenAContract(action: customAction) {
this.triggerFlattenContract = true
await this.call('solidity', 'compile', action.path[0]) await this.call('solidity', 'compile', action.path[0])
} }
@ -46,6 +56,7 @@ export class ContractFlattener extends Plugin {
let sorted let sorted
let result let result
let sources let sources
console.log('flattenContract', source, filePath, data)
try{ try{
dependencyGraph = getDependencyGraph(ast, filePath) dependencyGraph = getDependencyGraph(ast, filePath)
sorted = dependencyGraph.isEmpty() sorted = dependencyGraph.isEmpty()

Loading…
Cancel
Save