diff options
author | Sylvain Henry <sylvain@haskus.fr> | 2021-02-12 19:51:19 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-03-03 08:12:39 -0500 |
commit | 38748d5fb44dc6e7bc324d0b0c4aff8580d0733a (patch) | |
tree | c8b565bcf6bacbbac1f5997bc67552411ba7b61c /ghc | |
parent | fe4202cef72311e5763d8f176812885e05fe0465 (diff) | |
download | haskell-38748d5fb44dc6e7bc324d0b0c4aff8580d0733a.tar.gz |
Minor simplification for leak indicators
Avoid returning a lazy panic value when leak indicators are disabled.
Diffstat (limited to 'ghc')
-rw-r--r-- | ghc/GHCi/UI.hs | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/ghc/GHCi/UI.hs b/ghc/GHCi/UI.hs index d48bf467f5..2f0dfcde8d 100644 --- a/ghc/GHCi/UI.hs +++ b/ghc/GHCi/UI.hs @@ -1954,23 +1954,26 @@ loadModule' files = do -- as a ToDo for now. hsc_env <- GHC.getSession - - -- Grab references to the currently loaded modules so that we can - -- see if they leak. let !dflags = hsc_dflags hsc_env - leak_indicators <- if gopt Opt_GhciLeakCheck dflags - then liftIO $ getLeakIndicators hsc_env - else return (panic "no leak indicators") - - -- unload first - _ <- GHC.abandonAll - clearAllTargets - GHC.setTargets targets - success <- doLoadAndCollectInfo False LoadAllTargets - when (gopt Opt_GhciLeakCheck dflags) $ - liftIO $ checkLeakIndicators dflags leak_indicators - return success + let load_module = do + -- unload first + _ <- GHC.abandonAll + clearAllTargets + + GHC.setTargets targets + doLoadAndCollectInfo False LoadAllTargets + + if gopt Opt_GhciLeakCheck dflags + then do + -- Grab references to the currently loaded modules so that we can see if + -- they leak. + leak_indicators <- liftIO $ getLeakIndicators hsc_env + success <- load_module + liftIO $ checkLeakIndicators dflags leak_indicators + return success + else + load_module -- | @:add@ command addModule :: GhciMonad m => [FilePath] -> m () |