refactor getAddresses

pull/5370/head
Iuri Matias 4 years ago committed by aniket-engg
parent 518eaa8642
commit 4441f90eba
  1. 8
      libs/remix-debug/src/debugger/VmDebugger.js
  2. 4
      libs/remix-lib/src/trace/traceManager.js
  3. 13
      libs/remix-lib/test/traceManager.js

@ -160,11 +160,9 @@ class VmDebuggerLogic {
this.traceLength = 0
this.debugger.event.register('newTraceLoaded', (length) => {
this._traceManager.getAddresses((error, addresses) => {
if (error) return
this.event.trigger('traceAddressesUpdate', [addresses])
this.addresses = addresses
})
const addresses = this._traceManager.getAddresses()
this.event.trigger('traceAddressesUpdate', [addresses])
this.addresses = addresses
this._traceManager.getLength((error, length) => {
if (error) return

@ -84,8 +84,8 @@ TraceManager.prototype.accumulateStorageChanges = function (index, address, stor
return this.traceCache.accumulateStorageChanges(index, address, storageOrigin)
}
TraceManager.prototype.getAddresses = function (callback) {
callback(null, this.traceCache.addresses)
TraceManager.prototype.getAddresses = function () {
return this.traceCache.addresses
}
TraceManager.prototype.getCallDataAt = function (stepIndex, callback) {

@ -278,15 +278,10 @@ tape('TraceManager', function (t) {
})
t.test('TraceManager.getAddresses', function (st) {
traceManager.getAddresses(function (error, result) {
if (error) {
st.fail(error)
} else {
st.ok(result[0] === '0x0d3a18d64dfe4f927832ab58d6451cecc4e517c5')
st.ok(result[1] === '(Contract Creation - Step 63)')
st.end()
}
})
const result = traceManager.getAddresses()
st.ok(result[0] === '0x0d3a18d64dfe4f927832ab58d6451cecc4e517c5')
st.ok(result[1] === '(Contract Creation - Step 63)')
st.end()
})
t.test('TraceManager.getReturnValue', function (st) {

Loading…
Cancel
Save