@@ -41,13 +41,14 @@ data IBCFile = IBCFile { ver :: Word8,
4141 ibc_access :: [(Name, Accessibility)],
4242 ibc_total :: [(Name, Totality)],
4343 ibc_flags :: [(Name, [FnOpt])],
44+ ibc_cg :: [(Name, [Name])],
4445 ibc_defs :: [(Name, Def)] }
4546{-!
4647deriving instance Binary IBCFile
4748!-}
4849
4950initIBC :: IBCFile
50−initIBC = IBCFile ibcVersion "" [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
51+initIBC = IBCFile ibcVersion "" [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
5152
5253loadIBC :: FilePath -> Idris ()
5354loadIBC fp = do iLOG $ "Loading ibc " ++ fp
@@ -106,6 +107,9 @@ ibc i (IBCHeader n) f = return f { ibc_hdrs = n : ibc_hdrs f }
106107ibc i (IBCDef n) f = case lookupDef Nothing n (tt_ctxt i) of
107108 [v] -> return f { ibc_defs = (n,v) : ibc_defs f }
108109 _ -> 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"
109113ibc i (IBCAccess n a) f = return f { ibc_access = (n,a) : ibc_access f }
110114ibc i (IBCFlags n a) f = return f { ibc_flags = (n,a) : ibc_flags f }
111115ibc i (IBCTotal n a) f = return f { ibc_total = (n,a) : ibc_total f }
@@ -135,6 +139,7 @@ process i fn
135139 pDefs (ibc_defs i)
136140 pAccess (ibc_access i)
137141 pTotal (ibc_total i)
142+ pCG (ibc_cg i)
138143
139144timestampOlder :: FilePath -> FilePath -> IO ()
140145timestampOlder src ibc = do srct <- getModificationTime src
@@ -244,6 +249,9 @@ pTotal ds = mapM_ (\ (n, a) ->
244249 putIState (i { tt_ctxt = setTotal n a (tt_ctxt i) }))
245250 ds
246251
252+pCG :: [(Name, [Name])] -> Idris ()
253+pCG ds = mapM_ (\ (n, a) -> addToCG n a) ds
254+
247255----- Generated by 'derive'
248256
249257
@@ -628,7 +636,7 @@ instance Binary Totality where
628636 _ -> error "Corrupted binary data for Totality"
629637
630638instance 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)
632640 = do put x1
633641 put x2
634642 put x3
@@ -648,6 +656,7 @@ instance Binary IBCFile where
648656 put x17
649657 put x18
650658 put x19
659+ put x20
651660 get
652661 = do x1 <- get
653662 if x1 == ibcVersion then
@@ -669,7 +678,8 @@ instance Binary IBCFile where
669678 x17 <- get
670679 x18 <- get
671680 x19 <- get
672− return (IBCFile x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 x17 x18 x19)
681+ x20 <- get
682+ return (IBCFile x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 x17 x18 x19 x20)
673683 else return (initIBC { ver = x1 })
674684
675685instance Binary FnOpt where