mirror of
https://github.com/github/semantic.git
synced 2024-12-21 13:51:44 +03:00
Map patches to ToC summaries without a second pass.
This commit is contained in:
parent
03fc463c5c
commit
9750fa35ec
@ -90,11 +90,10 @@ diffTOC blobs diff = removeDupes (diffToTOCSummaries (source <$> blobs) diff) >>
|
||||
(_, _) -> False
|
||||
|
||||
diffToTOCSummaries :: HasDefaultFields fields => Both Source -> Diff (Syntax Text) (Record fields) -> [TOCSummary DiffInfo]
|
||||
diffToTOCSummaries sources = para $ \diff -> case first (toTOCSummaries . runBothWith mapPatch toInfo) diff of
|
||||
diffToTOCSummaries sources = para $ \diff -> case diff of
|
||||
Free (annotations :< syntax) -> toList diff >>= \ summaries ->
|
||||
fmap (contextualize (Both.snd sources) (Both.snd annotations :< fmap fst syntax)) (snd summaries)
|
||||
Pure summaries -> summaries
|
||||
where toInfo = termToDiffInfo <$> sources
|
||||
Pure patch -> toTOCSummaries $ runBothWith mapPatch (termToDiffInfo <$> sources) patch
|
||||
|
||||
contextualize source (annotation :< syntax) summary
|
||||
| Nothing <- parentInfo summary
|
||||
|
Loading…
Reference in New Issue
Block a user