X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=utils%2Fghctags%2FMain.hs;h=4ba8157dcc044db3aa2f060f71e015ff0d27e292;hb=HEAD;hp=b3ed58f327efe20f1e34651c3ccaaa7d784c7cf6;hpb=bfa0c2ed1e4cd07c7934901520cb04db6b79cd9d;p=ghc-hetmet.git diff --git a/utils/ghctags/Main.hs b/utils/ghctags/Main.hs index b3ed58f..4ba8157 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) @@ -293,7 +296,6 @@ boundThings modname lbinding = LitPat _ -> tl NPat _ _ _ -> tl -- form of literal pattern? NPlusKPat id _ _ _ -> thing id : tl - TypePat _ -> tl -- XXX need help here SigPatIn p _ -> patThings p tl SigPatOut p _ -> patThings p tl _ -> error "boundThings"