mirror of
https://github.com/github/semantic.git
synced 2024-12-01 09:15:01 +03:00
Generalize term
to distinct inTerm
and outTerm
types.
This commit is contained in:
parent
edc3e16e97
commit
c6a8aa2593
@ -54,7 +54,7 @@ splitPatchByLines patch previous sources = case patch of
|
||||
where (lines, ranges) = transpose $ splitAbstractedTerm copoint unwrap (:<) <$> sources <*> both leftTerm rightTerm
|
||||
|
||||
-- | Split a `term` (abstracted by two destructors and one constructor) up into one `term` per line in `Source`.
|
||||
splitAbstractedTerm :: (term -> Info) -> (term -> Syntax leaf term) -> (Info -> Syntax leaf term -> term) -> Source Char -> term -> ([Line term], Range)
|
||||
splitAbstractedTerm :: (inTerm -> Info) -> (inTerm -> Syntax leaf inTerm) -> (Info -> Syntax leaf outTerm -> outTerm) -> Source Char -> inTerm -> ([Line outTerm], Range)
|
||||
splitAbstractedTerm getInfo getSyntax makeTerm source term = flip (,) (characterRange (getInfo term)) $ case getSyntax term of
|
||||
Leaf a -> pure . (`makeTerm` Leaf a) . (`Info` (Diff.categories (getInfo term))) <$> actualLineRanges (characterRange (getInfo term)) source
|
||||
Indexed children -> adjoinChildLines (Indexed . fmap copoint) (Identity <$> children)
|
||||
|
Loading…
Reference in New Issue
Block a user