use initialline instead of previous line

fixCompilationTargets
yann300 4 years ago
parent 658a98dbb4
commit da65262e3c
  1. 12
      libs/remix-debug/src/code/breakpointManager.ts

@ -15,8 +15,7 @@ export class BreakpointManager {
solidityProxy solidityProxy
breakpoints breakpoints
locationToRowConverter locationToRowConverter
previousLine
/** /**
* constructor * constructor
* *
@ -92,22 +91,25 @@ export class BreakpointManager {
let previousSourceLocation let previousSourceLocation
let currentStep = fromStep + direction let currentStep = fromStep + direction
let lineHadBreakpoint = false let lineHadBreakpoint = false
let initialLine
while (currentStep > 0 && currentStep < trace.length) { while (currentStep > 0 && currentStep < trace.length) {
try { try {
previousSourceLocation = sourceLocation previousSourceLocation = sourceLocation
sourceLocation = await this.callTree.extractValidSourceLocation(currentStep) sourceLocation = await this.callTree.extractValidSourceLocation(currentStep)
} catch (e) { } catch (e) {
return console.log('cannot jump to breakpoint ' + e) console.log('cannot jump to breakpoint ' + e)
currentStep += direction
} }
const lineColumn = await this.locationToRowConverter(sourceLocation) const lineColumn = await this.locationToRowConverter(sourceLocation)
if (this.previousLine !== lineColumn.start.line) { if (!initialLine) initialLine = lineColumn
if (initialLine.start.line !== lineColumn.start.line) {
if (direction === -1 && lineHadBreakpoint) { // TODO : improve this when we will build the correct structure before hand if (direction === -1 && lineHadBreakpoint) { // TODO : improve this when we will build the correct structure before hand
lineHadBreakpoint = false lineHadBreakpoint = false
if (this.hitLine(currentStep + 1, previousSourceLocation, sourceLocation, trace)) { if (this.hitLine(currentStep + 1, previousSourceLocation, sourceLocation, trace)) {
return return
} }
} }
this.previousLine = lineColumn.start.line
if (this.hasBreakpointAtLine(sourceLocation.file, lineColumn.start.line)) { if (this.hasBreakpointAtLine(sourceLocation.file, lineColumn.start.line)) {
lineHadBreakpoint = true lineHadBreakpoint = true
if (direction === 1 && this.hitLine(currentStep, sourceLocation, previousSourceLocation, trace)) { if (direction === 1 && this.hitLine(currentStep, sourceLocation, previousSourceLocation, trace)) {

Loading…
Cancel
Save