mirror of
https://github.com/github/semantic.git
synced 2024-11-29 02:44:36 +03:00
Unwrap Maybes into the correct ranges for either side.
This commit is contained in:
parent
c59913da98
commit
26abb3da7f
@ -51,7 +51,7 @@ splitPatchByLines patch previous sources = case patch of
|
||||
Delete term -> let (lines, range) = splitAbstractedTerm copoint unwrap (:<) (fst sources) term in
|
||||
(flip makeRow EmptyLine . fmap (Pure . SplitDelete) <$> lines, both range (rangeAt $ snd previous))
|
||||
Replace leftTerm rightTerm -> (zipWithDefaults makeRow (pure mempty) $ fmap (fmap (Pure . SplitReplace)) <$> lines, ranges)
|
||||
where (lines, ranges) = transpose $ maybe ([], Range 0 0) . splitAbstractedTerm copoint unwrap (:<) <$> sources <*> unPatch patch
|
||||
where (lines, ranges) = transpose $ maybe . (,) [] . rangeAt <$> previous <*> (splitAbstractedTerm copoint unwrap (:<) <$> sources) <*> unPatch patch
|
||||
|
||||
-- | Split an `inTerm` (abstracted by two destructors) up into one `outTerm` (abstracted by a constructor) per line in `Source`.
|
||||
splitAbstractedTerm :: (inTerm -> Info) -> (inTerm -> Syntax leaf inTerm) -> (Info -> Syntax leaf outTerm -> outTerm) -> Source Char -> inTerm -> ([Line outTerm], Range)
|
||||
|
Loading…
Reference in New Issue
Block a user