Commit d074feb3 authored by ninabreznik's avatar ninabreznik

Update _getInputParams

parent 4dddb109
...@@ -145,7 +145,7 @@ class ContextualListener { ...@@ -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 { ...@@ -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 + ')'
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment