@@ -36,6 +36,7 @@ import Control.Monad.Extra (findM, whenJust)
36
36
37
37
import qualified GHC
38
38
import GHC.Utils.Outputable (ppr )
39
+ import qualified GHC.Types.Avail as GHC (availNames )
39
40
import qualified GHC.Types.Basic as GHC (TupleSort (.. ), isPromoted )
40
41
import qualified GHC.Iface.Type as GHC (
41
42
IfaceTyLit (.. ), IfaceTyConSort (.. ), IfaceTyCon (.. ), IfaceTyConInfo (.. ))
@@ -81,8 +82,7 @@ import Glean.Util.Range
81
82
Haddock's Interface type has all the ASTs for the declarations
82
83
in addition to the Hie.
83
84
84
- - index exports
85
- - can we tag Names correctly with exportedness?
85
+ - map Name to exportedness?
86
86
87
87
- exclude generated names in a cleaner way
88
88
@@ -350,10 +350,19 @@ indexHieFile writer srcPaths path hie = do
350
350
nameMap :: Map GHC. Name Hs. Name
351
351
nameMap = Map. fromList names
352
352
353
+ eNames <- forM (concatMap GHC. availNames (hie_exports hie)) $ \ name ->
354
+ case Map. lookup name nameMap of
355
+ Just hsName -> return $ Just hsName
356
+ Nothing -> case nameModule_maybe name of
357
+ Nothing -> return Nothing -- shouldn't happen
358
+ Just m -> do
359
+ mod <- if m == smod then return modfact else mkModule m
360
+ Just <$> mkName name mod (Hs. NameSort_external def)
361
+
353
362
produceDeclInfo nameMap declInfo
354
363
355
364
Glean. makeFact_ @ Hs. ModuleDeclarations $ Hs. ModuleDeclarations_key
356
- modfact (map snd names)
365
+ modfact (map snd names) (catMaybes eNames)
357
366
358
367
let refs = Map. fromListWith (Map. unionWith (++) )
359
368
[ (n, Map. singleton kind [span ])
0 commit comments