From c55b4e5874b54c7d6f3742265c56b1d244b7b740 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Mon, 7 Sep 2020 20:45:31 +0530 Subject: [PATCH] all tests fixed --- .../remix-debug/src/solidity-decoder/internalCallTree.js | 1 - libs/remix-debug/src/source/astWalker.js | 9 ++++++--- libs/remix-debug/test/decoder/localsTests/int.js | 1 - 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/libs/remix-debug/src/solidity-decoder/internalCallTree.js b/libs/remix-debug/src/solidity-decoder/internalCallTree.js index 5f84c48484..ce3709e58b 100644 --- a/libs/remix-debug/src/solidity-decoder/internalCallTree.js +++ b/libs/remix-debug/src/solidity-decoder/internalCallTree.js @@ -335,7 +335,6 @@ function extractFunctionDefinitions (ast, astWalker) { function addParams (parameterList, tree, scopeId, states, contractName, sourceLocation, stackLength, stackPosition, dir) { let params = [] for (let inputParam in parameterList.parameters) { - console.log('parameterList.parameters------>', parameterList.parameters) const param = parameterList.parameters[inputParam] const stackDepth = stackLength + (dir * stackPosition) if (stackDepth >= 0) { diff --git a/libs/remix-debug/src/source/astWalker.js b/libs/remix-debug/src/source/astWalker.js index 28f247268d..227cc780b1 100644 --- a/libs/remix-debug/src/source/astWalker.js +++ b/libs/remix-debug/src/source/astWalker.js @@ -21,9 +21,12 @@ AstWalker.prototype.walk = function (ast, callback) { if (!('*' in callback)) { callback['*'] = function () { return true } } - if (manageCallBack(ast, callback) && ast.nodes && ast.nodes.length > 0) { - for (let k in ast.nodes) { - const child = ast.nodes[k] + const nodes = ast.nodes || (ast.body && ast.body.statements) || ast.declarations + if(ast.body && ast.initializationExpression) // 'for' loop handling + nodes.push(ast.initializationExpression) + if (manageCallBack(ast, callback) && nodes && nodes.length > 0) { + for (let k in nodes) { + const child = nodes[k] this.walk(child, callback) } } diff --git a/libs/remix-debug/test/decoder/localsTests/int.js b/libs/remix-debug/test/decoder/localsTests/int.js index dbdf1f775b..6bf65b6d20 100644 --- a/libs/remix-debug/test/decoder/localsTests/int.js +++ b/libs/remix-debug/test/decoder/localsTests/int.js @@ -65,7 +65,6 @@ module.exports = function (st, vm, privateKey, contractBytecode, compilationResu st.equals(scopeStarts[136], '3') st.equals(scopeStarts[153], '4') st.equals(scopeStarts[166], '4.1') - console.log('----------->', scopes['']) st.equals(scopes[''].locals['ui8'].type.typeName, 'uint8') st.equals(scopes[''].locals['ui16'].type.typeName, 'uint16') st.equals(scopes[''].locals['ui32'].type.typeName, 'uint32')