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

Function getClosingLineTerminatorCount

test/fixtures/snapshot/typescript.js:114194–114218  ·  view source on GitHub ↗
(parentNode, children, format)

Source from the content-addressed store, hash-verified

114192 return format & 1 /* ListFormat.MultiLine */ ? 1 : 0;
114193 }
114194 function getClosingLineTerminatorCount(parentNode, children, format) {
114195 if (format & 2 /* ListFormat.PreserveLines */ || preserveSourceNewlines) {
114196 if (format & 65536 /* ListFormat.PreferNewLine */) {
114197 return 1;
114198 }
114199 var lastChild = ts.lastOrUndefined(children);
114200 if (lastChild === undefined) {
114201 return !parentNode || currentSourceFile && ts.rangeIsOnSingleLine(parentNode, currentSourceFile) ? 0 : 1;
114202 }
114203 if (currentSourceFile && parentNode && !ts.positionIsSynthesized(parentNode.pos) && !ts.nodeIsSynthesized(lastChild) && (!lastChild.parent || lastChild.parent === parentNode)) {
114204 if (preserveSourceNewlines) {
114205 var end_1 = ts.isNodeArray(children) && !ts.positionIsSynthesized(children.end) ? children.end : lastChild.end;
114206 return getEffectiveLines(function (includeComments) { return ts.getLinesBetweenPositionAndNextNonWhitespaceCharacter(end_1, parentNode.end, currentSourceFile, includeComments); });
114207 }
114208 return ts.rangeEndPositionsAreOnSameLine(parentNode, lastChild, currentSourceFile) ? 0 : 1;
114209 }
114210 if (synthesizedNodeStartsOnNewLine(lastChild, format)) {
114211 return 1;
114212 }
114213 }
114214 if (format & 1 /* ListFormat.MultiLine */ && !(format & 131072 /* ListFormat.NoTrailingNewLine */)) {
114215 return 1;
114216 }
114217 return 0;
114218 }
114219 function getEffectiveLines(getLineDifference) {
114220 // If 'preserveSourceNewlines' is disabled, we should never call this function
114221 // because it could be more expensive than alternative approximations.

Callers 3

emitNodeListFunction · 0.85
writeLineSeparatorsAfterFunction · 0.85

Calls 2

getEffectiveLinesFunction · 0.85

Tested by

no test coverage detected