Skip to content

Commit 0636a06

Browse files
committed
Fix the new sourceMapRecording correctly if the multiple files output to single js file and the file ends with interface definition
1 parent 4ba7446 commit 0636a06

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/compiler/emitter.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,6 @@ module ts {
194194
* @param emitFn if given will be invoked to emit the text instead of actual token emit */
195195
var emitToken = emitTokenText;
196196

197-
/** Called to notify start of new source file emit */
198-
var emitNewSourceFileStart = function (node: SourceFile) { }
199-
200197
/** Called to before starting the lexical scopes as in function/class in the emitted code because of node
201198
* @param scopeDeclaration node that starts the lexical scope
202199
* @param scopeName Optional name of this scope instead of deducing one from the declaration node */
@@ -322,8 +319,9 @@ module ts {
322319
if (!lastRecordedSourceMapSpan ||
323320
lastRecordedSourceMapSpan.emittedLine != emittedLine ||
324321
lastRecordedSourceMapSpan.emittedColumn != emittedColumn ||
325-
lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line ||
326-
(lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character)) {
322+
(lastRecordedSourceMapSpan.sourceIndex === sourceMapSourceIndex &&
323+
(lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line ||
324+
(lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character)))) {
327325
// Encode the last recordedSpan before assigning new
328326
encodeLastRecordedSourceMapSpan();
329327

@@ -341,6 +339,7 @@ module ts {
341339
// Take the new pos instead since there is no change in emittedLine and column since last location
342340
lastRecordedSourceMapSpan.sourceLine = sourceLinePos.line;
343341
lastRecordedSourceMapSpan.sourceColumn = sourceLinePos.character;
342+
lastRecordedSourceMapSpan.sourceIndex = sourceMapSourceIndex;
344343
}
345344
}
346345

@@ -510,7 +509,6 @@ module ts {
510509
emitStart = recordEmitNodeStartSpan;
511510
emitEnd = recordEmitNodeEndSpan;
512511
emitToken = writeTextWithSpanRecord;
513-
emitNewSourceFileStart = recordNewSourceFileStart;
514512
scopeEmitStart = recordScopeNameOfNode;
515513
scopeEmitEnd = recordScopeNameEnd;
516514
}

0 commit comments

Comments
 (0)