Verified Commit c59d8995 authored by Camil Staps's avatar Camil Staps 🚀

Include kind of element in UniqueResultIdentifier

parent 929f03ae
......@@ -42,9 +42,9 @@ symbolicDistance :: !CloogleEntry ![Annotation] -> RankInformation
= LT !UniqueResultIdentifier !UniqueResultIdentifier //* arg1 should have lower distance than arg2
/**
* @representation module name and name of element
* @representation kind (e.g. Function for FunctionEntry), module name, name of element
*/
:: UniqueResultIdentifier :== (!String, !String)
:: UniqueResultIdentifier :== (!String, !String, !String)
/**
* Find suitable ranking settings given a set of constraints. This requires Z3
......
......@@ -84,10 +84,22 @@ where
count nt nf nc [] = (nt,nf,nc)
match :: !UniqueResultIdentifier !CloogleEntry -> Bool
match (mod,name) ce = case getLocation ce of
match (thing,mod,name) ce
| thing <> descriptorName ce = False
| otherwise = case getLocation ce of
Just (Location _ cemod _ _ _ cename) -> mod == cemod && name == cename
Just (Builtin cename _) -> mod == "_builtin" && name == cename
_ -> abort "error in match of UniqueResultIdentifier\n"
where
descriptorName :: !CloogleEntry -> String
descriptorName (FunctionEntry _) = "Function"
descriptorName (TypeDefEntry _) = "TypeDef"
descriptorName (ModuleEntry _) = "Module"
descriptorName (ClassEntry _) = "Class"
descriptorName (InstanceEntry _) = "Instance"
descriptorName (DeriveEntry _) = "Derive"
descriptorName (SyntaxEntry _) = "Syntax"
descriptorName (ABCInstructionEntry _) = "ABCInstruction"
findRankSettings :: ![(Request, RankConstraint)] !*CloogleDB !*World
-> *(!MaybeError String RankSettings, *CloogleDB, !*World)
......@@ -172,7 +184,7 @@ findConstraints [(req,LT urid1 urid2):rest] cdb
# (rest,cdb) = findConstraints rest cdb
= ([this:rest],cdb)
where
findEntry orgsearchtype allsyns usedsyns urid=:(mod,name) entries cdb
findEntry orgsearchtype allsyns usedsyns urid=:(_,mod,name) entries cdb
= case filter (\(e,_) -> match urid e) entries of
[(e1=:FunctionEntry fe,annots):[]]
# (unif,usedsyns,required_context,cdb) = unifyInformation orgsearchtype allsyns usedsyns fe cdb
......
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