summaryrefslogtreecommitdiff
path: root/ghc
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2020-03-16 15:00:25 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-04-21 06:39:32 -0400
commit6655f93324b7f1d30a6baaedfecae455d5e08e39 (patch)
treee0a260f8b69d3cfcdf6d890849b88933fe6f3f6b /ghc
parentbca02fca0119354a6201fd5d019a553015ba2dd8 (diff)
downloadhaskell-6655f93324b7f1d30a6baaedfecae455d5e08e39.tar.gz
Use ParserFlags in GHC.Runtime.Eval (#17957)
Instead of passing `DynFlags` to functions such as `isStmt` and `hasImport` in `GHC.Runtime.Eval` we pass `ParserFlags`. It's a much simpler structure that can be created purely with `mkParserFlags'`.
Diffstat (limited to 'ghc')
-rw-r--r--ghc/GHCi/UI.hs8
1 files changed, 4 insertions, 4 deletions
diff --git a/ghc/GHCi/UI.hs b/ghc/GHCi/UI.hs
index be3c75f556..2416fd9d9d 100644
--- a/ghc/GHCi/UI.hs
+++ b/ghc/GHCi/UI.hs
@@ -1168,7 +1168,7 @@ enqueueCommands cmds = do
-- The return value True indicates success, as in `runOneCommand`.
runStmt :: GhciMonad m => String -> SingleStep -> m (Maybe GHC.ExecResult)
runStmt input step = do
- dflags <- GHC.getInteractiveDynFlags
+ pflags <- Lexer.mkParserFlags <$> GHC.getInteractiveDynFlags
-- In GHCi, we disable `-fdefer-type-errors`, as well as `-fdefer-type-holes`
-- and `-fdefer-out-of-scope-variables` for **naked expressions**. The
-- declarations and statements are not affected.
@@ -1177,7 +1177,7 @@ runStmt input step = do
let source = progname st
let line = line_number st
- if | GHC.isStmt dflags input -> do
+ if | GHC.isStmt pflags input -> do
hsc_env <- GHC.getSession
mb_stmt <- liftIO (runInteractiveHsc hsc_env (hscParseStmtWithLocation source line input))
case mb_stmt of
@@ -1187,13 +1187,13 @@ runStmt input step = do
Just stmt ->
run_stmt stmt
- | GHC.isImport dflags input -> run_import
+ | GHC.isImport pflags input -> run_import
-- Every import declaration should be handled by `run_import`. As GHCi
-- in general only accepts one command at a time, we simply throw an
-- exception when the input contains multiple commands of which at least
-- one is an import command (see #10663).
- | GHC.hasImport dflags input -> throwGhcException
+ | GHC.hasImport pflags input -> throwGhcException
(CmdLineError "error: expecting a single import declaration")
-- Otherwise assume a declaration (or a list of declarations)