1
1
mirror of https://github.com/github/semantic.git synced 2025-01-03 13:02:37 +03:00

Extract advanceLeft/advanceRight to top level.

This commit is contained in:
Rob Rix 2016-04-01 10:40:39 -04:00
parent f1b2308405
commit 410a3044f9

View File

@ -153,16 +153,20 @@ group2 ranges children | Just (headRanges, tailRanges) <- unconsThese ranges
_ -> (tailRanges, children, [ flip (,) [] <$> headRanges ])
| ([]:rest) <- children = group2 ranges rest
| otherwise = (ranges, children, [])
where advanceLeft (Join (These (_:as) bs)) = Join (These as bs)
advanceLeft (Join (This (_:as))) = Join (This as)
advanceLeft other = other
advanceRight (Join (These as (_:bs))) = Join (These as bs)
advanceRight (Join (That (_:bs))) = Join (That bs)
advanceRight other = other
pairRangesWithLine headRanges childLine = case (,) <$> headRanges `applyThese` childLine of
where pairRangesWithLine headRanges childLine = case (,) <$> headRanges `applyThese` childLine of
Just v -> v
Nothing -> error "oh god no"
advanceLeft :: Join These [a] -> Join These [a]
advanceLeft (Join (These (_:as) bs)) = Join (These as bs)
advanceLeft (Join (This (_:as))) = Join (This as)
advanceLeft other = other
advanceRight :: Join These [a] -> Join These [a]
advanceRight (Join (These as (_:bs))) = Join (These as bs)
advanceRight (Join (That (_:bs))) = Join (That bs)
advanceRight other = other
{-
find all of the lines which intersect with this child, not all the children intersecting with this line?