diff options
author | Edward Z. Yang <ezyang@cs.stanford.edu> | 2014-08-01 12:35:15 +0100 |
---|---|---|
committer | Edward Z. Yang <ezyang@cs.stanford.edu> | 2014-08-05 10:08:03 +0100 |
commit | de3f0644b8ff1748335c0fe07404dd4502a624e0 (patch) | |
tree | a09799babb438b9cd11fb045e1ac150c55d77de7 /ghc | |
parent | 36637914b0a874d7716d9b6a6c7e80540aae68af (diff) | |
download | haskell-de3f0644b8ff1748335c0fe07404dd4502a624e0.tar.gz |
Make PackageState an abstract type.
Summary: Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Test Plan: validate
Reviewers: simonpj, simonmar, hvr, austin
Subscribers: simonmar, relrod, ezyang, carter
Differential Revision: https://phabricator.haskell.org/D107
Diffstat (limited to 'ghc')
-rw-r--r-- | ghc/InteractiveUI.hs | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/ghc/InteractiveUI.hs b/ghc/InteractiveUI.hs index 96b78809d2..1b6256b8cb 100644 --- a/ghc/InteractiveUI.hs +++ b/ghc/InteractiveUI.hs @@ -39,15 +39,13 @@ import HscTypes ( tyThingParent_maybe, handleFlagWarnings, getSafeMode, hsc_IC, setInteractivePrintName ) import Module import Name -import Packages ( ModuleExport(..), trusted, getPackageDetails, exposed, - exposedModules, reexportedModules, pkgIdMap ) +import Packages ( trusted, getPackageDetails, listVisibleModuleNames ) import PprTyThing import RdrName ( getGRE_NameQualifier_maybes ) import SrcLoc import qualified Lexer import StringBuffer -import UniqFM ( eltsUFM ) import Outputable hiding ( printForUser, printForUserPartWay, bold ) -- Other random utilities @@ -1619,12 +1617,11 @@ isSafeModule m = do packageTrusted dflags md | thisPackage dflags == modulePackageKey md = True - | otherwise = trusted $ getPackageDetails (pkgState dflags) (modulePackageKey md) + | otherwise = trusted $ getPackageDetails dflags (modulePackageKey md) tallyPkgs dflags deps | not (packageTrustOn dflags) = ([], []) | otherwise = partition part deps - where state = pkgState dflags - part pkg = trusted $ getPackageDetails state pkg + where part pkg = trusted $ getPackageDetails dflags pkg ----------------------------------------------------------------------------- -- :browse @@ -2478,7 +2475,7 @@ completeIdentifier = wrapIdentCompleter $ \w -> do completeModule = wrapIdentCompleter $ \w -> do dflags <- GHC.getSessionDynFlags - let pkg_mods = allExposedModules dflags + let pkg_mods = allVisibleModules dflags loaded_mods <- liftM (map GHC.ms_mod_name) getLoadedModules return $ filter (w `isPrefixOf`) $ map (showPpr dflags) $ loaded_mods ++ pkg_mods @@ -2490,7 +2487,7 @@ completeSetModule = wrapIdentCompleterWithModifier "+-" $ \m w -> do imports <- GHC.getContext return $ map iiModuleName imports _ -> do - let pkg_mods = allExposedModules dflags + let pkg_mods = allVisibleModules dflags loaded_mods <- liftM (map GHC.ms_mod_name) getLoadedModules return $ loaded_mods ++ pkg_mods return $ filter (w `isPrefixOf`) $ map (showPpr dflags) modules @@ -2547,13 +2544,9 @@ wrapIdentCompleterWithModifier modifChars fun = completeWordWithPrev Nothing wor getModifier = find (`elem` modifChars) -- | Return a list of visible module names for autocompletion. -allExposedModules :: DynFlags -> [ModuleName] -allExposedModules dflags - = concatMap extract (filter exposed (eltsUFM pkg_db)) - where - pkg_db = pkgIdMap (pkgState dflags) - extract pkg = exposedModules pkg ++ map exportName (reexportedModules pkg) - -- Extract the *new* name, because that's what is user visible +-- (NB: exposed != visible) +allVisibleModules :: DynFlags -> [ModuleName] +allVisibleModules dflags = listVisibleModuleNames dflags completeExpression = completeQuotedWord (Just '\\') "\"" listFiles completeIdentifier |