pull/5370/head
Joseph Izang 2 years ago committed by Aniket
parent 00f4ac6178
commit cb74207ea7
  1. 4
      apps/remix-ide/src/app/plugins/contractFlattener.tsx
  2. 20
      apps/remix-ide/src/app/plugins/solidity-umlgen.tsx
  3. 1
      libs/remix-ui/solidity-compiler/src/lib/logic/flattenerUtilities.ts

@ -9,9 +9,9 @@ const profile = {
name: 'contractflattener',
displayName: 'Contract Flattener',
description: 'Flatten solidity contracts',
methods: ['flattenAContract', 'normalizeContractPath'],
methods: ['flattenAContract', 'flattenContract'],
events: [],
maintainedBy: 'Remix Team',
maintainedBy: 'Remix',
}
export class ContractFlattener extends Plugin {

@ -136,25 +136,7 @@ export class SolidityUmlGen extends ViewPlugin implements ISolidityUmlGen {
* @returns {Promise<string>}
*/
async flattenContract (source: any, filePath: string, data: any) {
const normalPath = normalizeContractPath(filePath)
let dependencyGraph
let sorted
let result
let sources
try{
dependencyGraph = getDependencyGraph(data.sources, filePath)
sorted = dependencyGraph.isEmpty()
? [filePath]
: dependencyGraph.sort().reverse()
sources = source.sources
result = concatSourceFiles(sorted, sources)
}catch(err){
console.warn(err)
}
await this.call('fileManager', 'writeFile', normalPath, result)
sorted = null
sources = null
dependencyGraph = null
const result = await this.call('contractflattener', 'flatten', filePath)
return result
}

@ -179,6 +179,7 @@ export function normalizeContractPath(contractPath: string): string {
}
}
const resultingPath = `${folders}${filename}_flattened.sol`
// cleanup variables
paths = null
filename = null
folders = null

Loading…
Cancel
Save