1
1
mirror of https://github.com/github/semantic.git synced 2024-11-29 02:44:36 +03:00

Call into splitAbstractedTerm directly for replacements.

This commit is contained in:
Rob Rix 2016-03-03 11:33:49 -05:00
parent 88732315da
commit a649b59eac

View File

@ -51,7 +51,8 @@ splitPatchByLines patch previous sources = case patch of
Delete term -> let (lines, range) = splitTermByLines term (fst sources) 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 $ splitTermByLines <$> both leftTerm rightTerm <*> sources
where (lines, ranges) = transpose $ split <$> sources <*> both leftTerm rightTerm
split = splitAbstractedTerm copoint unwrap (:<)
splitAbstractedTerm :: (term -> Info) -> (term -> Syntax leaf term) -> (Info -> Syntax leaf term -> term) -> Source Char -> term -> ([Line term], Range)
splitAbstractedTerm getInfo getSyntax makeTerm source term = flip (,) (characterRange (getInfo term)) $ case getSyntax term of