Verified Commit 4d1840ea authored by Camil Staps's avatar Camil Staps 🚀

Fix previous commit

parent 610f4425
......@@ -142,6 +142,7 @@ instance == Location
instance print (Name, FunctionEntry)
getName :: Location -> Name
setName :: Name Location -> Location
isBuiltin :: Location -> Bool
isCore :: Location CloogleDB -> Bool
isApp :: Location CloogleDB -> Bool
......
......@@ -139,6 +139,10 @@ getName :: Location -> Name
getName (Location _ _ _ _ name) = name
getName (Builtin name _) = name
setName :: Name Location -> Location
setName n (Location lib mod dcl icl _) = Location lib mod dcl icl n
setName n (Builtin _ doc) = Builtin n doc
isBuiltin :: Location -> Bool
isBuiltin (Builtin _ _) = True
isBuiltin _ = False
......
......@@ -143,35 +143,38 @@ indexModule :: !String !'DB'.Module !'DB'.Library !(String 'DB'.ModuleEntry -> '
-> *(!TemporaryDB, !*World)
indexModule root mod lib modf db w
#! (functions, macros, generics, confuns, recfuns, typedefs, clss, insts, derivs, clsderivs, (modname, modentry), w)
= findModuleContents root w
= findModuleContents (root </> lib </> mkdir mod) w
#! lib = lib % (0, size lib - size modname + size mod - 1)
#! db =
{ db
& temp_functions =
[ castLocFst functions
, castLocFst macros
, castLocFst generics
, castLocFst confuns
, castLocFst recfuns
[ castLocFst modname functions
, castLocFst modname macros
, castLocFst modname generics
, castLocFst modname confuns
, castLocFst modname recfuns
: db.temp_functions
]
, temp_classes = [castLocFst clss:db.temp_classes]
, temp_types = [castLocFst typedefs:db.temp_types]
, temp_instances = [castLocThd3 insts:db.temp_instances]
, temp_derivations = [map (appSnd castLocThd3) derivs:db.temp_derivations]
, temp_class_derivations = [castLocFrth clsderivs:db.temp_class_derivations]
, temp_classes = [castLocFst modname clss:db.temp_classes]
, temp_types = [castLocFst modname typedefs:db.temp_types]
, temp_instances = [castLocThd3 modname insts:db.temp_instances]
, temp_derivations = [map (appSnd (castLocThd3 modname)) derivs:db.temp_derivations]
, temp_class_derivations = [castLocFrth modname clsderivs:db.temp_class_derivations]
, temp_modules = [(lib,modname,modf mod modentry):db.temp_modules]
}
= (db,w)
where
castLocFst :: ([(LocationInFile, a)] -> [('DB'.Location, a)])
castLocFst = map (appFst castLoc)
castLocThd3 :: ([(a, b, LocationInFile)] -> [(a, b, 'DB'.Location)])
castLocThd3 = map (appThd3 castLoc)
castLocFrth = map (\(a,b,c,l) -> (a,b,c,castLoc l))
castLoc :: LocationInFile -> 'DB'.Location
castLoc l = 'DB'.Location lib mod l.dcl_line l.icl_line (fromJust (l.name <|> Just "")) // TODO
castLocFst :: String -> ([(LocationInFile, a)] -> [('DB'.Location, a)])
castLocFst m = map (appFst (castLoc m))
castLocThd3 :: String -> ([(a, b, LocationInFile)] -> [(a, b, 'DB'.Location)])
castLocThd3 m = map (appThd3 (castLoc m))
castLocFrth m = map (\(a,b,c,l) -> (a,b,c,castLoc m l))
castLoc :: String LocationInFile -> 'DB'.Location
castLoc m l = 'DB'.Location lib m l.dcl_line l.icl_line (fromJust (l.name <|> Just "")) // TODO
mkdir :: String -> String
mkdir s = { if (c == '.') '/' c \\ c <-: s }
findModuleContents :: !String !*World
-> *( ![(LocationInFile, 'DB'.FunctionEntry)]
......
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