@@ -30,7 +30,7 @@ import Codec.Compression.Zlib (compress)
30import Util.Zlib (decompressEither)
30import Util.Zlib (decompressEither)
32ibcVersion :: Word8
32ibcVersion :: Word8
33−ibcVersion = 72
33+ibcVersion = 73
35data IBCFile = IBCFile { ver :: Word8,
35data IBCFile = IBCFile { ver :: Word8,
36 sourcefile :: FilePath,
36 sourcefile :: FilePath,
@@ -68,7 +68,8 @@ data IBCFile = IBCFile { ver :: Word8,
68 ibc_function_errorhandlers :: [(Name, Name, Name)], -- fn, arg, handler
68 ibc_function_errorhandlers :: [(Name, Name, Name)], -- fn, arg, handler
69 ibc_metavars :: [(Name, (Maybe Name, Int, Bool))],
69 ibc_metavars :: [(Name, (Maybe Name, Int, Bool))],
70 ibc_patdefs :: [(Name, ([([Name], Term, Term)], [PTerm]))],
70 ibc_patdefs :: [(Name, ([([Name], Term, Term)], [PTerm]))],
71− ibc_postulates :: [Name]
71+ ibc_postulates :: [Name],
72+ ibc_parsedSpan :: Maybe FC
73 deriving Show
74 deriving Show
@@ -76,7 +77,7 @@ deriving instance Binary IBCFile
78initIBC :: IBCFile
79initIBC :: IBCFile
79−initIBC = IBCFile ibcVersion "" [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
80+initIBC = IBCFile ibcVersion "" [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Nothing
81loadIBC :: FilePath -> Idris ()
82loadIBC :: FilePath -> Idris ()
82loadIBC fp = do imps <- getImported
83loadIBC fp = do imps <- getImported
@@ -241,6 +242,7 @@ ibc i (IBCMetavar n) f =
241 Just t -> return f { ibc_metavars = (n, t) : ibc_metavars f }
242 Just t -> return f { ibc_metavars = (n, t) : ibc_metavars f }
242ibc i (IBCPostulate n) f = return f { ibc_postulates = n : ibc_postulates f }
243ibc i (IBCPostulate n) f = return f { ibc_postulates = n : ibc_postulates f }
243ibc i (IBCTotCheckErr fc err) f = return f { ibc_totcheckfail = (fc, err) : ibc_totcheckfail f }
244ibc 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 }
245process :: IBCFile -> FilePath -> Idris ()
247process :: IBCFile -> FilePath -> Idris ()
246process i fn
248process i fn
@@ -285,6 +287,7 @@ process i fn
285 pFunctionErrorHandlers (ibc_function_errorhandlers i)
287 pFunctionErrorHandlers (ibc_function_errorhandlers i)
286 pMetavars (ibc_metavars i)
288 pMetavars (ibc_metavars i)
287 pPostulates (ibc_postulates i)
289 pPostulates (ibc_postulates i)
290+ pParsedSpan (ibc_parsedSpan i)
289timestampOlder :: FilePath -> FilePath -> Idris ()
292timestampOlder :: FilePath -> FilePath -> Idris ()
290timestampOlder src ibc = do srct <- runIO $ getModificationTime src
293timestampOlder src ibc = do srct <- runIO $ getModificationTime src
@@ -298,6 +301,10 @@ pPostulates ns = do
298 i <- getIState
301 i <- getIState
299 putIState i{ idris_postulates = idris_postulates i `S.union` S.fromList ns }
302 putIState i{ idris_postulates = idris_postulates i `S.union` S.fromList ns }
304+pParsedSpan :: Maybe FC -> Idris ()
305+pParsedSpan fc = do ist <- getIState
306+ putIState ist { idris_parsedSpan = fc }
301pImports :: [FilePath] -> Idris ()
308pImports :: [FilePath] -> Idris ()
302pImports fs
309pImports fs
303 = do mapM_ (\f -> do i <- getIState
310 = do mapM_ (\f -> do i <- getIState
@@ -1168,7 +1175,7 @@ instance Binary MetaInformation where
1168 return (DataMI x1)
1175 return (DataMI x1)
1170instance Binary IBCFile where
1177instance 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)
1172 = {-# SCC "putIBCFile" #-}
1179 = {-# SCC "putIBCFile" #-}
1173 do put x1
1180 do put x1
@@ -1207,6 +1214,7 @@ instance Binary IBCFile where
1212 = do x1 <- get
1220 = do x1 <- get
@@ -1247,7 +1255,8 @@ instance Binary IBCFile where
1247 x35 <- get
1255 x35 <- get
1248 x36 <- get
1256 x36 <- get
1249 x37 <- get
1257 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)
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)
1251 else return (initIBC { ver = x1 })
1260 else return (initIBC { ver = x1 })
1253instance Binary DataOpt where
1262instance Binary DataOpt where