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

Function getLinesBetweenNodes

test/fixtures/snapshot/typescript.js:114265–114283  ·  view source on GitHub ↗
(parent, node1, node2)

Source from the content-addressed store, hash-verified

114263 return (format & 65536 /* ListFormat.PreferNewLine */) !== 0;
114264 }
114265 function getLinesBetweenNodes(parent, node1, node2) {
114266 if (ts.getEmitFlags(parent) & 131072 /* EmitFlags.NoIndentation */) {
114267 return 0;
114268 }
114269 parent = skipSynthesizedParentheses(parent);
114270 node1 = skipSynthesizedParentheses(node1);
114271 node2 = skipSynthesizedParentheses(node2);
114272 // Always use a newline for synthesized code if the synthesizer desires it.
114273 if (ts.getStartsOnNewLine(node2)) {
114274 return 1;
114275 }
114276 if (currentSourceFile && !ts.nodeIsSynthesized(parent) && !ts.nodeIsSynthesized(node1) && !ts.nodeIsSynthesized(node2)) {
114277 if (preserveSourceNewlines) {
114278 return getEffectiveLines(function (includeComments) { return ts.getLinesBetweenRangeEndAndRangeStart(node1, node2, currentSourceFile, includeComments); });
114279 }
114280 return ts.rangeEndIsOnSameLineAsRangeStart(node1, node2, currentSourceFile) ? 0 : 1;
114281 }
114282 return 0;
114283 }
114284 function isEmptyBlock(block) {
114285 return block.statements.length === 0
114286 && (!currentSourceFile || ts.rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile));

Callers 5

onOperatorFunction · 0.85
onExitFunction · 0.85
writeLineOrSpaceFunction · 0.85

Calls 2

getEffectiveLinesFunction · 0.85

Tested by

no test coverage detected