refactor getCurrentStep

pull/5370/head
Iuri Matias 4 years ago committed by aniket-engg
parent 12bf5ce4fb
commit 582980d4d3
  1. 9
      libs/remix-debug/src/debugger/VmDebugger.js
  2. 6
      libs/remix-lib/src/trace/traceManager.js
  3. 15
      libs/remix-lib/test/traceManager.js

@ -113,9 +113,12 @@ class VmDebuggerLogic {
} catch (error) {
}
this._traceManager.getCurrentStep(index, (error, step) => {
this.event.trigger('traceCurrentStepUpdate', [error, step])
})
try {
const step = this._traceManager.getCurrentStep(index)
this.event.trigger('traceCurrentStepUpdate', [null, step])
} catch (error) {
this.event.trigger('traceCurrentStepUpdate', [error])
}
try {
const addmem = this._traceManager.getMemExpand(index)

@ -200,13 +200,13 @@ TraceManager.prototype.getReturnValue = function (stepIndex) {
return this.traceCache.returnValues[stepIndex]
}
TraceManager.prototype.getCurrentStep = function (stepIndex, callback) {
TraceManager.prototype.getCurrentStep = function (stepIndex) {
try {
this.checkRequestedStep(stepIndex)
} catch (check) {
return callback(check, null)
throw new Error(check)
}
callback(null, this.traceCache.steps[stepIndex])
return this.traceCache.steps[stepIndex]
}
TraceManager.prototype.getMemExpand = function (stepIndex) {

@ -209,15 +209,14 @@ tape('TraceManager', function (t) {
})
t.test('TraceManager.getCurrentStep', function (st) {
traceManager.getCurrentStep(66, function (error, result) {
try {
const result = traceManager.getCurrentStep(66)
console.log(result)
if (error) {
st.fail(error)
} else {
st.ok(result === 2)
st.end()
}
})
st.ok(result === 2)
st.end()
} catch (error) {
st.fail(error)
}
})
t.test('TraceManager.getMemExpand', function (st) {

Loading…
Cancel
Save