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

Function emitLeadingComments

test/fixtures/snapshot/typescript.js:114854–114875  ·  view source on GitHub ↗
(pos, isEmittedNode)

Source from the content-addressed store, hash-verified

114852 return prevNodeIndex !== undefined && prevNodeIndex > -1 && parentNodeArray.indexOf(nextNode) === prevNodeIndex + 1;
114853 }
114854 function emitLeadingComments(pos, isEmittedNode) {
114855 hasWrittenComment = false;
114856 if (isEmittedNode) {
114857 if (pos === 0 && (currentSourceFile === null || currentSourceFile === void 0 ? void 0 : currentSourceFile.isDeclarationFile)) {
114858 forEachLeadingCommentToEmit(pos, emitNonTripleSlashLeadingComment);
114859 }
114860 else {
114861 forEachLeadingCommentToEmit(pos, emitLeadingComment);
114862 }
114863 }
114864 else if (pos === 0) {
114865 // If the node will not be emitted in JS, remove all the comments(normal, pinned and ///) associated with the node,
114866 // unless it is a triple slash comment at the top of the file.
114867 // For Example:
114868 // /// <reference-path ...>
114869 // declare var x;
114870 // /// <reference-path ...>
114871 // interface F {}
114872 // The first /// will NOT be removed while the second one will be removed even though both node will not be emitted
114873 forEachLeadingCommentToEmit(pos, emitTripleSlashLeadingComment);
114874 }
114875 }
114876 function emitTripleSlashLeadingComment(commentPos, commentEnd, kind, hasTrailingNewLine, rangePos) {
114877 if (isTripleSlashComment(commentPos, commentEnd)) {
114878 emitLeadingComment(commentPos, commentEnd, kind, hasTrailingNewLine, rangePos);

Callers 3

Calls 1

Tested by

no test coverage detected