remove debugger UI dependency out of solidityState

pull/3094/head
Iuri Matias 6 years ago committed by yann300
parent 9f740ddcf4
commit 69908fa9b6
  1. 6
      src/app/debugger/debugger/VmDebugger.js
  2. 47
      src/app/debugger/debugger/solidityState.js

@ -22,7 +22,7 @@ class VmDebuggerLogic {
this.storageResolver = null
this.tx = tx
this.debuggerSolidityState = new DebuggerSolidityState(_parentUI, tx, _stepManager, _traceManager, _codeManager, _solidityProxy)
this.debuggerSolidityState = new DebuggerSolidityState(tx, _stepManager, _traceManager, _codeManager, _solidityProxy)
this.debuggerSolidityLocals = new DebuggerSolidityLocals(_parentUI, tx, _stepManager, _traceManager, _callTree)
}
@ -33,7 +33,6 @@ class VmDebuggerLogic {
this.listenToFullStorageChanges()
this.listenToNewChanges()
this.debuggerSolidityState.init()
this.listenToSolidityStateEvents()
this.debuggerSolidityLocals.init()
@ -220,6 +219,7 @@ class VmDebuggerLogic {
listenToSolidityStateEvents () {
const self = this
this._parentUI.event.register('indexChanged', this.debuggerSolidityState.init.bind(this.debuggerSolidityState))
this.debuggerSolidityState.event.register('solidityState', function (state) {
self.event.trigger('solidityState', [state])
})
@ -229,6 +229,8 @@ class VmDebuggerLogic {
this.debuggerSolidityState.event.register('solidityStateUpdating', function () {
self.event.trigger('solidityStateUpdating', [])
})
this._parentUI.event.register('traceUnloaded', this.debuggerSolidityState.reset.bind(this.debuggerSolidityState))
this._parentUI.event.register('newTraceLoaded', this.debuggerSolidityState.reset.bind(this.debuggerSolidityState))
}
listenToSolidityLocalsEvents () {

@ -6,44 +6,43 @@ var StorageViewer = remixDebug.storage.StorageViewer
class DebuggerSolidityState {
constructor (_parent, tx, _stepManager, _traceManager, _codeManager, _solidityProxy) {
constructor (tx, _stepManager, _traceManager, _codeManager, _solidityProxy) {
this.event = new EventManager()
this.storageResolver = null
this.parent = _parent
this.stepManager = _stepManager
this.traceManager = _traceManager
this.codeManager = _codeManager
this.solidityProxy = _solidityProxy
this.stateVariablesByAddresses = {}
this.tx = tx
_parent.event.register('traceUnloaded', () => { this.stateVariablesByAddresses = {} })
_parent.event.register('newTraceLoaded', () => { this.stateVariablesByAddresses = {} })
}
init () {
init (index) {
var self = this
var decodeTimeout = null
this.parent.event.register('indexChanged', this, function (index) {
if (index < 0) {
return self.event.trigger('solidityStateMessage', ['invalid step index'])
}
if (index < 0) {
return self.event.trigger('solidityStateMessage', ['invalid step index'])
}
if (self.stepManager.currentStepIndex !== index) return
if (!self.solidityProxy.loaded()) {
return self.event.trigger('solidityStateMessage', ['invalid step index'])
}
if (self.stepManager.currentStepIndex !== index) return
if (!self.solidityProxy.loaded()) {
return self.event.trigger('solidityStateMessage', ['invalid step index'])
}
if (!self.storageResolver) {
return
}
if (decodeTimeout) {
window.clearTimeout(decodeTimeout)
}
self.event.trigger('solidityStateUpdating')
decodeTimeout = setTimeout(function () {
self.decode(index)
}, 500)
})
if (!self.storageResolver) {
return
}
if (decodeTimeout) {
window.clearTimeout(decodeTimeout)
}
self.event.trigger('solidityStateUpdating')
decodeTimeout = setTimeout(function () {
self.decode(index)
}, 500)
}
reset () {
this.stateVariablesByAddresses = {}
}
decode (index) {

Loading…
Cancel
Save