1
1
mirror of https://github.com/github/semantic.git synced 2024-12-23 23:11:50 +03:00

🔥 tearDown.

This commit is contained in:
Rob Rix 2016-03-04 21:13:14 -05:00
parent abcd9803f3
commit 7a1a283402

View File

@ -45,8 +45,7 @@ splitDiffByLines sources = iter (\ (Annotated info syntax) -> (splitAnnotatedByL
-- | Split a patch, which may span multiple lines, into rows of split diffs.
splitPatchByLines :: Both (Source Char) -> Patch (Term leaf Info) -> [Row (SplitDiff leaf Info, Range)]
splitPatchByLines sources patch = zipWithDefaults makeRow (pure mempty) $ fmap (fmap (first (Pure . constructor patch))) <$> lines
where lines = (\ source -> maybe [] $ cata (tearDown source)) <$> sources <*> unPatch patch
tearDown source info syntax = splitAbstractedTerm (:<) source info syntax
where lines = (\ source -> maybe [] $ cata (splitAbstractedTerm (:<) source)) <$> sources <*> unPatch patch
constructor (Replace _ _) = SplitReplace
constructor (Insert _) = SplitInsert
constructor (Delete _) = SplitDelete