tests fixes

yann300-patch-5
aniket-engg 4 years ago committed by Aniket
parent 65c1d63df4
commit 155611c785
  1. 25
      libs/remix-debug/src/solidity-decoder/internalCallTree.js
  2. 8
      libs/remix-debug/test/decoder/localsTests/int.js

@ -252,18 +252,18 @@ function includeVariableDeclaration (tree, step, sourceLocation, scopeId, newLoc
try { try {
const stack = tree.traceManager.getStackAt(step) const stack = tree.traceManager.getStackAt(step)
var states = tree.solidityProxy.extractStatesDefinitions() var states = tree.solidityProxy.extractStatesDefinitions()
if (functionDefinition.parameters && functionDefinition.parameters.length) { if (functionDefinition.parameters) {
let inputs let inputs = functionDefinition.parameters
let outputs let outputs = functionDefinition.returnParameters
for (const element of functionDefinition.parameters) { // for (const element of functionDefinition.parameters) {
if (element.nodeType === 'ParameterList') { // if (element.nodeType === 'ParameterList') {
if (!inputs) inputs = element // if (!inputs) inputs = element
else { // else {
outputs = element // outputs = element
break // break
} // }
} // }
} // }
// input params // input params
if (inputs) { if (inputs) {
functionDefinitionAndInputs.inputs = addParams(inputs, tree, scopeId, states, contractName, previousSourceLocation, stack.length, inputs.parameters.length, -1) functionDefinitionAndInputs.inputs = addParams(inputs, tree, scopeId, states, contractName, previousSourceLocation, stack.length, inputs.parameters.length, -1)
@ -335,6 +335,7 @@ function extractFunctionDefinitions (ast, astWalker) {
function addParams (parameterList, tree, scopeId, states, contractName, sourceLocation, stackLength, stackPosition, dir) { function addParams (parameterList, tree, scopeId, states, contractName, sourceLocation, stackLength, stackPosition, dir) {
let params = [] let params = []
for (let inputParam in parameterList.parameters) { for (let inputParam in parameterList.parameters) {
console.log('parameterList.parameters------>', parameterList.parameters)
const param = parameterList.parameters[inputParam] const param = parameterList.parameters[inputParam]
const stackDepth = stackLength + (dir * stackPosition) const stackDepth = stackLength + (dir * stackPosition)
if (stackDepth >= 0) { if (stackDepth >= 0) {

@ -44,7 +44,6 @@ module.exports = function (st, vm, privateKey, contractBytecode, compilationResu
st.equals(functions1.length, 1) st.equals(functions1.length, 1)
st.equals(functions2.length, 2) st.equals(functions2.length, 2)
st.equals(functions3.length, 0) st.equals(functions3.length, 0)
st.equals(Object.keys(functions1[0])[0], 'functionDefinition') st.equals(Object.keys(functions1[0])[0], 'functionDefinition')
st.equals(Object.keys(functions1[0])[1], 'inputs') st.equals(Object.keys(functions1[0])[1], 'inputs')
st.equals(functions1[0].inputs[0], 'foo') st.equals(functions1[0].inputs[0], 'foo')
@ -55,9 +54,9 @@ module.exports = function (st, vm, privateKey, contractBytecode, compilationResu
st.equals(functions2[0].inputs[0], 'asd') st.equals(functions2[0].inputs[0], 'asd')
st.equals(functions2[1].inputs[0], 'foo') st.equals(functions2[1].inputs[0], 'foo')
st.equals(functions1[0].functionDefinition.attributes.name, 'level11') st.equals(functions1[0].functionDefinition.name, 'level11')
st.equals(functions2[0].functionDefinition.attributes.name, 'level12') st.equals(functions2[0].functionDefinition.name, 'level12')
st.equals(functions2[1].functionDefinition.attributes.name, 'level11') st.equals(functions2[1].functionDefinition.name, 'level11')
st.equals(scopeStarts[0], '') st.equals(scopeStarts[0], '')
st.equals(scopeStarts[13], '1') st.equals(scopeStarts[13], '1')
@ -66,6 +65,7 @@ module.exports = function (st, vm, privateKey, contractBytecode, compilationResu
st.equals(scopeStarts[136], '3') st.equals(scopeStarts[136], '3')
st.equals(scopeStarts[153], '4') st.equals(scopeStarts[153], '4')
st.equals(scopeStarts[166], '4.1') st.equals(scopeStarts[166], '4.1')
console.log('----------->', scopes[''])
st.equals(scopes[''].locals['ui8'].type.typeName, 'uint8') st.equals(scopes[''].locals['ui8'].type.typeName, 'uint8')
st.equals(scopes[''].locals['ui16'].type.typeName, 'uint16') st.equals(scopes[''].locals['ui16'].type.typeName, 'uint16')
st.equals(scopes[''].locals['ui32'].type.typeName, 'uint32') st.equals(scopes[''].locals['ui32'].type.typeName, 'uint32')

Loading…
Cancel
Save