1
1
mirror of https://github.com/github/semantic.git synced 2024-12-22 14:21:31 +03:00

Flatten toTOCSummaries.

This commit is contained in:
Rob Rix 2017-05-05 15:33:16 -04:00
parent 948869066c
commit 0ab53b002a

View File

@ -103,15 +103,13 @@ diffTOC blobs diff = removeDupes (diffToTOCSummaries (source <$> blobs) diff) >>
-- Mark which leaves are summarizable. -- Mark which leaves are summarizable.
toTOCSummaries :: Patch DiffInfo -> [TOCSummary DiffInfo] toTOCSummaries :: Patch DiffInfo -> [TOCSummary DiffInfo]
toTOCSummaries patch = toTOCSummaries' patch (afterOrBefore patch) toTOCSummaries patch = case afterOrBefore patch of
where ErrorInfo{..} -> pure $ TOCSummary patch NotSummarizable
toTOCSummaries' patch' diffInfo = case diffInfo of BranchInfo{..} -> flattenPatch patch >>= toTOCSummaries
ErrorInfo{..} -> pure $ TOCSummary patch' NotSummarizable LeafInfo{..} -> pure . TOCSummary patch $ case leafCategory of
BranchInfo{..} -> join $ zipWith toTOCSummaries' (flattenPatch patch') branches C.Function -> Summarizable leafCategory termName leafSourceSpan (patchType patch)
LeafInfo{..} -> pure . TOCSummary patch' $ case leafCategory of C.Method -> Summarizable leafCategory termName leafSourceSpan (patchType patch)
C.Function -> Summarizable leafCategory termName leafSourceSpan (patchType patch') C.SingletonMethod -> Summarizable leafCategory termName leafSourceSpan (patchType patch)
C.Method -> Summarizable leafCategory termName leafSourceSpan (patchType patch')
C.SingletonMethod -> Summarizable leafCategory termName leafSourceSpan (patchType patch')
_ -> NotSummarizable _ -> NotSummarizable
flattenPatch :: Patch DiffInfo -> [Patch DiffInfo] flattenPatch :: Patch DiffInfo -> [Patch DiffInfo]