@@ -41,13 +41,14 @@ data IBCFile = IBCFile { ver :: Word8,
41 ibc_access :: [(Name, Accessibility)],
41 ibc_access :: [(Name, Accessibility)],
42 ibc_total :: [(Name, Totality)],
42 ibc_total :: [(Name, Totality)],
43 ibc_flags :: [(Name, [FnOpt])],
43 ibc_flags :: [(Name, [FnOpt])],
44+ ibc_cg :: [(Name, [Name])],
44 ibc_defs :: [(Name, Def)] }
45 ibc_defs :: [(Name, Def)] }
46deriving instance Binary IBCFile
47deriving instance Binary IBCFile
49initIBC :: IBCFile
50initIBC :: IBCFile
50−initIBC = IBCFile ibcVersion "" [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
51+initIBC = IBCFile ibcVersion "" [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
52loadIBC :: FilePath -> Idris ()
53loadIBC :: FilePath -> Idris ()
53loadIBC fp = do iLOG $ "Loading ibc " ++ fp
54loadIBC fp = do iLOG $ "Loading ibc " ++ fp
@@ -106,6 +107,9 @@ ibc i (IBCHeader n) f = return f { ibc_hdrs = n : ibc_hdrs f }
106ibc i (IBCDef n) f = case lookupDef Nothing n (tt_ctxt i) of
107ibc i (IBCDef n) f = case lookupDef Nothing n (tt_ctxt i) of
107 [v] -> return f { ibc_defs = (n,v) : ibc_defs f }
108 [v] -> return f { ibc_defs = (n,v) : ibc_defs f }
108 _ -> fail "IBC write failed"
109 _ -> fail "IBC write failed"
110+ibc i (IBCCG n) f = case lookupCtxt Nothing n (idris_callgraph i) of
111+ [v] -> return f { ibc_cg = (n,v) : ibc_cg f }
112+ _ -> fail "IBC write failed"
109ibc i (IBCAccess n a) f = return f { ibc_access = (n,a) : ibc_access f }
113ibc i (IBCAccess n a) f = return f { ibc_access = (n,a) : ibc_access f }
110ibc i (IBCFlags n a) f = return f { ibc_flags = (n,a) : ibc_flags f }
114ibc i (IBCFlags n a) f = return f { ibc_flags = (n,a) : ibc_flags f }
111ibc i (IBCTotal n a) f = return f { ibc_total = (n,a) : ibc_total f }
115ibc i (IBCTotal n a) f = return f { ibc_total = (n,a) : ibc_total f }
@@ -135,6 +139,7 @@ process i fn
135 pDefs (ibc_defs i)
139 pDefs (ibc_defs i)
136 pAccess (ibc_access i)
140 pAccess (ibc_access i)
137 pTotal (ibc_total i)
141 pTotal (ibc_total i)
139timestampOlder :: FilePath -> FilePath -> IO ()
144timestampOlder :: FilePath -> FilePath -> IO ()
140timestampOlder src ibc = do srct <- getModificationTime src
145timestampOlder src ibc = do srct <- getModificationTime src
@@ -244,6 +249,9 @@ pTotal ds = mapM_ (\ (n, a) ->
244 putIState (i { tt_ctxt = setTotal n a (tt_ctxt i) }))
249 putIState (i { tt_ctxt = setTotal n a (tt_ctxt i) }))
252+pCG :: [(Name, [Name])] -> Idris ()
253+pCG ds = mapM_ (\ (n, a) -> addToCG n a) ds
247----- Generated by 'derive'
255----- Generated by 'derive'
@@ -628,7 +636,7 @@ instance Binary Totality where
628 _ -> error "Corrupted binary data for Totality"
636 _ -> error "Corrupted binary data for Totality"
630instance Binary IBCFile where
638instance Binary IBCFile where
631− put (IBCFile x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 x17 x18 x19)
639+ put (IBCFile x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 x17 x18 x19 x20)
632 = do put x1
640 = do put x1
@@ -648,6 +656,7 @@ instance Binary IBCFile where
652 = do x1 <- get
661 = do x1 <- get
653 if x1 == ibcVersion then
662 if x1 == ibcVersion then
@@ -669,7 +678,8 @@ instance Binary IBCFile where
669 x17 <- get
678 x17 <- get
670 x18 <- get
679 x18 <- get
671 x19 <- get
680 x19 <- get
672− return (IBCFile x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 x17 x18 x19)
682+ return (IBCFile x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 x17 x18 x19 x20)
673 else return (initIBC { ver = x1 })
683 else return (initIBC { ver = x1 })
675instance Binary FnOpt where
685instance Binary FnOpt where