diff --git a/src/app/debugger/debugger/SolidityLocals.js b/src/app/debugger/debugger/SolidityLocals.js index 6bfa72cf3f..7560770bb2 100644 --- a/src/app/debugger/debugger/SolidityLocals.js +++ b/src/app/debugger/debugger/SolidityLocals.js @@ -6,9 +6,8 @@ var StorageViewer = remixDebug.storage.StorageViewer class DebuggerSolidityLocals { - constructor (_parent, tx, _stepManager, _traceManager, _internalTreeCall) { + constructor (tx, _stepManager, _traceManager, _internalTreeCall) { this.event = new EventManager() - this.parent = _parent this.stepManager = _stepManager this.internalTreeCall = _internalTreeCall this.storageResolver = null @@ -16,21 +15,19 @@ class DebuggerSolidityLocals { this.tx = tx } - init () { + init (sourceLocation) { const self = this var decodeTimeout = null - this.parent.event.register('sourceLocationChanged', this, (sourceLocation) => { - if (!this.storageResolver) { - return self.event.trigger('solidityLocalsMessage', ['storage not ready']) - } - if (decodeTimeout) { - window.clearTimeout(decodeTimeout) - } - self.event.trigger('solidityLocalsUpdating') - decodeTimeout = setTimeout(function () { - self.decode(sourceLocation) - }, 500) - }) + if (!this.storageResolver) { + return self.event.trigger('solidityLocalsMessage', ['storage not ready']) + } + if (decodeTimeout) { + window.clearTimeout(decodeTimeout) + } + self.event.trigger('solidityLocalsUpdating') + decodeTimeout = setTimeout(function () { + self.decode(sourceLocation) + }, 500) } decode (sourceLocation) { diff --git a/src/app/debugger/debugger/VmDebugger.js b/src/app/debugger/debugger/VmDebugger.js index 4d3a4f6e58..c53d8f4ecb 100644 --- a/src/app/debugger/debugger/VmDebugger.js +++ b/src/app/debugger/debugger/VmDebugger.js @@ -23,7 +23,7 @@ class VmDebuggerLogic { this.tx = tx 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 () { @@ -35,7 +35,6 @@ class VmDebuggerLogic { this.listenToSolidityStateEvents() - this.debuggerSolidityLocals.init() this.listenToSolidityLocalsEvents() } @@ -235,7 +234,7 @@ class VmDebuggerLogic { listenToSolidityLocalsEvents () { const self = this - + this._parentUI.event.register('sourceLocationChanged', this.debuggerSolidityLocals.init.bind(this.debuggerSolidityLocals)) this.debuggerSolidityLocals.event.register('solidityLocals', function (state) { self.event.trigger('solidityLocals', [state]) })