diff --git a/lib/6to5/generation/index.js b/lib/6to5/generation/index.js index 77cfaaf683..3c284bf009 100644 --- a/lib/6to5/generation/index.js +++ b/lib/6to5/generation/index.js @@ -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); diff --git a/lib/6to5/generation/source-map.js b/lib/6to5/generation/source-map.js index 0300519d8c..74372c1ba4 100644 --- a/lib/6to5/generation/source-map.js +++ b/lib/6to5/generation/source-map.js @@ -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,