make sure compilation result fn is used with `await` && check for `null` returns

pull/5370/head
yann300 5 years ago committed by Aniket
parent ff93f7237e
commit 189713d455
  1. 2
      remix-debug/src/debugger/debugger.js
  2. 2
      remix-lib/src/code/breakpointManager.js

@ -24,6 +24,7 @@ function Debugger (options) {
this.breakPointManager = new remixLib.code.BreakpointManager(this.debugger, async (sourceLocation) => {
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])
@ -49,6 +50,7 @@ Debugger.prototype.registerAndHighlightCodeItem = function (index) {
this.debugger.traceManager.getCurrentCalledAddressAt(index, async (error, address) => {
if (error) return console.log(error)
const compilationResultForAddress = await this.compilationResult(address)
if (!compilationResultForAddress) return
this.debugger.callTree.sourceLocationTracker.getSourceLocationFromVMTraceIndex(address, index, compilationResultForAddress.data.contracts, (error, rawLocation) => {
if (!error && compilationResultForAddress && compilationResultForAddress.data) {
var lineColumnPos = this.offsetToLineColumnConverter.offsetToLineColumn(rawLocation, rawLocation.file, compilationResultForAddress.source.sources, compilationResultForAddress.data.sources)

@ -86,7 +86,7 @@ class BreakpointManager {
console.log('cannot jump to breakpoint ' + e)
return
}
let lineColumn = this.locationToRowConverter(sourceLocation)
let lineColumn = await this.locationToRowConverter(sourceLocation)
if (this.previousLine !== lineColumn.start.line) {
if (direction === -1 && lineHadBreakpoint) { // TODO : improve this when we will build the correct structure before hand
lineHadBreakpoint = false

Loading…
Cancel
Save