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

Use record syntax for every case in toInfo.

This commit is contained in:
Rob Rix 2017-05-08 17:14:21 -04:00
parent f33f2d6622
commit 28d858ce32

View File

@ -103,11 +103,11 @@ diffTOC blobs diff = removeDupes (diffToTOCSummaries (source <$> blobs) diff) >>
toInfo :: HasDefaultFields fields => Source -> Term (Syntax Text) (Record fields) -> [DiffInfo] toInfo :: HasDefaultFields fields => Source -> Term (Syntax Text) (Record fields) -> [DiffInfo]
toInfo source = para $ \ (annotation :< syntax) -> let termName = toTermName source (cofree (annotation :< fmap fst syntax)) in case syntax of toInfo source = para $ \ (annotation :< syntax) -> let termName = toTermName source (cofree (annotation :< fmap fst syntax)) in case syntax of
S.ParseError _ -> [ErrorInfo (sourceSpan annotation) termName] S.ParseError{} -> [ErrorInfo (sourceSpan annotation) termName]
S.Indexed{} -> foldMap snd syntax S.Indexed{} -> foldMap snd syntax
S.Fixed{} -> foldMap snd syntax S.Fixed{} -> foldMap snd syntax
S.Commented{} -> foldMap snd syntax S.Commented{} -> foldMap snd syntax
S.AnonymousFunction _ _ -> [LeafInfo C.AnonymousFunction termName (sourceSpan annotation)] S.AnonymousFunction{} -> [LeafInfo C.AnonymousFunction termName (sourceSpan annotation)]
_ -> [LeafInfo (category annotation) termName (sourceSpan annotation)] _ -> [LeafInfo (category annotation) termName (sourceSpan annotation)]
summarize patch = case afterOrBefore patch of summarize patch = case afterOrBefore patch of