diff --git a/lib/sourcemap.js b/lib/sourcemap.js index 2feec45d..72c4709a 100644 --- a/lib/sourcemap.js +++ b/lib/sourcemap.js @@ -70,12 +70,27 @@ function SourceMap(options) { return { add: function(source, gen_line, gen_col, orig_line, orig_col, name) { var map = maps && maps[source]; + var generatedPos = { + line: gen_line + options.dest_line_diff, + column: gen_col + }; if (map) { var info = map.originalPositionFor({ line: orig_line, column: orig_col }); - if (info.source === null) return; + if (info.source === null) { + if (generatedPos.column !== 0) { + generator. + generator.addMapping({ + generated: generatedPos, + original: null, + source: null, + name: null + }); + } + return; + } source = info.source; orig_line = info.line; orig_col = info.column; @@ -84,10 +99,7 @@ function SourceMap(options) { generator.addMapping({ name: name, source: source, - generated: { - line: gen_line + options.dest_line_diff, - column: gen_col - }, + generated: generatedPos, original: { line: orig_line + options.orig_line_diff, column: orig_col diff --git a/test/input/pr-3040/expect.js b/test/input/pr-3040/expect.js index b911f3f8..1b8674eb 100644 --- a/test/input/pr-3040/expect.js +++ b/test/input/pr-3040/expect.js @@ -1,2 +1,2 @@ function _toConsumableArray(arr){if(Array.isArray(arr)){for(var i=0,arr2=Array(arr.length);i