1
1
mirror of https://github.com/github/semantic.git synced 2024-12-22 14:21:31 +03:00

🔥 mask.

This commit is contained in:
Rob Rix 2016-04-14 12:46:25 -04:00
parent 1656f93f65
commit 8c9a9c7586

View File

@ -167,16 +167,6 @@ catThese as = maybe (Join (These [] [])) Join $ getUnion $ mconcat $ Union . Jus
pairRangesWithLine :: Monoid b => Join These a -> Join These b -> Join These (a, b)
pairRangesWithLine headRanges childLine = fromMaybe (flip (,) mempty <$> headRanges) $ (,) <$> headRanges `applyThese` childLine
mask :: Join These a -> Join These b -> Join These b
mask (Join (This _)) (Join (This b1)) = Join $ This b1
mask (Join (This _)) (Join (These b1 _)) = Join $ This b1
mask (Join (That _)) (Join (That b2)) = Join $ That b2
mask (Join (That _)) (Join (These _ b2)) = Join $ That b2
mask (Join (These _ _)) (Join (This b1)) = Join $ This b1
mask (Join (These _ _)) (Join (That b2)) = Join $ That b2
mask (Join (These _ _)) (Join (These b1 b2)) = Join $ These b1 b2
mask _ b = b
getRange :: SplitDiff leaf Info -> Range
getRange (Free (Annotated (Info range _) _)) = range
getRange (Pure patch) | Info range _ :< _ <- getSplitTerm patch = range