Skip to content

Commit 689f383

Browse files
Added comments for 'emitNodeWorker'.
1 parent 5ae26e1 commit 689f383

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/compiler/emitter.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4842,22 +4842,29 @@ var __param = this.__param || function(index, decorator) { return function (targ
48424842
}
48434843

48444844
if (node.flags & NodeFlags.Ambient) {
4845-
return emitOnlyPinnedOrTripleSlashComments(node);
4845+
emitOnlyPinnedOrTripleSlashComments(node);
4846+
return;
48464847
}
48474848

4849+
// Emitting on a SourceFile is a special case; there is not necessarily
4850+
// a corresponding start/end we're interested in, and comments will be
4851+
// emitted for the end-of-file
48484852
if (node.kind === SyntaxKind.SourceFile) {
48494853
if (shouldEmitSourceMap) {
48504854
emitSourceFileStart(<SourceFile>node);
48514855
}
4852-
return emitJavaScriptWorker(node, allowGeneratedIdentifiers);
4856+
emitJavaScriptWorker(node, allowGeneratedIdentifiers);
4857+
return;
48534858
}
48544859

48554860
let emitComments = shouldEmitLeadingAndTrailingComments(node);
48564861
if (emitComments) {
48574862
emitLeadingComments(node);
48584863
}
48594864

4860-
if (!nodeIsSynthesized(node) && shouldEmitSourceMap) {
4865+
// Only track sourcemaps on *parsed* nodes when requested.
4866+
// Synthesized nodes do not correspond to text in the original source.
4867+
if (shouldEmitSourceMap && !nodeIsSynthesized(node)) {
48614868
emitStart(node);
48624869
emitJavaScriptWorker(node, allowGeneratedIdentifiers);
48634870
emitEnd(node);

0 commit comments

Comments
 (0)