Commit 5f3f266d authored by Camil Staps's avatar Camil Staps 🚀

Add back class_funs

parent 8eaa092d
......@@ -115,7 +115,7 @@ derive JSONDecode CloogleEntry
, ce_is_meta :: !Bool //* Whether this is a meta class (no non-macro members and not TC)
, ce_context :: !TypeContext //* A class context
, ce_documentation :: !Maybe ClassDoc //* Documentation on this class
, ce_members :: ![Index] //* Class members (FunctionEntries)
, ce_members :: [Index] //* Class members (FunctionEntries; must be lazy for CloogleDBFactory to work)
, ce_instances :: ![Index] //* All instances of the class
, ce_derivations :: ![Index] //* Derivations of generic meta-classes like iTask
}
......
......@@ -76,7 +76,8 @@ from CloogleDB import
:: ModuleEntry{me_loc,me_is_core,me_is_app,me_documentation},
:: FunctionEntry{..},
:: TypeDefEntry{tde_loc,tde_instances,tde_derivations},
:: ClassEntry{ce_loc,ce_instances,ce_is_meta}, classContext, :: TypeRestriction,
:: ClassEntry{ce_loc,ce_instances,ce_is_meta,ce_members},
classContext, :: TypeRestriction,
:: SyntaxEntry, :: DeriveEntry,
:: InstanceEntry{ie_class,ie_types,ie_locations},
:: DeriveEntry{..},
......@@ -139,10 +140,10 @@ finaliseDb extra tdb =
[(ie.ie_class, i) \\ (i,InstanceEntry ie) <- entridxs]
}
where
entries = [link e \\ Right e <- entries`]
entries = [link i e \\ Right e <- filter (\e -> e=:(Right _)) entries` & i <- [0..]]
where
link :: CloogleEntry -> CloogleEntry
link (TypeDefEntry tde) = TypeDefEntry
link :: Int CloogleEntry -> CloogleEntry
link _ (TypeDefEntry tde) = TypeDefEntry
{ tde
& tde_instances=idxfilter \e -> case e of
InstanceEntry ie -> not $ isEmpty [() \\ 'T'.Type t _ <- concatMap ('T'.subtypes o fst) ie.ie_types | t == 'T'.td_name ('CDB'.getTypeDef tde)]
......@@ -151,19 +152,22 @@ where
DeriveEntry {de_type='T'.Type t _} -> t == 'T'.td_name ('CDB'.getTypeDef tde)
_ -> False
}
link (ClassEntry ce) = ClassEntry
link i (ClassEntry ce) = ClassEntry
{ ce
& ce_instances=idxfilter \e -> case e of
InstanceEntry ie -> ie.ie_class == 'CDB'.getName ce.ce_loc
_ -> False
, ce_members=idxfilter \e -> case e of
FunctionEntry fe -> fe.fe_class == Just (Index i)
_ -> False
}
link (FunctionEntry fe=:{fe_derivations=Just _}) = FunctionEntry
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
link _ e = e
entries` = map Right (
extra ++
[FunctionEntry fun \\ funs <- tdb.temp_functions, fun <- funs] ++
......@@ -320,7 +324,7 @@ where
castLocFrth m = map (\(a,b,c,l) -> (a,b,c,castLoc m l))
castLoc :: String LocationInModule -> 'CDB'.Location
castLoc m l = 'CDB'.Location lib m dclpath l.dcl_line l.icl_line (fromJust (l.name <|> Just "")) // TODO
castLoc m l = 'CDB'.Location lib m dclpath l.dcl_line l.icl_line $ fromMaybe "" l.name // TODO
dclpath = mkdir mod +++ ".dcl"
mkdir :: String -> String
......
......@@ -196,11 +196,12 @@ makeResult orgsearchtype tdes usedsyns (entry, annots) db
| entry =: (ClassEntry _)
# (ClassEntry ce) = entry
# (ies,db) = getIndices ce.ce_instances db
# (mems,db) = getIndices ce.ce_members db
= (ClassResult (general,
{ class_name = name
, class_heading = foldl ((+) o (flip (+) " ")) name ce.ce_vars +
if (isEmpty ce.ce_context) "" " | " + concat (print False ce.ce_context)
, class_funs = [] // TODO
, class_funs = [fromJust fe.fe_representation \\ {value=FunctionEntry fe} <- mems]
, class_instances = sortBy ((<) `on` fst)
[(map snd ie.ie_types, map locResult ie.ie_locations)
\\ {value=InstanceEntry ie} <- ies]
......
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