Commit b87ae778 authored by Iuri Matias's avatar Iuri Matias Committed by aniket-engg

refactor getCurrentStep

parent 68b4b822
......@@ -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) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment