refactor buildCallPath

pull/62/head
Iuri Matias 5 years ago committed by aniket-engg
parent a2056a49cf
commit 98494c3de6
  1. 9
      libs/remix-debug/src/debugger/stepManager.js
  2. 8
      libs/remix-lib/src/trace/traceManager.js

@ -41,11 +41,7 @@ class DebuggerStepManager {
if (index < 0) return
if (this.currentStepIndex !== index) return
this.traceManager.buildCallPath(index, (error, callsPath) => {
if (error) {
console.log(error)
return this.event.trigger('revertWarning', [''])
}
this.traceManager.buildCallPath(index).then((callsPath) => {
this.currentCall = callsPath[callsPath.length - 1]
if (this.currentCall.reverted) {
let revertedReason = this.currentCall.outofgas ? 'outofgas' : ''
@ -59,6 +55,9 @@ class DebuggerStepManager {
this.event.trigger('revertWarning', ['parenthasthrown'])
}
this.event.trigger('revertWarning', [''])
}).catch((error) => {
console.log(error)
this.event.trigger('revertWarning', [''])
})
})
}

@ -101,15 +101,15 @@ TraceManager.prototype.getCallDataAt = function (stepIndex) {
return [this.traceCache.callsData[callDataChange]]
}
TraceManager.prototype.buildCallPath = function (stepIndex, callback) {
TraceManager.prototype.buildCallPath = function (stepIndex) {
try {
this.checkRequestedStep(stepIndex)
} catch (check) {
return callback(check, null)
throw new Error(check)
}
const callsPath = util.buildCallPath(stepIndex, this.traceCache.callsTree.call)
if (callsPath === null) return callback('no call path built', null)
callback(null, callsPath)
if (callsPath === null) throw new Error('no call path built')
return callsPath
}
TraceManager.prototype.getCallStackAt = function (stepIndex) {

Loading…
Cancel
Save