diff options
author | Roland Senn <rsx@bluewin.ch> | 2021-01-01 14:01:41 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-01-07 00:12:09 -0500 |
commit | 1de2050edd8a2647e89a9269278a79b61892b59e (patch) | |
tree | 2c902e80f7b030d42ddc38770b878a5db1315e48 /ghc/GHCi/UI.hs | |
parent | 06982b6cc886d65aa325475ddfb4ad38c69b2d96 (diff) | |
download | haskell-1de2050edd8a2647e89a9269278a79b61892b59e.tar.gz |
GHCi: Fill field `DynFlags.dumpPrefix`. (Fixes #17500)
For interactive evaluations set the field `DynFlags.dumpPrefix` to the
GHCi internal module name. The GHCi module name for an interactive
evaluation is something like `Ghci9`.
To avoid user confusion, don't dump any data for GHCi internal evaluations.
Extend the comment for `DynFlags.dumpPrefix` and fix a little typo in a
comment about the GHCi internal module names.
Diffstat (limited to 'ghc/GHCi/UI.hs')
-rw-r--r-- | ghc/GHCi/UI.hs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/ghc/GHCi/UI.hs b/ghc/GHCi/UI.hs index 4a1b91a9fc..5beca7882d 100644 --- a/ghc/GHCi/UI.hs +++ b/ghc/GHCi/UI.hs @@ -458,7 +458,7 @@ interactiveUI config srcs maybe_exprs = do _ <- liftIO $ newStablePtr stderr -- Initialise buffering for the *interpreted* I/O system - (nobuffering, flush) <- initInterpBuffering + (nobuffering, flush) <- runInternal initInterpBuffering -- The initial set of DynFlags used for interactive evaluation is the same -- as the global DynFlags, plus -XExtendedDefaultRules and @@ -1215,6 +1215,10 @@ runStmt input step = do -- and should therefore not be used here. | otherwise -> do hsc_env <- GHC.getSession + let !ic = hsc_IC hsc_env -- Bang-pattern to avoid space leaks + setDumpFilePrefix ic + -- `-ddump-to-file` must work for normal GHCi compilations / + -- evaluations. (#17500) decls <- liftIO (hscParseDeclsWithLocation hsc_env source line input) run_decls decls where @@ -1270,6 +1274,13 @@ runStmt input step = do l = L loc in l (LetStmt noExtField (l (HsValBinds noExtField (ValBinds noExtField (unitBag (l bind)) [])))) + setDumpFilePrefix :: GHC.GhcMonad m => InteractiveContext -> m () -- #17500 + setDumpFilePrefix ic = do + dflags <- GHC.getInteractiveDynFlags + GHC.setInteractiveDynFlags dflags { dumpPrefix = Just (modStr ++ ".") } + where + modStr = moduleNameString $ moduleName $ icInteractiveModule $ ic + -- | Clean up the GHCi environment after a statement has run afterRunStmt :: GhciMonad m => (SrcSpan -> Bool) -> GHC.ExecResult -> m GHC.ExecResult |