summaryrefslogtreecommitdiff
path: root/ghc
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2020-05-07 18:03:36 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-06-13 02:13:02 -0400
commit72d086106d49bc18277f3a066e671e87e9b37a1b (patch)
treeff20c2926d4234c2cecc5d230859fc9fce09bb85 /ghc
parent7a02599afe836ac32c2e732671415d0afdfbf7fb (diff)
downloadhaskell-72d086106d49bc18277f3a066e671e87e9b37a1b.tar.gz
Refactor homeUnit
* rename thisPackage into homeUnit * document and refactor several Backpack things
Diffstat (limited to 'ghc')
-rw-r--r--ghc/GHCi/UI.hs10
1 files changed, 5 insertions, 5 deletions
diff --git a/ghc/GHCi/UI.hs b/ghc/GHCi/UI.hs
index 3db323c9a3..714b1d3fa4 100644
--- a/ghc/GHCi/UI.hs
+++ b/ghc/GHCi/UI.hs
@@ -2054,7 +2054,7 @@ keepPackageImports = filterM is_pkg_import
= do e <- MC.try $ GHC.findModule mod_name (fmap sl_fs $ ideclPkgQual d)
case e :: Either SomeException Module of
Left _ -> return False
- Right m -> return (not (isHomeModule m))
+ Right m -> return (not (isMainUnitModule m))
where
mod_name = unLoc (ideclName d)
@@ -2359,7 +2359,7 @@ isSafeModule m = do
mname = GHC.moduleNameString $ GHC.moduleName m
packageTrusted dflags md
- | thisPackage dflags == moduleUnit md = True
+ | isHomeModule dflags md = True
| otherwise = unitIsTrusted $ unsafeGetUnitInfo dflags (moduleUnit md)
tallyPkgs dflags deps | not (packageTrustOn dflags) = (S.empty, S.empty)
@@ -4206,8 +4206,8 @@ lookupModule mName = lookupModuleName (GHC.mkModuleName mName)
lookupModuleName :: GHC.GhcMonad m => ModuleName -> m Module
lookupModuleName mName = GHC.lookupModule mName Nothing
-isHomeModule :: Module -> Bool
-isHomeModule m = GHC.moduleUnit m == mainUnitId
+isMainUnitModule :: Module -> Bool
+isMainUnitModule m = GHC.moduleUnit m == mainUnitId
-- TODO: won't work if home dir is encoded.
-- (changeDirectory may not work either in that case.)
@@ -4231,7 +4231,7 @@ wantInterpretedModuleName modname = do
modl <- lookupModuleName modname
let str = moduleNameString modname
dflags <- getDynFlags
- when (GHC.moduleUnit modl /= thisPackage dflags) $
+ unless (isHomeModule dflags modl) $
throwGhcException (CmdLineError ("module '" ++ str ++ "' is from another package;\nthis command requires an interpreted module"))
is_interpreted <- GHC.moduleIsInterpreted modl
when (not is_interpreted) $