From 830174cff01f360b861008a61b9e1f67e220a644 Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 28 Apr 2020 12:32:49 +0200 Subject: [PATCH] better extraction of input params --- .../src/solidity-decoder/internalCallTree.js | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/remix-debug/src/solidity-decoder/internalCallTree.js b/remix-debug/src/solidity-decoder/internalCallTree.js index f8aaaa5a09..7da943a0be 100644 --- a/remix-debug/src/solidity-decoder/internalCallTree.js +++ b/remix-debug/src/solidity-decoder/internalCallTree.js @@ -227,10 +227,23 @@ function includeVariableDeclaration (tree, step, sourceLocation, scopeId, newLoc tree.traceManager.getStackAt(step, (error, stack) => { if (!error) { var states = tree.solidityProxy.extractStatesDefinitions() - // input params - addParams(functionDefinition.children[0], tree, scopeId, states, contractName, previousSourceLocation, stack.length, functionDefinition.children[0].children.length, -1) - // output params - addParams(functionDefinition.children[1], tree, scopeId, states, contractName, previousSourceLocation, stack.length, 0, 1) + if (functionDefinition.children && functionDefinition.children.length) { + let inputs + let outputs + for (const element of functionDefinition.children) { + if (element.name === 'ParameterList') { + if (!inputs) inputs = element + else { + outputs = element + break + } + } + } + // input params + if (inputs) addParams(inputs, tree, scopeId, states, contractName, previousSourceLocation, stack.length, inputs.children.length, -1) + // output params + if (outputs) addParams(outputs, tree, scopeId, states, contractName, previousSourceLocation, stack.length, 0, 1) + } } }) }