on master help sign in
Make load to line work with mutual blocks
5c4ee75Edwin Brady
src/Idris/AbsSyntaxTree.hs+2−1
@@ -964,6 +964,7 @@ data SyntaxInfo = Syn { using :: [Using],
964 inPattern :: Bool,
964 inPattern :: Bool,
965 implicitAllowed :: Bool,
965 implicitAllowed :: Bool,
966 maxline :: Maybe Int,
966 maxline :: Maybe Int,
967+ mut_nesting :: Int,
967 dsl_info :: DSL }
968 dsl_info :: DSL }
968 deriving Show
969 deriving Show
969{-!
970{-!
@@ -971,7 +972,7 @@ deriving instance NFData SyntaxInfo
971deriving instance Binary SyntaxInfo
972deriving instance Binary SyntaxInfo
972!-}
973!-}
973
974
974−defaultSyntax = Syn [] [] [] [] id False False Nothing initDSL
975+defaultSyntax = Syn [] [] [] [] id False False Nothing 0 initDSL
975
976
976expandNS :: SyntaxInfo -> Name -> Name
977expandNS :: SyntaxInfo -> Name -> Name
977expandNS syn n@(NS _ _) = n
978expandNS syn n@(NS _ _) = n
src/Idris/DeepSeq.hs+2−2
@@ -321,11 +321,11 @@ instance NFData Using where
321
321
322
322
323instance NFData SyntaxInfo where
323instance NFData SyntaxInfo where
324− rnf (Syn x1 x2 x3 x4 x5 x6 x7 x8 x9)
324+ rnf (Syn x1 x2 x3 x4 x5 x6 x7 x8 x9 x10)
325 = rnf x1 `seq`
325 = rnf x1 `seq`
326 rnf x2 `seq`
326 rnf x2 `seq`
327 rnf x3 `seq`
327 rnf x3 `seq`
328− rnf x4 `seq` rnf x5 `seq` rnf x6 `seq` rnf x7 `seq` rnf x8 `seq` rnf x9 `seq` ()
328+ rnf x4 `seq` rnf x5 `seq` rnf x6 `seq` rnf x7 `seq` rnf x8 `seq` rnf x9 `seq` rnf x10 `seq` ()
329
329
330
330
331
331
src/Idris/IBC.hs+2−2
@@ -1582,7 +1582,7 @@ instance Binary Using where
1582 1 -> do x1 <- get; x2 <- get; return (UConstraint x1 x2)
1582 1 -> do x1 <- get; x2 <- get; return (UConstraint x1 x2)
1583
1583
1584instance Binary SyntaxInfo where
1584instance Binary SyntaxInfo where
1585− put (Syn x1 x2 x3 x4 _ x5 x6 _ x7)
1585+ put (Syn x1 x2 x3 x4 _ x5 x6 _ _ x7)
1586 = do put x1
1586 = do put x1
1587 put x2
1587 put x2
1588 put x3
1588 put x3
@@ -1598,7 +1598,7 @@ instance Binary SyntaxInfo where
1598 x5 <- get
1598 x5 <- get
1599 x6 <- get
1599 x6 <- get
1600 x7 <- get
1600 x7 <- get
1601− return (Syn x1 x2 x3 x4 id x5 x6 Nothing x7)
1601+ return (Syn x1 x2 x3 x4 id x5 x6 Nothing 0 x7)
1602
1602
1603instance (Binary t) => Binary (PClause' t) where
1603instance (Binary t) => Binary (PClause' t) where
1604 put x
1604 put x
src/Idris/Parser.hs+2−2
@@ -163,7 +163,7 @@ decl syn = do fc <- getFC
163 let continue = case maxline syn of
163 let continue = case maxline syn of
164 Nothing -> True
164 Nothing -> True
165 Just l -> if fst (fc_end fc) > l
165 Just l -> if fst (fc_end fc) > l
166− then False
166+ then mut_nesting syn /= 0
167 else True
167 else True
168 if continue then do notEndBlock
168 if continue then do notEndBlock
169 declBody
169 declBody
@@ -502,7 +502,7 @@ mutual syn =
502 do reserved "mutual"
502 do reserved "mutual"
503 openBlock
503 openBlock
504 let pvars = syn_params syn
504 let pvars = syn_params syn
505− ds <- many (decl syn)
505+ ds <- many (decl (syn { mut_nesting = mut_nesting syn + 1 } ))
506 closeBlock
506 closeBlock
507 fc <- getFC
507 fc <- getFC
508 return [PMutual fc (concat ds)]
508 return [PMutual fc (concat ds)]