Combine treatment of vanialla/GADT data decls, and fix assert failure
[ghc-hetmet.git] / utils / ghctags / GhcTags.hs
index 5237bbc..e74b2d1 100644 (file)
@@ -251,17 +251,12 @@ boundValues :: ModuleName -> HsGroup Name -> [FoundThing]
 boundValues mod group =
   let vals = case hs_valds group of
                ValBindsOut nest _sigs ->
-                   [ x | (_rec, binds) <- nest, bind <- bagToList binds,
-                              x <- boundThings mod bind ]
+                   [ x | (_rec, binds) <- nest
+                       , bind <- bagToList binds
+                       , x <- boundThings mod bind ]
                _other -> error "boundValues"
-      tys = concat $ map tyBound (hs_tyclds group)
-            where tyBound ltcd = case unLoc ltcd of
-                                   ForeignType { tcdLName = n } -> [found n]
-                                   TyData { tcdLName = tycon, tcdCons = cons } ->
-                                       dataNames tycon cons
-                                   TySynonym { tcdLName = n } -> [found n]
-                                   ClassDecl { tcdLName = n } -> [found n]
-                                   _ -> error "boundValues: tys"
+      tys = [ n | ns <- map (tyClDeclNames . unLoc) (hs_tyclds group)
+                , n <- map found ns ]
       fors = concat $ map forBound (hs_fords group)
              where forBound lford = case unLoc lford of
                                       ForeignImport n _ _ -> [found n]
@@ -336,7 +331,7 @@ getfoundthings (FileData _filename things _src_lines) = things
 
 dumpthing :: Bool -> FoundThing -> String
 dumpthing showmod (FoundThing modname name loc) =
-       fullname ++ "\t" ++ filename ++ "\t" ++ (show $ line + 1)
+       fullname ++ "\t" ++ filename ++ "\t" ++ (show line)
     where line = srcLocLine loc
           filename = unpackFS $ srcLocFile loc
           fullname = if showmod then moduleNameString modname ++ "." ++ name