refactor getSourceLocationFromVMTraceIndex to a promise

pull/62/head
Iuri Matias 5 years ago committed by aniket-engg
parent 0f4f699d01
commit 459e045e04
  1. 21
      libs/remix-debug/src/solidity-decoder/internalCallTree.js

@ -126,18 +126,19 @@ class InternalCallTree {
extractSourceLocation (step) {
return new Promise((resolve, reject) => {
try {
const address = this.traceManager.getCurrentCalledAddressAt(step)
try {
this.sourceLocationTracker.getSourceLocationFromVMTraceIndex(address, step, this.solidityProxy.contracts).then(resolve).catch((error) => {
return reject('InternalCallTree - Cannot retrieve sourcelocation for step ' + step + ' ' + error)
})
} catch (error) {
this.traceManager.getCurrentCalledAddressAt(step, (error, address) => {
if (!error) {
try {
this.sourceLocationTracker.getSourceLocationFromVMTraceIndex(address, step, this.solidityProxy.contracts).then(resolve).catch((error) => {
return reject('InternalCallTree - Cannot retrieve sourcelocation for step ' + step + ' ' + error)
})
} catch (error) {
return reject('InternalCallTree - Cannot retrieve address for step ' + step + ' ' + error)
}
} else {
return reject('InternalCallTree - Cannot retrieve address for step ' + step + ' ' + error)
}
} catch (error) {
return reject('InternalCallTree - Cannot retrieve address for step ' + step + ' ' + error)
}
})
})
}

Loading…
Cancel
Save