summaryrefslogtreecommitdiff
path: root/compiler/GHC.hs
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2022-02-17 15:56:06 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-02-23 14:00:00 -0500
commit7b7c6b950054e2f928463c47feee0846587b6ae1 (patch)
treeb9a67664507798d8125621e5f793358927d05c75 /compiler/GHC.hs
parentbc8de322d310d9dc879d3d3e7e0aa9157d8c2cf5 (diff)
downloadhaskell-7b7c6b950054e2f928463c47feee0846587b6ae1.tar.gz
Simplify/correct implementation of getModuleInfo
Diffstat (limited to 'compiler/GHC.hs')
-rw-r--r--compiler/GHC.hs15
1 files changed, 3 insertions, 12 deletions
diff --git a/compiler/GHC.hs b/compiler/GHC.hs
index 4d31ae1e3a..59790e3b68 100644
--- a/compiler/GHC.hs
+++ b/compiler/GHC.hs
@@ -1407,22 +1407,13 @@ data ModuleInfo = ModuleInfo {
-- We don't want HomeModInfo here, because a ModuleInfo applies
-- to package modules too.
+
-- | Request information about a loaded 'Module'
getModuleInfo :: GhcMonad m => Module -> m (Maybe ModuleInfo) -- XXX: Maybe X
getModuleInfo mdl = withSession $ \hsc_env -> do
- let mg = hsc_mod_graph hsc_env
- if mgElemModule mg mdl
+ if moduleUnitId mdl `S.member` hsc_all_home_unit_ids hsc_env
then liftIO $ getHomeModuleInfo hsc_env mdl
- else do
- {- if isHomeModule (hsc_dflags hsc_env) mdl
- then return Nothing
- else -} liftIO $ getPackageModuleInfo hsc_env mdl
- -- ToDo: we don't understand what the following comment means.
- -- (SDM, 19/7/2011)
- -- getPackageModuleInfo will attempt to find the interface, so
- -- we don't want to call it for a home module, just in case there
- -- was a problem loading the module and the interface doesn't
- -- exist... hence the isHomeModule test here. (ToDo: reinstate)
+ else liftIO $ getPackageModuleInfo hsc_env mdl
getPackageModuleInfo :: HscEnv -> Module -> IO (Maybe ModuleInfo)
getPackageModuleInfo hsc_env mdl