Update _getInputParams

pull/1/head
ninabreznik 7 years ago
parent 4dddb10941
commit d074feb330
  1. 19
      src/app/editor/contextualListener.js

@ -145,7 +145,7 @@ class ContextualListener {
if (node.name === 'FunctionDefinition') { if (node.name === 'FunctionDefinition') {
if (!node.attributes.isConstructor) { if (!node.attributes.isConstructor) {
var fnName = node.attributes.name var fnName = node.attributes.name
var fn = fnName + this._getInputParams(fnName) var fn = fnName + this._getInputParams(node)
if (node.attributes.visibility === 'public') { if (node.attributes.visibility === 'public') {
executionCost = this.estimationObj.external[fn] executionCost = this.estimationObj.external[fn]
} else if (node.attributes.visibility === 'internal') { } else if (node.attributes.visibility === 'internal') {
@ -171,16 +171,19 @@ class ContextualListener {
return contract return contract
} }
_getInputParams (fnName) { _getInputParams (node) {
var abi = this.contract.abi var list = []
for (var i in abi) { for (var i in node.children) {
if (abi[i].name === fnName) { if (node.children[i].name === 'ParameterList') {
var inputs = abi[i].inputs list.push(node.children[i])
var inputParams = inputs.length ? '(' + inputs[0].type + ')' : '()'
break break
} }
} }
return inputParams for (var j in list) {
var params = list[j].children.length ? list[j].children[0].attributes.type : ''
break
}
return '(' + params + ')'
} }
} }

Loading…
Cancel
Save