microstudio icon indicating copy to clipboard operation
microstudio copied to clipboard

Javascript language give incorrect line number for syntax errors

Open desean1625 opened this issue 9 months ago • 0 comments

The following code give the line number of the runner, not the program.

const TEST = {
broken:()=>{,
}

You can get the correct line number by running the program in a webworker like this.

let blob = new Blob([program])
let url = URL.createObjectURL(blob)
w = new Worker(url)
w.onerror = (e)=>{
  this.microvm.context.location = {
    token: {
      line: e.lineNumber,
      column: e.columnNumber
    }
  };
}

desean1625 avatar Sep 21 '23 13:09 desean1625