Unverified Commit a7fb57d5 authored by yann300's avatar yann300 Committed by GitHub

remove use of currentStepIndex

parent dcbb37f5
...@@ -28,8 +28,8 @@ class BreakpointManager { ...@@ -28,8 +28,8 @@ class BreakpointManager {
* @param {Bool} defaultToLimit - if true jump to the end of the trace if no more breakpoint found * @param {Bool} defaultToLimit - if true jump to the end of the trace if no more breakpoint found
* *
*/ */
async jumpNextBreakpoint (defaultToLimit) { async jumpNextBreakpoint (fromStep, defaultToLimit) {
this.jump(1, defaultToLimit) this.jump(fromStep || 0, 1, defaultToLimit)
} }
/** /**
...@@ -37,8 +37,8 @@ class BreakpointManager { ...@@ -37,8 +37,8 @@ class BreakpointManager {
* @param {Bool} defaultToLimit - if true jump to the start of the trace if no more breakpoint found * @param {Bool} defaultToLimit - if true jump to the start of the trace if no more breakpoint found
* *
*/ */
async jumpPreviousBreakpoint (defaultToLimit) { async jumpPreviousBreakpoint (fromStep, defaultToLimit) {
this.jump(-1, defaultToLimit) this.jump(fromStep || 0, -1, defaultToLimit)
} }
/** /**
...@@ -47,7 +47,7 @@ class BreakpointManager { ...@@ -47,7 +47,7 @@ class BreakpointManager {
* @param {Bool} defaultToLimit - if true jump to the limit (end if direction is 1, beginning if direction is -1) of the trace if no more breakpoint found * @param {Bool} defaultToLimit - if true jump to the limit (end if direction is 1, beginning if direction is -1) of the trace if no more breakpoint found
* *
*/ */
async jump (direction, defaultToLimit) { async jump (fromStep, direction, defaultToLimit) {
if (!this.locationToRowConverter) { if (!this.locationToRowConverter) {
console.log('row converter not provided') console.log('row converter not provided')
return return
...@@ -67,15 +67,15 @@ class BreakpointManager { ...@@ -67,15 +67,15 @@ class BreakpointManager {
sourceLocation.start + sourceLocation.length >= previousSourceLocation.start + previousSourceLocation.length)) { sourceLocation.start + sourceLocation.length >= previousSourceLocation.start + previousSourceLocation.length)) {
return false return false
} else { } else {
self.debugger.stepManager.jumpTo(currentStep) if (self.debugger.stepManager) self.debugger.stepManager.jumpTo(currentStep)
self.event.trigger('breakpointHit', [sourceLocation]) self.event.trigger('breakpointHit', [sourceLocation, currentStep])
return true return true
} }
} }
var sourceLocation var sourceLocation
var previousSourceLocation var previousSourceLocation
var currentStep = this.debugger.currentStepIndex + direction var currentStep = fromStep + direction
var lineHadBreakpoint = false var lineHadBreakpoint = false
while (currentStep > 0 && currentStep < this.debugger.traceManager.trace.length) { while (currentStep > 0 && currentStep < this.debugger.traceManager.trace.length) {
try { try {
...@@ -105,7 +105,8 @@ class BreakpointManager { ...@@ -105,7 +105,8 @@ class BreakpointManager {
} }
currentStep += direction currentStep += direction
} }
if (defaultToLimit) { this.event.trigger('NoBreakpointHit', [])
if (this.debugger.stepManager && defaultToLimit) {
if (direction === -1) { if (direction === -1) {
this.debugger.stepManager.jumpTo(0) this.debugger.stepManager.jumpTo(0)
} else if (direction === 1) { } else if (direction === 1) {
......
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