(getLineDifference)
| 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. |
| 114222 | ts.Debug.assert(!!preserveSourceNewlines); |
| 114223 | // We start by measuring the line difference from a position to its adjacent comments, |
| 114224 | // so that this is counted as a one-line difference, not two: |
| 114225 | // |
| 114226 | // node1; |
| 114227 | // // NODE2 COMMENT |
| 114228 | // node2; |
| 114229 | var lines = getLineDifference(/*includeComments*/ true); |
| 114230 | if (lines === 0) { |
| 114231 | // However, if the line difference considering comments was 0, we might have this: |
| 114232 | // |
| 114233 | // node1; // NODE2 COMMENT |
| 114234 | // node2; |
| 114235 | // |
| 114236 | // in which case we should be ignoring node2's comment, so this too is counted as |
| 114237 | // a one-line difference, not zero. |
| 114238 | return getLineDifference(/*includeComments*/ false); |
| 114239 | } |
| 114240 | return lines; |
| 114241 | } |
| 114242 | function writeLineSeparatorsAndIndentBefore(node, parent) { |
| 114243 | var leadingNewlines = preserveSourceNewlines && getLeadingLineTerminatorCount(parent, [node], 0 /* ListFormat.None */); |
| 114244 | if (leadingNewlines) { |
no test coverage detected