diff options
author | Sylvain Henry <sylvain@haskus.fr> | 2021-05-27 10:11:04 +0200 |
---|---|---|
committer | Sylvain Henry <sylvain@haskus.fr> | 2021-06-07 11:19:35 +0200 |
commit | 3a90814fdf5800927ef404d46459223b2ba283ce (patch) | |
tree | 134e63fcfb5dd5d4bf4f6182dc180cd370f4759f /utils/check-exact | |
parent | 4dc681c7c0345ee8ae268749d98b419dabf6a3bc (diff) | |
download | haskell-3a90814fdf5800927ef404d46459223b2ba283ce.tar.gz |
Parser: make less DynFlags dependent
This is an attempt at reducing the number of dependencies of the Parser
(as reported by CountParserDeps). Modules in GHC.Parser.* don't import
GHC.Driver.Session directly anymore.
Sadly some GHC.Driver.* modules are still transitively imported and the
number of dependencies didn't decrease. But it's a step in the right
direction.
Diffstat (limited to 'utils/check-exact')
-rw-r--r-- | utils/check-exact/Parsers.hs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/utils/check-exact/Parsers.hs b/utils/check-exact/Parsers.hs index 5d8b180cd4..cb6af2ad94 100644 --- a/utils/check-exact/Parsers.hs +++ b/utils/check-exact/Parsers.hs @@ -278,7 +278,8 @@ postParseTransform parseRes = fmap mkAnns parseRes initDynFlags :: GHC.GhcMonad m => FilePath -> m GHC.DynFlags initDynFlags file = do dflags0 <- GHC.getSessionDynFlags - src_opts <- GHC.liftIO $ GHC.getOptionsFromFile dflags0 file + let parser_opts0 = GHC.initParserOpts dflags0 + src_opts <- GHC.liftIO $ GHC.getOptionsFromFile parser_opts0 file (dflags1, _, _) <- GHC.parseDynamicFilePragma dflags0 src_opts -- Turn this on last to avoid T10942 let dflags2 = dflags1 `GHC.gopt_set` GHC.Opt_KeepRawTokenStream @@ -304,7 +305,8 @@ initDynFlagsPure fp s = do -- as long as `parseDynamicFilePragma` is impure there seems to be -- no reason to use it. dflags0 <- GHC.getSessionDynFlags - let pragmaInfo = GHC.getOptions dflags0 (GHC.stringToStringBuffer $ s) fp + let parser_opts0 = GHC.initParserOpts dflags0 + let pragmaInfo = GHC.getOptions parser_opts0 (GHC.stringToStringBuffer $ s) fp (dflags1, _, _) <- GHC.parseDynamicFilePragma dflags0 pragmaInfo -- Turn this on last to avoid T10942 let dflags2 = dflags1 `GHC.gopt_set` GHC.Opt_KeepRawTokenStream |