remix-project mirror
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
remix-project/libs/remix-debug/test/decoder/localsTests/helper.ts

43 lines
1.0 KiB

'use strict'
var localDecoder = require('../../../src/solidity-decoder/localDecoder')
/*
Decode local variable
*/
function decodeLocal (st, index, traceManager, callTree, verifier) {
8 years ago
try {
traceManager.waterfall([
function getStackAt (stepIndex, callback) {
try {
const result = traceManager.getStackAt(stepIndex)
callback(null, result)
} catch (error) {
callback(error)
}
},
function getMemoryAt (stepIndex, callback) {
try {
const result = traceManager.getMemoryAt(stepIndex)
callback(null, result)
} catch (error) {
callback(error)
}
}],
8 years ago
index,
function (error, result) {
if (error) {
return st.fail(error)
8 years ago
}
localDecoder.solidityLocals(index, callTree, result[0].value, result[1].value, {}, { start: 5000 }).then((locals) => {
verifier(locals)
})
8 years ago
})
} catch (e) {
st.fail(e.message)
}
}
module.exports = {
decodeLocals: decodeLocal
}