track end of node positions for sourcemaps - fixes douglasduteil/isparta#8
This commit is contained in:
@@ -190,7 +190,7 @@ CodeGenerator.prototype.print = function (node, parent, opts) {
|
||||
newline(true);
|
||||
|
||||
if (opts.before) opts.before();
|
||||
this.map.mark(node);
|
||||
this.map.mark(node, "start");
|
||||
|
||||
this[node.type](node, this.buildPrint(node), parent);
|
||||
|
||||
@@ -200,6 +200,7 @@ CodeGenerator.prototype.print = function (node, parent, opts) {
|
||||
}
|
||||
if (needsParens) this.push(")");
|
||||
|
||||
this.map.mark(node, "end");
|
||||
if (opts.after) opts.after();
|
||||
|
||||
newline(false);
|
||||
|
||||
@@ -30,7 +30,7 @@ SourceMap.prototype.get = function () {
|
||||
}
|
||||
};
|
||||
|
||||
SourceMap.prototype.mark = function (node) {
|
||||
SourceMap.prototype.mark = function (node, type) {
|
||||
var loc = node.loc;
|
||||
if (!loc) return; // no location info
|
||||
|
||||
@@ -46,7 +46,7 @@ SourceMap.prototype.mark = function (node) {
|
||||
column: position.column
|
||||
};
|
||||
|
||||
var original = loc.start;
|
||||
var original = loc[type];
|
||||
|
||||
map.addMapping({
|
||||
source: this.opts.sourceFileName,
|
||||
|
||||
Reference in New Issue
Block a user