remove debugger UI dependency out of solidityLocals

pull/1/head
Iuri Matias 6 years ago committed by yann300
parent 77b8aa4076
commit 1cd738d889
  1. 27
      src/app/debugger/debugger/SolidityLocals.js
  2. 5
      src/app/debugger/debugger/VmDebugger.js

@ -6,9 +6,8 @@ var StorageViewer = remixDebug.storage.StorageViewer
class DebuggerSolidityLocals { class DebuggerSolidityLocals {
constructor (_parent, tx, _stepManager, _traceManager, _internalTreeCall) { constructor (tx, _stepManager, _traceManager, _internalTreeCall) {
this.event = new EventManager() this.event = new EventManager()
this.parent = _parent
this.stepManager = _stepManager this.stepManager = _stepManager
this.internalTreeCall = _internalTreeCall this.internalTreeCall = _internalTreeCall
this.storageResolver = null this.storageResolver = null
@ -16,21 +15,19 @@ class DebuggerSolidityLocals {
this.tx = tx this.tx = tx
} }
init () { init (sourceLocation) {
const self = this const self = this
var decodeTimeout = null var decodeTimeout = null
this.parent.event.register('sourceLocationChanged', this, (sourceLocation) => { if (!this.storageResolver) {
if (!this.storageResolver) { return self.event.trigger('solidityLocalsMessage', ['storage not ready'])
return self.event.trigger('solidityLocalsMessage', ['storage not ready']) }
} if (decodeTimeout) {
if (decodeTimeout) { window.clearTimeout(decodeTimeout)
window.clearTimeout(decodeTimeout) }
} self.event.trigger('solidityLocalsUpdating')
self.event.trigger('solidityLocalsUpdating') decodeTimeout = setTimeout(function () {
decodeTimeout = setTimeout(function () { self.decode(sourceLocation)
self.decode(sourceLocation) }, 500)
}, 500)
})
} }
decode (sourceLocation) { decode (sourceLocation) {

@ -23,7 +23,7 @@ class VmDebuggerLogic {
this.tx = tx this.tx = tx
this.debuggerSolidityState = new DebuggerSolidityState(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(tx, _stepManager, _traceManager, _callTree)
} }
start () { start () {
@ -35,7 +35,6 @@ class VmDebuggerLogic {
this.listenToSolidityStateEvents() this.listenToSolidityStateEvents()
this.debuggerSolidityLocals.init()
this.listenToSolidityLocalsEvents() this.listenToSolidityLocalsEvents()
} }
@ -235,7 +234,7 @@ class VmDebuggerLogic {
listenToSolidityLocalsEvents () { listenToSolidityLocalsEvents () {
const self = this const self = this
this._parentUI.event.register('sourceLocationChanged', this.debuggerSolidityLocals.init.bind(this.debuggerSolidityLocals))
this.debuggerSolidityLocals.event.register('solidityLocals', function (state) { this.debuggerSolidityLocals.event.register('solidityLocals', function (state) {
self.event.trigger('solidityLocals', [state]) self.event.trigger('solidityLocals', [state])
}) })

Loading…
Cancel
Save