Commit 7a5d11ad authored by Camil Staps's avatar Camil Staps
Browse files

Add derivations to FunctionEntries

parent f7d39332
......@@ -79,6 +79,7 @@ derive JSONDecode CloogleEntry
, fe_representation :: !Maybe String //* A string representation of the entry
, fe_documentation :: !Maybe FunctionDoc //* Documentation on this entry
, fe_class :: !Maybe Index //* The class, for class members
, fe_derivations :: !Maybe [Index] //* The DerivaionEntries
}
/**
......
......@@ -100,6 +100,7 @@ where
, fe_representation = Nothing
, fe_documentation = Nothing
, fe_class = Nothing
, fe_derivations = Nothing
}
instance zero ModuleEntry
......
......@@ -73,7 +73,7 @@ from CloogleDB import
:: CleanLangReportLocation,
:: CloogleEntry(..),
:: ModuleEntry{me_loc,me_is_core,me_is_app,me_documentation},
:: FunctionEntry{fe_loc,fe_type,fe_kind,fe_generic_vars,fe_priority,fe_representation,fe_documentation,fe_class},
:: FunctionEntry{..},
:: TypeDefEntry{tde_loc,tde_instances,tde_derivations},
:: ClassEntry{ce_loc,ce_instances,ce_is_meta}, classContext, :: TypeRestriction,
:: SyntaxEntry, :: DeriveEntry,
......@@ -148,6 +148,12 @@ where
InstanceEntry ie -> ie.ie_class == 'CDB'.getName ce.ce_loc
_ -> False
}
link (FunctionEntry fe=:{fe_derivations=Just _}) = FunctionEntry
{ fe
& fe_derivations=Just $ idxfilter \e -> case e of
DeriveEntry de -> de.de_generic == 'CDB'.getName fe.fe_loc
_ -> False
}
link e = e
entries` = map Right (
extra ++
......@@ -472,6 +478,7 @@ where
, fe_generic_vars=Just $ map 'T'.toTypeVar gen_vars
, fe_representation=Just $ cpp gen
, fe_documentation=findDoc hideIsUsedReturn id st
, fe_derivations=Just []
}
) \\ gen=:(PD_Generic {gen_ident=id=:{id_name},gen_pos,gen_type,gen_vars}) <- defs]
......
......@@ -76,6 +76,10 @@ makeResult orgsearchtype tdes usedsyns (entry, annots) db
finish_unification (syns ++ usedsyns) <$>
(orgsearchtype >>= unify type)
# required_context = Nothing // TODO
// Derivations
# (derivs,db) = case fe.fe_derivations of
Nothing -> (Nothing, db)
Just ds -> appFst Just $ getIndices ds db
= (FunctionResult (
{ general
& distance = toInt $ kindPenalty fe.fe_kind * toReal (general.distance + sum
......@@ -95,7 +99,8 @@ makeResult orgsearchtype tdes usedsyns (entry, annots) db
, recordfield_of = case fe.fe_kind of
RecordField -> let (Just (Func [t:_] _ _)) = fe.fe_type in Just $ concat $ print False t
_ -> Nothing
, generic_derivations = Nothing // TODO
, generic_derivations = sortBy ((<) `on` fst) <$>
map (\{value=DeriveEntry de} -> (de.de_type_representation, map locResult de.de_locations)) <$> derivs
, param_doc = docParams <$> fe.fe_documentation
, generic_var_doc = docVars <$> fe.fe_documentation
, result_doc = docResults <$> fe.fe_documentation
......
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