put functions at top level

pull/1856/head
yann300 3 years ago
parent 2c0b120df8
commit 7d18557fa0
  1. 22
      libs/remix-ui/editor-context-view/src/lib/remix-ui-editor-context-view.tsx

@ -97,19 +97,10 @@ export function RemixUiEditorContextView (props: RemixUiEditorContextViewProps)
}) })
}, []) }, [])
const _render = (node: nullableAstNode) => {
if (!node) return (<div></div>)
const references = state.references
const type = node.typeDescriptions && node.typeDescriptions.typeString ? node.typeDescriptions.typeString : node.nodeType
const referencesCount = `${references ? references.length : '0'} reference(s)`
let ref = 0
const nodes: Array<astNode> = state.activeHighlights
/* /*
* show gas estimation * show gas estimation
*/ */
const gasEstimation = () => { const gasEstimation = (node) => {
if (node.nodeType === 'FunctionDefinition') { if (node.nodeType === 'FunctionDefinition') {
const result: gasEstimationType = state.gasEstimation const result: gasEstimationType = state.gasEstimation
const executionCost = ' Execution cost: ' + result.executionCost + ' gas' const executionCost = ' Execution cost: ' + result.executionCost + ' gas'
@ -152,6 +143,15 @@ export function RemixUiEditorContextView (props: RemixUiEditorContextViewProps)
} }
} }
const _render = (node: nullableAstNode) => {
if (!node) return (<div></div>)
const references = state.references
const type = node.typeDescriptions && node.typeDescriptions.typeString ? node.typeDescriptions.typeString : node.nodeType
const referencesCount = `${references ? references.length : '0'} reference(s)`
let ref = 0
const nodes: Array<astNode> = state.activeHighlights
const jumpTo = () => { const jumpTo = () => {
if (node && node.src) { if (node && node.src) {
const position = sourceMappingDecoder.decode(node.src) const position = sourceMappingDecoder.decode(node.src)
@ -170,7 +170,7 @@ export function RemixUiEditorContextView (props: RemixUiEditorContextViewProps)
} }
return ( return (
<div className="line">{gasEstimation()} <div className="line">{gasEstimation(node)}
<div title={type} className="type">{type}</div> <div title={type} className="type">{type}</div>
<div title={node.name} className="name mr-2">{node.name}</div> <div title={node.name} className="name mr-2">{node.name}</div>
<i className="fas fa-share jump" data-action='gotoref' aria-hidden="true" onClick={jumpTo}></i> <i className="fas fa-share jump" data-action='gotoref' aria-hidden="true" onClick={jumpTo}></i>

Loading…
Cancel
Save