remove use of currentStepIndex

pull/3094/head
yann300 7 years ago committed by GitHub
parent 99e96be875
commit 525a133bf6
  1. 19
      remix-core/src/code/breakpointManager.js

@ -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 {
* @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 {
* @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 {
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 {
} }
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) {

Loading…
Cancel
Save