(text, options, decoratedComments, commentIndex)
| 286 | } |
| 287 | |
| 288 | function isEndOfLineComment(text, options, decoratedComments, commentIndex) { |
| 289 | const { comment, followingNode } = decoratedComments[commentIndex]; |
| 290 | const { locStart, locEnd } = options; |
| 291 | let end = locEnd(comment); |
| 292 | |
| 293 | if (followingNode) { |
| 294 | // Find last comment on the same line |
| 295 | for ( |
| 296 | let index = commentIndex + 1; |
| 297 | index < decoratedComments.length; |
| 298 | index++ |
| 299 | ) { |
| 300 | const { comment, followingNode: currentCommentFollowingNode } = |
| 301 | decoratedComments[index]; |
| 302 | if ( |
| 303 | currentCommentFollowingNode !== followingNode || |
| 304 | !isAllEmptyAndNoLineBreak(text.slice(end, locStart(comment))) |
| 305 | ) { |
| 306 | break; |
| 307 | } |
| 308 | end = locEnd(comment); |
| 309 | } |
| 310 | } |
| 311 | |
| 312 | return hasNewline(text, end); |
| 313 | } |
| 314 | |
| 315 | function breakTies(tiesToBreak, options) { |
| 316 | const tieCount = tiesToBreak.length; |
no test coverage detected
searching dependent graphs…