1
1
mirror of https://github.com/github/semantic.git synced 2024-12-23 06:41:45 +03:00

Use modifyJoin to compute range/child intersections.

This commit is contained in:
Rob Rix 2016-03-24 14:02:40 -04:00
parent 71e53fd4ff
commit 4c132d0c2d

View File

@ -135,7 +135,7 @@ groupChildrenByLine :: Join These [Range] -> [AlignedDiff leaf] -> [Join These (
groupChildrenByLine ranges children = go (fromThese [] [] $ runJoin ranges) children
where go ranges children | (l:ls, r:rs) <- ranges
, ((firstLine:restOfLines):rest) <- children
= if and $ Join $ bimap (intersects l . getRange) (intersects r . getRange) (runJoin firstLine)
= if and $ modifyJoin (bimap (intersects l . getRange) (intersects r . getRange)) firstLine
then modifyJoin (bimap ((,) l . pure) ((,) r . pure)) firstLine : go ranges (restOfLines:rest)
else Join (These (l, []) (r, [])) : go (ls, rs) children
| ([]:rest) <- children = go ranges rest