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