remove step manager dependency on ui event

pull/1/head
Iuri Matias 6 years ago committed by yann300
parent 306be81f90
commit d4db63f6c8
  1. 6
      src/app/debugger/debugger/debugger.js
  2. 13
      src/app/debugger/debugger/stepManager.js

@ -76,7 +76,11 @@ Debugger.prototype.registerAndHighlightCodeItem = function (index) {
}
Debugger.prototype.debug = function (parent) {
this.step_manager = new StepManager(parent, this.debugger.traceManager)
const self = this
this.step_manager = new StepManager(this.debugger, this.debugger.traceManager)
parent.event.register('indexChanged', this, (index) => {
self.step_manager.event.trigger('indexChanged', [index])
})
}
module.exports = Debugger

@ -3,10 +3,9 @@ var EventManager = remixLib.EventManager
class DebuggerStepManager {
constructor (_parent, _traceManager) {
constructor (_debugger, _traceManager) {
this.event = new EventManager()
this._parent = _parent
this.parent = _parent.debugger
this.parent = _debugger
this.traceManager = _traceManager
this.currentStepIndex = 0
this.traceLength = 0
@ -37,9 +36,9 @@ class DebuggerStepManager {
}
})
this._parent.event.register('indexChanged', this, (index) => {
this.event.register('indexChanged', this, (index) => {
if (index < 0) return
if (self._parent.currentStepIndex !== index) return
if (self.currentStepIndex !== index) return
self.traceManager.buildCallPath(index, (error, callsPath) => {
if (error) {
@ -137,11 +136,11 @@ class DebuggerStepManager {
// TODO: this is the same currentStepIndex var but currently coupled all the way up to EthDebuggerUI
// the trigger in updateStep is updating it in EthDebuggerUI
// the refactor should remove it
this.parent.breakpointManager.jumpNextBreakpoint(this._parent.currentStepIndex, true)
this.parent.breakpointManager.jumpNextBreakpoint(this.currentStepIndex, true)
}
jumpPreviousBreakpoint () {
this.parent.breakpointManager.jumpPreviousBreakpoint(this._parent.currentStepIndex, true)
this.parent.breakpointManager.jumpPreviousBreakpoint(this.currentStepIndex, true)
}
}

Loading…
Cancel
Save