From 021c63f1c365c54b6c061d8e4fd0c5cd9f796fa9 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Fri, 11 Jan 2019 12:24:33 -0800 Subject: [PATCH] Use the SourceMapSource to get line and column instead of current source file Fixes #29300 --- src/compiler/emitter.ts | 2 +- .../reference/customTransforms/sourceMapExternalSourceFiles.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 9c09ed79a77..0afd8ee761c 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -4389,7 +4389,7 @@ namespace ts { return; } - const { line: sourceLine, character: sourceCharacter } = getLineAndCharacterOfPosition(currentSourceFile!, pos); + const { line: sourceLine, character: sourceCharacter } = getLineAndCharacterOfPosition(sourceMapSource, pos); sourceMapGenerator!.addMapping( writer.getLine(), writer.getColumn(), diff --git a/tests/baselines/reference/customTransforms/sourceMapExternalSourceFiles.js b/tests/baselines/reference/customTransforms/sourceMapExternalSourceFiles.js index 69406cfe308..7191d615fc6 100644 --- a/tests/baselines/reference/customTransforms/sourceMapExternalSourceFiles.js +++ b/tests/baselines/reference/customTransforms/sourceMapExternalSourceFiles.js @@ -1,5 +1,5 @@ // [source.js.map] -{"version":3,"file":"source.js","sourceRoot":"","sources":["source.ts","another.html"],"names":[],"mappings":"AAAA,iCACyB,CAAA;ACDzB,QACE,CDCM"} +{"version":3,"file":"source.js","sourceRoot":"","sources":["source.ts","another.html"],"names":[],"mappings":"AAAA,iCACyB,CAAA;ACDzB,QAAS,CDED"} // [source.js] "multi\n line";