* Returns comments in the range. * @param {Range} range range * @returns {Comment[]} comments in the range
(range)
| 5339 | * @returns {Comment[]} comments in the range |
| 5340 | */ |
| 5341 | getComments(range) { |
| 5342 | const [rangeStart, rangeEnd] = range; |
| 5343 | /** |
| 5344 | * Returns compared. |
| 5345 | * @param {Comment} comment comment |
| 5346 | * @param {number} needle needle |
| 5347 | * @returns {number} compared |
| 5348 | */ |
| 5349 | const compare = (comment, needle) => |
| 5350 | /** @type {Range} */ (comment.range)[0] - needle; |
| 5351 | const comments = /** @type {Comment[]} */ (this.comments); |
| 5352 | let idx = binarySearchBounds.ge(comments, rangeStart, compare); |
| 5353 | /** @type {Comment[]} */ |
| 5354 | const commentsInRange = []; |
| 5355 | while ( |
| 5356 | comments[idx] && |
| 5357 | /** @type {Range} */ (comments[idx].range)[1] <= rangeEnd |
| 5358 | ) { |
| 5359 | commentsInRange.push(comments[idx]); |
| 5360 | idx++; |
| 5361 | } |
| 5362 | |
| 5363 | return commentsInRange; |
| 5364 | } |
| 5365 | |
| 5366 | /** |
| 5367 | * Checks whether this javascript parser is asi position. |
no test coverage detected