Verified Commit 38469bb7 authored by Camil Staps's avatar Camil Staps 🙂

Make sure usage entries are sorted after collecting parent usages of...

Make sure usage entries are sorted after collecting parent usages of constructors, fields and class members
parent adf2ad02
......@@ -466,10 +466,8 @@ filterUsages filter names wrap=:{name_map}
[] -> []
us -> foldr1 mergeIntersect us
# (es,db) = 'Database.Native'.getIndices usages db
# usages = [(case e of
FunctionEntry {fe_typedef=Just i} -> i
FunctionEntry {fe_class=Just i} -> i
_ -> u) \\ u <- usages & {value=e} <- es]
# (sorted,unsorted) = collectUsages usages es
# usages = mergeUnion sorted (removeDupSorted $ sort unsorted)
# db = 'Database.Native'.searchIndices Intersect (mergeUnionWithAnnots nameidxs [(u,[]) \\ u <- usages]) db
= {wrap & db=db}
where
......@@ -506,6 +504,23 @@ where
| i > j = mergeIntersect orgis js
| otherwise = ['Database.Native'.Index i:mergeIntersect is js]
collectUsages :: !['Database.Native'.Index] !['Database.Native'.Entry CloogleEntry Annotation] -> (!['Database.Native'.Index], !['Database.Native'.Index])
collectUsages [i:is] [e:es]
# (sorted,unsorted) = collectUsages is es
= case e.value of
FunctionEntry fe -> case fe.fe_typedef of
Just i -> (sorted, [i:unsorted])
Nothing -> case fe.fe_class of
Just i -> (sorted, [i:unsorted])
Nothing -> ([i:sorted], unsorted)
_ -> ([i:sorted], unsorted)
collectUsages [] [] = ([], [])
collectUsages _ _ = abort "error in collectUsages\n"
removeDupSorted :: !['Database.Native'.Index] -> ['Database.Native'.Index]
removeDupSorted [x:xs] = [x:removeDupSorted (dropWhile ((==)x) xs)]
removeDupSorted [] = []
allTypeSynonyms :: !*CloogleDB -> *(Map Name [TypeDef], *CloogleDB)
allTypeSynonyms wrap=:{db,type_synonyms}
# (es,db) = 'Database.Native'.getIndices` type_synonyms db
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment