Skip to content

Commit 5728d1e

Browse files
committed
fix uml gen
1 parent 8558a9b commit 5728d1e

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

apps/remix-ide/src/app/plugins/solidity-umlgen.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import vizRenderStringSync from '@aduh95/viz.js/sync'
1111
import {PluginViewWrapper} from '@remix-ui/helper'
1212
import {customAction} from '@remixproject/plugin-api'
1313
import {ClassOptions} from 'sol2uml/lib/converterClass2Dot'
14+
import type {CompilerInput} from '@remix-project/remix-solidity'
1415
const parser = (window as any).SolidityParser
1516

1617
const _paq = (window._paq = window._paq || [])
@@ -74,7 +75,7 @@ export class SolidityUmlGen extends ViewPlugin implements ISolidityUmlGen {
7475
try {
7576
if (data.sources && Object.keys(data.sources).length > 1) {
7677
// we should flatten first as there are multiple asts
77-
result = await this.flattenContract(source, file, data)
78+
result = await this.flattenContract(source, file, data, JSON.parse(input))
7879
}
7980
const ast = result.length > 1 ? parser.parse(result) : parser.parse(source.sources[file].content)
8081
this.umlClasses = convertAST2UmlClasses(ast, this.currentFile)
@@ -142,8 +143,8 @@ export class SolidityUmlGen extends ViewPlugin implements ISolidityUmlGen {
142143
* and assigns to a local property
143144
* @returns {Promise<string>}
144145
*/
145-
async flattenContract(source: any, filePath: string, data: any) {
146-
const result = await this.call('contractflattener', 'flattenContract', source, filePath, data)
146+
async flattenContract(source: any, filePath: string, data: any, input: CompilerInput) {
147+
const result = await this.call('contractflattener', 'flattenContract', source, filePath, data, input)
147148
return result
148149
}
149150

libs/remix-ui/solidity-uml-gen/src/types/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { ViewPlugin } from '@remixproject/engine-web'
22
import { customAction } from '@remixproject/plugin-api'
3+
import type {CompilerInput} from '@remix-project/remix-solidity'
34
import React from 'react'
45

56
export interface ISolidityUmlGen extends ViewPlugin {
@@ -17,7 +18,7 @@ export interface ISolidityUmlGen extends ViewPlugin {
1718
updateComponent(state: any): JSX.Element
1819
setDispatch(dispatch: React.Dispatch<any>): void
1920
generateCustomAction(action: customAction): Promise<void>
20-
flattenContract (source: any, filePath: string, data: any): Promise<string>
21+
flattenContract (source: any, filePath: string, data: any, input: CompilerInput): Promise<string>
2122
hideSpinner(): void
2223
renderComponent (): void
2324
triggerGenerateUml: boolean

0 commit comments

Comments
 (0)