trying out convertAST2UML function

pull/5370/head
Joseph Izang 2 years ago committed by Aniket
parent 8401c5e159
commit 1a2bb629b9
  1. 18
      libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx

@ -23,6 +23,7 @@ declare global {
}
}
const _paq = window._paq = window._paq || [] //eslint-disable-line
export const CompilerContainer = (props: CompilerContainerProps) => {
@ -733,6 +734,21 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
setToggleExpander(!toggleExpander)
}
const generateUML = async () => {
const payload = api.getCompilationResult()
const currentFile = api.currentFile
const sourceCode = payload.source.sources[currentFile].content
const ast = payload.data.sources[currentFile].ast
console.log({ ast })
try {
const result = await convertAST2UmlClasses(ast, ast.absolutePath)
console.log({ result })
} catch (error) {
console.log({ error })
console.log({ payload })
}
}
return (
<section>
@ -1014,7 +1030,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
</button>
</CopyToClipboard>
</div>
<button onClick={() => console.log('clicked!')} className="btn btn-primary btn-block mt-2"> Generate UML Diagram</button>
<button onClick={generateUML} className="btn btn-primary btn-block mt-2"> Generate UML Diagram</button>
</div>
</article>
</section>

Loading…
Cancel
Save