diff --git a/libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx b/libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx index ae704ff18f..042282e5da 100644 --- a/libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx +++ b/libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx @@ -14,6 +14,7 @@ import axios, { AxiosResponse } from 'axios' import './css/style.css' + const defaultPath = "compiler_config.json" declare global { @@ -23,6 +24,8 @@ declare global { } } +type AstNode = { id: number, literals: string[], nodeType: string, src: string } + const _paq = window._paq = window._paq || [] //eslint-disable-line diff --git a/libs/remix-ui/solidity-compiler/src/lib/contract-selection.tsx b/libs/remix-ui/solidity-compiler/src/lib/contract-selection.tsx index 3f5f10378c..21330a2440 100644 --- a/libs/remix-ui/solidity-compiler/src/lib/contract-selection.tsx +++ b/libs/remix-ui/solidity-compiler/src/lib/contract-selection.tsx @@ -203,11 +203,6 @@ export const ContractSelection = (props: ContractSelectionProps) => { return copyContractProperty('bytecode') } - /** - * Local property to hold flattend contract result - */ - // let content4AST: string - /** * Take AST and generates a UML diagram of compiled contract as svg * @returns void @@ -239,8 +234,13 @@ export const ContractSelection = (props: ContractSelectionProps) => { const sources = api.getCompilationResult().source.sources setContent4AST(concatSourceFiles(sorted, sources)) } - - + + const showFlattener = () => { + const confirmNodeType = api.getCompilationResult().data.sources[api.currentFile].ast.nodes.some(x => x.nodeType === 'ImportDirective') + const currentFile = api.currentFile.split('/')[1] + const contractListConfirm = contractList.some(x => x.file === currentFile) + return confirmNodeType && contractListConfirm + } return ( // define swarm logo <> @@ -254,16 +254,17 @@ export const ContractSelection = (props: ContractSelectionProps) => {
- + }