MCPcopy Index your code
hub / github.com/nodejs/node / emitLeadingComment

Function emitLeadingComment

test/fixtures/snapshot/typescript.js:114892–114909  ·  view source on GitHub ↗
(commentPos, commentEnd, kind, hasTrailingNewLine, rangePos)

Source from the content-addressed store, hash-verified

114890 return true;
114891 }
114892 function emitLeadingComment(commentPos, commentEnd, kind, hasTrailingNewLine, rangePos) {
114893 if (!currentSourceFile || !shouldWriteComment(currentSourceFile.text, commentPos))
114894 return;
114895 if (!hasWrittenComment) {
114896 ts.emitNewLineBeforeLeadingCommentOfPosition(getCurrentLineMap(), writer, rangePos, commentPos);
114897 hasWrittenComment = true;
114898 }
114899 // Leading comments are emitted at /*leading comment1 */space/*leading comment*/space
114900 emitPos(commentPos);
114901 ts.writeCommentRange(currentSourceFile.text, getCurrentLineMap(), writer, commentPos, commentEnd, newLine);
114902 emitPos(commentEnd);
114903 if (hasTrailingNewLine) {
114904 writer.writeLine();
114905 }
114906 else if (kind === 3 /* SyntaxKind.MultiLineCommentTrivia */) {
114907 writer.writeSpace(" ");
114908 }
114909 }
114910 function emitLeadingCommentsOfPosition(pos) {
114911 if (commentsDisabled || pos === -1) {
114912 return;

Callers 2

Calls 3

shouldWriteCommentFunction · 0.85
getCurrentLineMapFunction · 0.85
emitPosFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…