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.storageResolver = null
this.tx = tx 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) this.debuggerSolidityLocals = new DebuggerSolidityLocals(_parentUI, tx, _stepManager, _traceManager, _callTree)
} }
@ -33,7 +33,6 @@ class VmDebuggerLogic {
this.listenToFullStorageChanges() this.listenToFullStorageChanges()
this.listenToNewChanges() this.listenToNewChanges()
this.debuggerSolidityState.init()
this.listenToSolidityStateEvents() this.listenToSolidityStateEvents()
this.debuggerSolidityLocals.init() this.debuggerSolidityLocals.init()
@ -220,6 +219,7 @@ class VmDebuggerLogic {
listenToSolidityStateEvents () { listenToSolidityStateEvents () {
const self = this const self = this
this._parentUI.event.register('indexChanged', this.debuggerSolidityState.init.bind(this.debuggerSolidityState))
this.debuggerSolidityState.event.register('solidityState', function (state) { this.debuggerSolidityState.event.register('solidityState', function (state) {
self.event.trigger('solidityState', [state]) self.event.trigger('solidityState', [state])
}) })
@ -229,6 +229,8 @@ class VmDebuggerLogic {
this.debuggerSolidityState.event.register('solidityStateUpdating', function () { this.debuggerSolidityState.event.register('solidityStateUpdating', function () {
self.event.trigger('solidityStateUpdating', []) 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 () { listenToSolidityLocalsEvents () {

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

Loading…
Cancel
Save