fix uml gen

pull/4530/head
yann300 9 months ago
parent 8558a9b072
commit 5728d1e496
  1. 7
      apps/remix-ide/src/app/plugins/solidity-umlgen.tsx
  2. 3
      libs/remix-ui/solidity-uml-gen/src/types/index.ts

@ -11,6 +11,7 @@ import vizRenderStringSync from '@aduh95/viz.js/sync'
import {PluginViewWrapper} from '@remix-ui/helper'
import {customAction} from '@remixproject/plugin-api'
import {ClassOptions} from 'sol2uml/lib/converterClass2Dot'
import type {CompilerInput} from '@remix-project/remix-solidity'
const parser = (window as any).SolidityParser
const _paq = (window._paq = window._paq || [])
@ -74,7 +75,7 @@ export class SolidityUmlGen extends ViewPlugin implements ISolidityUmlGen {
try {
if (data.sources && Object.keys(data.sources).length > 1) {
// we should flatten first as there are multiple asts
result = await this.flattenContract(source, file, data)
result = await this.flattenContract(source, file, data, JSON.parse(input))
}
const ast = result.length > 1 ? parser.parse(result) : parser.parse(source.sources[file].content)
this.umlClasses = convertAST2UmlClasses(ast, this.currentFile)
@ -142,8 +143,8 @@ export class SolidityUmlGen extends ViewPlugin implements ISolidityUmlGen {
* and assigns to a local property
* @returns {Promise<string>}
*/
async flattenContract(source: any, filePath: string, data: any) {
const result = await this.call('contractflattener', 'flattenContract', source, filePath, data)
async flattenContract(source: any, filePath: string, data: any, input: CompilerInput) {
const result = await this.call('contractflattener', 'flattenContract', source, filePath, data, input)
return result
}

@ -1,5 +1,6 @@
import { ViewPlugin } from '@remixproject/engine-web'
import { customAction } from '@remixproject/plugin-api'
import type {CompilerInput} from '@remix-project/remix-solidity'
import React from 'react'
export interface ISolidityUmlGen extends ViewPlugin {
@ -17,7 +18,7 @@ export interface ISolidityUmlGen extends ViewPlugin {
updateComponent(state: any): JSX.Element
setDispatch(dispatch: React.Dispatch<any>): void
generateCustomAction(action: customAction): Promise<void>
flattenContract (source: any, filePath: string, data: any): Promise<string>
flattenContract (source: any, filePath: string, data: any, input: CompilerInput): Promise<string>
hideSpinner(): void
renderComponent (): void
triggerGenerateUml: boolean

Loading…
Cancel
Save