1
0
Fork 0
mirror of https://github.com/jashkenas/coffeescript.git synced 2022-11-09 12:23:24 -05:00

removing sourceColumn reset

This commit is contained in:
Jeremy Ashkenas 2013-03-18 21:50:40 +08:00
parent 7f0610d0bd
commit 78d10f30a0
3 changed files with 4 additions and 9 deletions

View file

@ -101,10 +101,7 @@
lastColumn = mapping.column;
buffer += this.encodeVlq(0);
buffer += this.encodeVlq(mapping.sourceLine - lastSourceLine);
if (lastSourceLine !== mapping.sourceLine) {
lastSourceLine = mapping.sourceLine;
lastSourceColumn = 0;
}
lastSourceLine = mapping.sourceLine;
buffer += this.encodeVlq(mapping.sourceColumn - lastSourceColumn);
lastSourceColumn = mapping.sourceColumn;
needComma = true;

View file

@ -108,9 +108,7 @@ The index into the list of sources:
The starting line in the original source, relative to the previous source line.
buffer += @encodeVlq mapping.sourceLine - lastSourceLine
if lastSourceLine isnt mapping.sourceLine
lastSourceLine = mapping.sourceLine
lastSourceColumn = 0
lastSourceLine = mapping.sourceLine
The starting column in the original source, relative to the previous column.

View file

@ -31,8 +31,8 @@ test "SourceMap tests", ->
sourceRoot: "",
sourceFiles: ["source.coffee"],
generatedFile: "source.js"}
eqJson testWithFilenames, '{"version":3,"file":"source.js","sourceRoot":"","sources":["source.coffee"],"names":[],"mappings":"AAAA;;IACK,GAAC,CAAG;IAEA"}'
eqJson map.generate(), '{"version":3,"file":"","sourceRoot":"","sources":[""],"names":[],"mappings":"AAAA;;IACK,GAAC,CAAG;IAEA"}'
eqJson testWithFilenames, '{"version":3,"file":"source.js","sourceRoot":"","sources":["source.coffee"],"names":[],"mappings":"AAAA;;IACK,GAAC,CAAG;IAET"}'
eqJson map.generate(), '{"version":3,"file":"","sourceRoot":"","sources":[""],"names":[],"mappings":"AAAA;;IACK,GAAC,CAAG;IAET"}'
# Look up a generated column - should get back the original source position.
arrayEq map.sourceLocation([2,8]), [1,9]