mirror of
https://github.com/github/semantic.git
synced 2025-01-02 20:41:38 +03:00
Skip empty children.
This commit is contained in:
parent
cfe15a5afa
commit
d148286cc0
@ -170,9 +170,12 @@ headRangesOf :: Both [Range] -> Maybe (Join These Range)
|
||||
headRangesOf ranges = sequenceL (listToMaybe <$> Join (runBothWith These ranges))
|
||||
|
||||
linesOf :: (Copointed c, Functor c) => (term -> Range) -> [c [Join These term]] -> Both [Range] -> [Join These (Range, [c term])]
|
||||
linesOf getRange children ranges = let (intersections, remaining) = alignChildren getRange children headRanges
|
||||
Just headRanges = headRangesOf ranges
|
||||
joined = Join (runBothWith These intersections) in
|
||||
linesOf getRange children ranges
|
||||
| (first:rest) <- children
|
||||
, null (copoint first) = linesOf getRange rest ranges
|
||||
| otherwise = let (intersections, remaining) = alignChildren getRange children headRanges
|
||||
Just headRanges = headRangesOf ranges
|
||||
joined = Join (runBothWith These intersections) in
|
||||
fromJust ((,) <$> headRanges `applyThese` joined) : linesOf getRange remaining (modifyJoin (uncurry bimap (advancePast (sequenceL (fmap copoint <$> joined)))) ranges)
|
||||
|
||||
-- | Given a list of aligned children, produce lists of their intersecting first lines, and a list of the remaining lines/nonintersecting first lines.
|
||||
|
Loading…
Reference in New Issue
Block a user