summaryrefslogtreecommitdiff
path: root/utils/ghctags/Main.hs
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2011-06-09 15:48:22 +0100
committerIan Lynagh <igloo@earth.li>2011-06-09 15:48:22 +0100
commit77ffb1afd2eca3c338e7e7059827f6813ec81198 (patch)
treefa84a6c9aba62c00c58bffe2519141f80a9ded82 /utils/ghctags/Main.hs
parentb2bd63f99d643f6b3eb30bb72bb9ae26d4183252 (diff)
downloadhaskell-77ffb1afd2eca3c338e7e7059827f6813ec81198.tar.gz
Follow Src{Loc,Span} changes in other parts of the tree
Diffstat (limited to 'utils/ghctags/Main.hs')
-rw-r--r--utils/ghctags/Main.hs9
1 files changed, 6 insertions, 3 deletions
diff --git a/utils/ghctags/Main.hs b/utils/ghctags/Main.hs
index c86a92a226..4ba8157dcc 100644
--- a/utils/ghctags/Main.hs
+++ b/utils/ghctags/Main.hs
@@ -16,6 +16,7 @@ import Bag
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 )
@@ -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)
-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)
@@ -261,8 +262,10 @@ boundValues mod group =
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)