(node, orderedChildren, nodeStats, executableIndex)
| 9691 | } |
| 9692 | |
| 9693 | function segmentChildren(node, orderedChildren, nodeStats, executableIndex) { |
| 9694 | let currentSegment = { |
| 9695 | index: 0, |
| 9696 | owner: node, |
| 9697 | nodes: [], |
| 9698 | min: startingMin(executableIndex), |
| 9699 | max: startingMax(executableIndex), |
| 9700 | }, |
| 9701 | result = [currentSegment], |
| 9702 | lastMax = defaultMax, |
| 9703 | orderedChildSegments = orderChildSegments(orderedChildren) |
| 9704 | |
| 9705 | function isSegmentBoundary(minIndex) { |
| 9706 | return lastMax !== defaultMax && minIndex !== defaultMin && lastMax < minIndex - 1 |
| 9707 | } |
| 9708 | |
| 9709 | for (let i = 0; i < orderedChildSegments.length; i++) { |
| 9710 | const childSegment = orderedChildSegments[i], |
| 9711 | maxIndex = childSegment.max, |
| 9712 | minIndex = childSegment.min |
| 9713 | |
| 9714 | if (isSegmentBoundary(minIndex)) { |
| 9715 | currentSegment = { |
| 9716 | index: result.length, |
| 9717 | owner: node, |
| 9718 | nodes: [], |
| 9719 | min: defaultMin, |
| 9720 | max: defaultMax, |
| 9721 | } |
| 9722 | result.push(currentSegment) |
| 9723 | } |
| 9724 | |
| 9725 | currentSegment.nodes.push(childSegment) |
| 9726 | currentSegment.min = Math.min(currentSegment.min, minIndex) |
| 9727 | currentSegment.max = Math.max(currentSegment.max, maxIndex) |
| 9728 | lastMax = maxIndex |
| 9729 | } |
| 9730 | |
| 9731 | nodeStats.segments = result |
| 9732 | } |
| 9733 | |
| 9734 | function orderChildSegments(children) { |
| 9735 | const specifiedOrder = [], |
no test coverage detected