1
1
mirror of https://github.com/github/semantic.git synced 2025-01-03 13:02:37 +03:00

Append parent annotation

This commit is contained in:
joshvera 2016-10-05 11:55:41 -04:00
parent 3dcf54bd82
commit 0fb363f59e

View File

@ -224,12 +224,12 @@ termToDiffInfo blob term = case unwrap term of
prependSummary :: (HasCategory leaf, HasField fields Range, HasField fields Category) => Source Char -> SyntaxTerm leaf fields -> DiffSummary DiffInfo -> DiffSummary DiffInfo
prependSummary source term summary =
case (parentAnnotation summary, identifiable term, annotatable term) of
([], Identifiable _, _) -> prependParentAnnotation Left
([_], _, Annotatable _) -> prependParentAnnotation Right
([], Identifiable _, _) -> appendParentAnnotation Left
([_], _, Annotatable _) -> appendParentAnnotation Right
(_, _, _) -> summary
where
prependParentAnnotation constructor = summary
{ parentAnnotation = constructor (category (extract term), toTermName source term) : parentAnnotation summary }
appendParentAnnotation constructor = summary
{ parentAnnotation = parentAnnotation summary <> [ constructor (category (extract term), toTermName source term) ] }
isBranchInfo :: DiffInfo -> Bool
isBranchInfo info = case info of