Commit e4e1f8a5 authored by Iuri Matias's avatar Iuri Matias

remove jumptocallback from breakpoint manager

parent 7f4b79ef
...@@ -15,13 +15,12 @@ class BreakpointManager { ...@@ -15,13 +15,12 @@ class BreakpointManager {
* @param {Object} _debugger - type of EthDebugger * @param {Object} _debugger - type of EthDebugger
* @return {Function} _locationToRowConverter - function implemented by editor which return a column/line position for a char source location * @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.event = new EventManager()
this.debugger = _debugger this.debugger = _debugger
this.breakpoints = {} this.breakpoints = {}
this.locationToRowConverter = _locationToRowConverter this.locationToRowConverter = _locationToRowConverter
this.previousLine this.previousLine
this.jumpToCallback = _jumpToCallback || (() => {}) // eslint-disable-line
} }
/** /**
...@@ -68,7 +67,7 @@ class BreakpointManager { ...@@ -68,7 +67,7 @@ class BreakpointManager {
sourceLocation.start + sourceLocation.length >= previousSourceLocation.start + previousSourceLocation.length)) { sourceLocation.start + sourceLocation.length >= previousSourceLocation.start + previousSourceLocation.length)) {
return false return false
} }
self.jumpToCallback(currentStep) self.event.trigger('breakpointStep', [currentStep])
self.event.trigger('breakpointHit', [sourceLocation, currentStep]) self.event.trigger('breakpointHit', [sourceLocation, currentStep])
return true return true
} }
...@@ -108,9 +107,9 @@ class BreakpointManager { ...@@ -108,9 +107,9 @@ class BreakpointManager {
return return
} }
if (direction === -1) { if (direction === -1) {
this.jumpToCallback(0) this.event.trigger('breakpointStep', [0])
} else if (direction === 1) { } 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) { ...@@ -25,8 +25,10 @@ function Debugger (options) {
const compilationResult = await this.compilationResult() const compilationResult = await this.compilationResult()
if (!compilationResult) return { start: null, end: null } if (!compilationResult) return { start: null, end: null }
return this.offsetToLineColumnConverter.offsetToLineColumn(sourceLocation, sourceLocation.file, compilationResult.source.sources, compilationResult.data.sources) 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) this.debugger.setBreakpointManager(this.breakPointManager)
...@@ -38,10 +40,6 @@ function Debugger (options) { ...@@ -38,10 +40,6 @@ function Debugger (options) {
this.debugger.event.register('traceUnloaded', this, () => { this.debugger.event.register('traceUnloaded', this, () => {
this.event.trigger('debuggerStatus', [false]) this.event.trigger('debuggerStatus', [false])
}) })
this.event.register('breakpointStep', (step) => {
this.step_manager.jumpTo(step)
})
} }
Debugger.prototype.registerAndHighlightCodeItem = async function (index) { Debugger.prototype.registerAndHighlightCodeItem = async function (index) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment