MCPcopy Create free account
hub / github.com/nodejs/node / emitComments

Function emitComments

test/fixtures/snapshot/typescript.js:18704–18728  ·  view source on GitHub ↗
(text, lineMap, writer, comments, leadingSeparator, trailingSeparator, newLine, writeComment)

Source from the content-addressed store, hash-verified

18702 }
18703 ts.emitNewLineBeforeLeadingCommentOfPosition = emitNewLineBeforeLeadingCommentOfPosition;
18704 function emitComments(text, lineMap, writer, comments, leadingSeparator, trailingSeparator, newLine, writeComment) {
18705 if (comments && comments.length > 0) {
18706 if (leadingSeparator) {
18707 writer.writeSpace(" ");
18708 }
18709 var emitInterveningSeparator = false;
18710 for (var _i = 0, comments_1 = comments; _i < comments_1.length; _i++) {
18711 var comment = comments_1[_i];
18712 if (emitInterveningSeparator) {
18713 writer.writeSpace(" ");
18714 emitInterveningSeparator = false;
18715 }
18716 writeComment(text, lineMap, writer, comment.pos, comment.end, newLine);
18717 if (comment.hasTrailingNewLine) {
18718 writer.writeLine();
18719 }
18720 else {
18721 emitInterveningSeparator = true;
18722 }
18723 }
18724 if (emitInterveningSeparator && trailingSeparator) {
18725 writer.writeSpace(" ");
18726 }
18727 }
18728 }
18729 ts.emitComments = emitComments;
18730 /**
18731 * Detached comment is a comment at the top of file or function body that is separated from

Callers 1

emitDetachedCommentsFunction · 0.85

Calls 1

writeCommentFunction · 0.85

Tested by

no test coverage detected