Skip to content

Commit

Permalink
fixed files form Closure #47
Browse files Browse the repository at this point in the history
  • Loading branch information
tdurieux committed Mar 7, 2017
1 parent 3365da9 commit 4e2e6d8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -486,8 +486,8 @@ private OriginalMapping getOriginalMappingForEntry(Entry entry) {
// Adjust the line/column here to be start at 1.
Builder x = OriginalMapping.newBuilder()
.setOriginalFile(sources[entry.getSourceFileId()])
.setLineNumber(entry.getSourceLine())
.setColumnPosition(entry.getSourceColumn());
.setLineNumber(entry.getSourceLine() + 1)
.setColumnPosition(entry.getSourceColumn() + 1);
if (entry.getNameId() != UNMAPPED) {
x.setIdentifier(names[entry.getNameId()]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,15 @@ public void addMapping(
// zero based.
// We don't change this for the v1 or v2 source maps but for
// v3 we make them both 0 based.
int lineBaseOffset = 1;
if (generator instanceof SourceMapGeneratorV1
|| generator instanceof SourceMapGeneratorV2) {
lineBaseOffset = 0;
}

generator.addMapping(
sourceFile, originalName,
new FilePosition(node.getLineno(), node.getCharno()),
new FilePosition(node.getLineno() - lineBaseOffset, node.getCharno()),
outputStartPosition, outputEndPosition);
}

Expand Down

0 comments on commit 4e2e6d8

Please sign in to comment.