@@ -30,7 +30,7 @@ import Codec.Compression.Zlib (compress)
3030import Util.Zlib (decompressEither)
3131
3232ibcVersion :: Word8
33−ibcVersion = 72
33+ibcVersion = 73
3434
3535data IBCFile = IBCFile { ver :: Word8,
3636 sourcefile :: FilePath,
@@ -68,7 +68,8 @@ data IBCFile = IBCFile { ver :: Word8,
6868 ibc_function_errorhandlers :: [(Name, Name, Name)], -- fn, arg, handler
6969 ibc_metavars :: [(Name, (Maybe Name, Int, Bool))],
7070 ibc_patdefs :: [(Name, ([([Name], Term, Term)], [PTerm]))],
71− ibc_postulates :: [Name]
71+ ibc_postulates :: [Name],
72+ ibc_parsedSpan :: Maybe FC
7273 }
7374 deriving Show
7475{-!
@@ -76,7 +77,7 @@ deriving instance Binary IBCFile
7677!-}
7778
7879initIBC :: IBCFile
79−initIBC = IBCFile ibcVersion "" [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
80+initIBC = IBCFile ibcVersion "" [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Nothing
8081
8182loadIBC :: FilePath -> Idris ()
8283loadIBC fp = do imps <- getImported
@@ -241,6 +242,7 @@ ibc i (IBCMetavar n) f =
241242 Just t -> return f { ibc_metavars = (n, t) : ibc_metavars f }
242243ibc i (IBCPostulate n) f = return f { ibc_postulates = n : ibc_postulates f }
243244ibc i (IBCTotCheckErr fc err) f = return f { ibc_totcheckfail = (fc, err) : ibc_totcheckfail f }
245+ibc i (IBCParsedRegion fc) f = return f { ibc_parsedSpan = Just fc }
244246
245247process :: IBCFile -> FilePath -> Idris ()
246248process i fn
@@ -285,6 +287,7 @@ process i fn
285287 pFunctionErrorHandlers (ibc_function_errorhandlers i)
286288 pMetavars (ibc_metavars i)
287289 pPostulates (ibc_postulates i)
290+ pParsedSpan (ibc_parsedSpan i)
288291
289292timestampOlder :: FilePath -> FilePath -> Idris ()
290293timestampOlder src ibc = do srct <- runIO $ getModificationTime src
@@ -298,6 +301,10 @@ pPostulates ns = do
298301 i <- getIState
299302 putIState i{ idris_postulates = idris_postulates i `S.union` S.fromList ns }
300303
304+pParsedSpan :: Maybe FC -> Idris ()
305+pParsedSpan fc = do ist <- getIState
306+ putIState ist { idris_parsedSpan = fc }
307+
301308pImports :: [FilePath] -> Idris ()
302309pImports fs
303310 = do mapM_ (\f -> do i <- getIState
@@ -1168,7 +1175,7 @@ instance Binary MetaInformation where
11681175 return (DataMI x1)
11691176
11701177instance Binary IBCFile where
1171− put x@(IBCFile x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 x17 x18 x19 x20 x21 x22 x23 x24 x25 x26 x27 x28 x29 x30 x31 x32 x33 x34 x35 x36 x37)
1178+ put x@(IBCFile x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 x17 x18 x19 x20 x21 x22 x23 x24 x25 x26 x27 x28 x29 x30 x31 x32 x33 x34 x35 x36 x37 x38)
11721179 = {-# SCC "putIBCFile" #-}
11731180 do put x1
11741181 put x2
@@ -1207,6 +1214,7 @@ instance Binary IBCFile where
12071214 put x35
12081215 put x36
12091216 put x37
1217+ put x38
12101218
12111219 get
12121220 = do x1 <- get
@@ -1247,7 +1255,8 @@ instance Binary IBCFile where
12471255 x35 <- get
12481256 x36 <- get
12491257 x37 <- get
1250− return (IBCFile x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 x17 x18 x19 x20 x21 x22 x23 x24 x25 x26 x27 x28 x29 x30 x31 x32 x33 x34 x35 x36 x37)
1258+ x38 <- get
1259+ return (IBCFile x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 x17 x18 x19 x20 x21 x22 x23 x24 x25 x26 x27 x28 x29 x30 x31 x32 x33 x34 x35 x36 x37 x38)
12511260 else return (initIBC { ver = x1 })
12521261
12531262instance Binary DataOpt where