Skip to content
This repository has been archived by the owner on Mar 3, 2021. It is now read-only.

Commit

Permalink
make sure compilation result fn is used with await && check for `nu…
Browse files Browse the repository at this point in the history
…ll` returns
  • Loading branch information
yann300 authored and Aniket-Engg committed Apr 27, 2020
1 parent 042377b commit d833c97
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions remix-debug/src/debugger/debugger.js
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion remix-lib/src/code/breakpointManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d833c97

Please sign in to comment.