fix error thrown

pull/5370/head
Joseph Izang 2 years ago committed by Aniket
parent d106be677a
commit cc35d7e58e
  1. 7
      apps/remix-ide/src/app/plugins/contractFlattener.tsx
  2. 6
      apps/remix-ide/src/app/plugins/solidity-umlgen.tsx
  3. 1
      libs/remix-ui/solidity-compiler/src/lib/logic/flattenerUtilities.ts

@ -15,23 +15,20 @@ const profile = {
}
export class ContractFlattener extends Plugin {
fileName: string
constructor() {
super(profile)
this.fileName = ''
}
onActivation(): void {
this.on('solidity', 'compilationFinished', async (file, source, languageVersion, data, input, version) => {
await this.flattenContract(source, this.fileName, data)
await this.flattenContract(source, file, data)
})
_paq.push(['trackEvent', 'plugin', 'activated', 'contractFlattener'])
}
async flattenAContract(action: customAction) {
this.fileName = action.path[0]
this.call('manager', 'deactivatePlugin', 'solidityumlgen')
await this.call('solidity', 'compile', this.fileName)
await this.call('solidity', 'compile', action.path[0])
}
/**

@ -76,7 +76,7 @@ export class SolidityUmlGen extends ViewPlugin implements ISolidityUmlGen {
let result = ''
try {
if (data.sources && Object.keys(data.sources).length > 1) { // we should flatten first as there are multiple asts
result = await this.flattenContract(file)
result = await this.flattenContract(source, file, data)
}
const ast = result.length > 1 ? parser.parse(result) : parser.parse(source.sources[file].content)
const umlClasses = convertAST2UmlClasses(ast, this.currentFile)
@ -135,8 +135,8 @@ export class SolidityUmlGen extends ViewPlugin implements ISolidityUmlGen {
* and assigns to a local property
* @returns {Promise<string>}
*/
async flattenContract (filePath: string) {
const result = await this.call('contractflattener', 'flatten', filePath)
async flattenContract (source: any, filePath: string, data: any) {
const result = await this.call('contractflattener', 'flattenContract', source, filePath, data)
return result
}

@ -170,6 +170,7 @@ function _resolvePathArray(parts) {
}
export function normalizeContractPath(contractPath: string): string {
console.log('contractPath', contractPath)
let paths = contractPath.split('/')
let filename = paths[paths.length - 1].split('.')[0]
let folders = ''

Loading…
Cancel
Save