Commit 36e1daf0 authored by Sylvain Henry's avatar Sylvain Henry Committed by Marge Bot

DynFlags: make listVisibleModuleNames take a UnitState

parent bd5810dc
......@@ -1997,9 +1997,9 @@ lookupModuleWithSuggestions' pkgs mod_map m mb_pn
(if originVisible origin then SuggestVisible else SuggestHidden)
name mod origin
listVisibleModuleNames :: DynFlags -> [ModuleName]
listVisibleModuleNames dflags =
map fst (filter visible (Map.toList (moduleNameProvidersMap (unitState dflags))))
listVisibleModuleNames :: UnitState -> [ModuleName]
listVisibleModuleNames state =
map fst (filter visible (Map.toList (moduleNameProvidersMap state)))
where visible (_, ms) = any originVisible (Map.elems ms)
-- | Lookup 'UnitInfo' for every preload unit, for every unit used to
......
......@@ -3516,7 +3516,7 @@ wrapIdentCompleterWithModifier modifChars fun = completeWordWithPrev Nothing wor
-- | Return a list of visible module names for autocompletion.
-- (NB: exposed != visible)
allVisibleModules :: DynFlags -> [ModuleName]
allVisibleModules dflags = listVisibleModuleNames dflags
allVisibleModules dflags = listVisibleModuleNames (unitState dflags)
completeExpression = completeQuotedWord (Just '\\') "\"" listFiles
completeIdentifier
......
......@@ -14,7 +14,8 @@ main =
dflags <- getSessionDynFlags
setSessionDynFlags dflags
dflags <- getSessionDynFlags
liftIO $ print (mkModuleName "GHC.Utils.Outputable" `elem` listVisibleModuleNames dflags)
let state = unitState dflags
liftIO $ print (mkModuleName "GHC.Utils.Outputable" `elem` listVisibleModuleNames state)
_ <- runGhc (Just libdir) $ do
dflags <- getSessionDynFlags
setSessionDynFlags (dflags {
......@@ -23,5 +24,6 @@ main =
(ModRenaming True [])]
})
dflags <- getSessionDynFlags
liftIO $ print (mkModuleName "GHC.Utils.Outputable" `elem` listVisibleModuleNames dflags)
let state = unitState dflags
liftIO $ print (mkModuleName "GHC.Utils.Outputable" `elem` listVisibleModuleNames state)
return ()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment