on master help sign in
Add workaround for partial FC functions
77a732eDavid Raymond Christiansen
src/Idris/Core/TT.hs+9−2
@@ -51,7 +51,7 @@ data Option = TTypeInTType
51-- | Source location. These are typically produced by the parser 'Idris.Parser.getFC'
51-- | Source location. These are typically produced by the parser 'Idris.Parser.getFC'
52data FC = FC { _fc_fname :: String, -- ^ Filename
52data FC = FC { _fc_fname :: String, -- ^ Filename
53 _fc_start :: (Int, Int), -- ^ Line and column numbers for the start of the location span
53 _fc_start :: (Int, Int), -- ^ Line and column numbers for the start of the location span
54− fc_end :: (Int, Int) -- ^ Line and column numbers for the end of the location span
54+ _fc_end :: (Int, Int) -- ^ Line and column numbers for the end of the location span
55 }
55 }
56 | NoFC -- ^ Locations for machine-generated terms
56 | NoFC -- ^ Locations for machine-generated terms
57 | FileFC { _fc_fname :: String } -- ^ Locations with file only
57 | FileFC { _fc_fname :: String } -- ^ Locations with file only
@@ -65,12 +65,19 @@ fc_fname NoFC = "(no file)"
65fc_fname (FileFC f) = f
65fc_fname (FileFC f) = f
66
66
67-- TODO: find uses and destroy them, doing this case analysis at call sites
67-- TODO: find uses and destroy them, doing this case analysis at call sites
68−-- | Give a notion of filename associated with an FC
68+-- | Give a notion of start location associated with an FC
69fc_start :: FC -> (Int, Int)
69fc_start :: FC -> (Int, Int)
70fc_start (FC _ start _) = start
70fc_start (FC _ start _) = start
71fc_start NoFC = (0, 0)
71fc_start NoFC = (0, 0)
72fc_start (FileFC f) = (0, 0)
72fc_start (FileFC f) = (0, 0)
73
73
74+-- TODO: find uses and destroy them, doing this case analysis at call sites
75+-- | Give a notion of end location associated with an FC
76+fc_end :: FC -> (Int, Int)
77+fc_end (FC _ _ end) = end
78+fc_end NoFC = (0, 0)
79+fc_end (FileFC f) = (0, 0)
80+
74-- | Get the largest span containing the two FCs
81-- | Get the largest span containing the two FCs
75spanFC :: FC -> FC -> FC
82spanFC :: FC -> FC -> FC
76spanFC (FC f start end) (FC f' start' end')
83spanFC (FC f start end) (FC f' start' end')