remove jumptocallback from breakpoint manager

refactor_remix_debug5_ab
Iuri Matias 4 years ago
parent 7f4b79ef6f
commit e4e1f8a52d
  1. 9
      libs/remix-debug/src/code/breakpointManager.js
  2. 10
      libs/remix-debug/src/debugger/debugger.js

@ -15,13 +15,12 @@ class BreakpointManager {
* @param {Object} _debugger - type of EthDebugger
* @return {Function} _locationToRowConverter - function implemented by editor which return a column/line position for a char source location
*/
constructor (_debugger, _locationToRowConverter, _jumpToCallback) {
constructor (_debugger, _locationToRowConverter) {
this.event = new EventManager()
this.debugger = _debugger
this.breakpoints = {}
this.locationToRowConverter = _locationToRowConverter
this.previousLine
this.jumpToCallback = _jumpToCallback || (() => {}) // eslint-disable-line
}
/**
@ -68,7 +67,7 @@ class BreakpointManager {
sourceLocation.start + sourceLocation.length >= previousSourceLocation.start + previousSourceLocation.length)) {
return false
}
self.jumpToCallback(currentStep)
self.event.trigger('breakpointStep', [currentStep])
self.event.trigger('breakpointHit', [sourceLocation, currentStep])
return true
}
@ -108,9 +107,9 @@ class BreakpointManager {
return
}
if (direction === -1) {
this.jumpToCallback(0)
this.event.trigger('breakpointStep', [0])
} else if (direction === 1) {
this.jumpToCallback(this.debugger.traceManager.trace.length - 1)
this.event.trigger('breakpointStep', [this.debugger.traceManager.trace.length - 1])
}
}

@ -25,8 +25,10 @@ function Debugger (options) {
const compilationResult = await this.compilationResult()
if (!compilationResult) return { start: null, end: null }
return this.offsetToLineColumnConverter.offsetToLineColumn(sourceLocation, sourceLocation.file, compilationResult.source.sources, compilationResult.data.sources)
}, (step) => {
this.event.trigger('breakpointStep', [step])
})
this.breakPointManager.event.register('breakpointStep', (step) => {
this.step_manager.jumpTo(step)
})
this.debugger.setBreakpointManager(this.breakPointManager)
@ -38,10 +40,6 @@ function Debugger (options) {
this.debugger.event.register('traceUnloaded', this, () => {
this.event.trigger('debuggerStatus', [false])
})
this.event.register('breakpointStep', (step) => {
this.step_manager.jumpTo(step)
})
}
Debugger.prototype.registerAndHighlightCodeItem = async function (index) {

Loading…
Cancel
Save