Commit d0c14614 authored by yann300's avatar yann300 Committed by ioedeveloper

check is ast present

parent 075867a5
......@@ -32,6 +32,10 @@ module.exports = class CompilerAbstract {
getSourceName (fileIndex) {
if (this.data && this.data.sources) {
return Object.keys(this.data.sources)[fileIndex]
} else if (Object.keys(this.source.sources).length === 1) {
// if we don't have ast, we return the only one filename present.
const sourcesArray = Object.keys(this.source.sources)
return sourcesArray[0]
}
return null
}
......
......@@ -19,6 +19,11 @@ export class OffsetToLineColumnConverter extends Plugin {
offsetToLineColumn (rawLocation, file, sources, asts) {
if (!this.lineBreakPositionsByContent[file]) {
const sourcesArray = Object.keys(sources)
if (!asts && file === 0 && sourcesArray.length === 1) {
// if we don't have ast, we process the only one available content
this.lineBreakPositionsByContent[file] = this.sourceMappingDecoder.getLinebreakPositions(sources[sourcesArray[0]].content)
} else {
for (var filename in asts) {
var source = asts[filename]
if (source.id === file) {
......@@ -27,6 +32,7 @@ export class OffsetToLineColumnConverter extends Plugin {
}
}
}
}
return this.sourceMappingDecoder.convertOffsetToLineColumn(rawLocation, this.lineBreakPositionsByContent[file])
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment