1
1
mirror of https://github.com/github/semantic.git synced 2024-12-21 13:51:44 +03:00

s/toTOCSummaries/summarize/

This commit is contained in:
Rob Rix 2017-05-08 16:52:03 -04:00
parent a9b7903d8e
commit 48457f13cc

View File

@ -99,7 +99,7 @@ diffTOC blobs diff = removeDupes (diffToTOCSummaries (source <$> blobs) diff) >>
diffToTOCSummaries :: HasDefaultFields fields => Both Source -> Diff (Syntax Text) (Record fields) -> [TOCSummary DiffInfo]
diffToTOCSummaries sources = para $ \diff -> case diff of
Free (annotations :< syntax) -> foldMap (fmap (contextualize (Both.snd sources) (Both.snd annotations :< fmap fst syntax)) . snd) diff
Pure patch -> fmap toTOCSummaries (sequenceA (runBothWith mapPatch (toInfo <$> sources) patch))
Pure patch -> fmap summarize (sequenceA (runBothWith mapPatch (toInfo <$> sources) patch))
toInfo :: HasDefaultFields fields => Source -> Term (Syntax Text) (Record fields) -> [DiffInfo]
toInfo source = para $ \ (annotation :< syntax) -> let termName = toTermName source (cofree (annotation :< (fst <$> syntax))) in case syntax of
@ -110,7 +110,7 @@ diffTOC blobs diff = removeDupes (diffToTOCSummaries (source <$> blobs) diff) >>
S.AnonymousFunction _ _ -> [LeafInfo C.AnonymousFunction termName (sourceSpan annotation)]
_ -> [LeafInfo (category annotation) termName (sourceSpan annotation)]
toTOCSummaries patch = case afterOrBefore patch of
summarize patch = case afterOrBefore patch of
ErrorInfo{..} -> TOCSummary patch Nothing
LeafInfo{..} -> TOCSummary patch $ case leafCategory of
C.Function -> Just $ Summarizable leafCategory termName leafSourceSpan (patchType patch)