Follow Src{Loc,Span} changes in other parts of the tree
authorIan Lynagh <igloo@earth.li>
Thu, 9 Jun 2011 14:48:22 +0000 (15:48 +0100)
committerIan Lynagh <igloo@earth.li>
Thu, 9 Jun 2011 14:48:22 +0000 (15:48 +0100)
compiler/main/GHC.hs
ghc/GhciTags.hs
utils/ghctags/Main.hs

index 3a054e1..5f7139c 100644 (file)
@@ -186,10 +186,10 @@ module GHC (
        compareFixity,
 
        -- ** Source locations
        compareFixity,
 
        -- ** Source locations
-       SrcLoc, pprDefnLoc,
+       SrcLoc(..), RealSrcLoc, pprDefnLoc,
         mkSrcLoc, noSrcLoc,
        srcLocFile, srcLocLine, srcLocCol,
         mkSrcLoc, noSrcLoc,
        srcLocFile, srcLocLine, srcLocCol,
-        SrcSpan,
+        SrcSpan(..), RealSrcSpan,
         mkSrcSpan, srcLocSpan, isGoodSrcSpan, noSrcSpan,
         srcSpanStart, srcSpanEnd,
        srcSpanFile, 
         mkSrcSpan, srcLocSpan, isGoodSrcSpan, noSrcSpan,
         srcSpanStart, srcSpanEnd,
        srcSpanFile, 
index ffec5be..95bc83e 100644 (file)
@@ -18,7 +18,6 @@ import GHC
 import GhciMonad
 import Outputable
 import Util
 import GhciMonad
 import Outputable
 import Util
-import SrcLoc
 
 -- ToDo: figure out whether we need these, and put something appropriate
 -- into the GHC API instead
 
 -- ToDo: figure out whether we need these, and put something appropriate
 -- into the GHC API instead
index c86a92a..4ba8157 100644 (file)
@@ -16,6 +16,7 @@ import Bag
 import Exception
 import FastString
 import MonadUtils       ( liftIO )
 import Exception
 import FastString
 import MonadUtils       ( liftIO )
+import SrcLoc
 
 -- Every GHC comes with Cabal anyways, so this is not a bad new dependency
 import Distribution.Simple.GHC ( ghcOptions )
 
 -- Every GHC comes with Cabal anyways, so this is not a bad new dependency
 import Distribution.Simple.GHC ( ghcOptions )
@@ -49,7 +50,7 @@ type FileName = String
 type ThingName = String -- name of a defined entity in a Haskell program
 
 -- A definition we have found (we know its containing module, name, and location)
 type ThingName = String -- name of a defined entity in a Haskell program
 
 -- A definition we have found (we know its containing module, name, and location)
-data FoundThing = FoundThing ModuleName ThingName SrcLoc
+data FoundThing = FoundThing ModuleName ThingName RealSrcLoc
 
 -- Data we have obtained from a file (list of things we found)
 data FileData = FileData FileName [FoundThing] (Map Int String)
 
 -- Data we have obtained from a file (list of things we found)
 data FileData = FileData FileName [FoundThing] (Map Int String)
@@ -261,8 +262,10 @@ boundValues mod group =
   in vals ++ tys ++ fors
   where found = foundOfLName mod
 
   in vals ++ tys ++ fors
   where found = foundOfLName mod
 
-startOfLocated :: Located a -> SrcLoc
-startOfLocated lHs = srcSpanStart $ getLoc lHs
+startOfLocated :: Located a -> RealSrcLoc
+startOfLocated lHs = case getLoc lHs of
+                     RealSrcSpan l -> realSrcSpanStart l
+                     UnhelpfulSpan _ -> panic "startOfLocated UnhelpfulSpan"
 
 foundOfLName :: ModuleName -> Located Name -> FoundThing
 foundOfLName mod id = FoundThing mod (getOccString $ unLoc id) (startOfLocated id)
 
 foundOfLName :: ModuleName -> Located Name -> FoundThing
 foundOfLName mod id = FoundThing mod (getOccString $ unLoc id) (startOfLocated id)