diff options
author | Shea Levy <shea@shealevy.com> | 2016-12-20 01:19:18 +0000 |
---|---|---|
committer | Tamar Christina <tamar@zhox.com> | 2016-12-20 01:25:48 +0000 |
commit | 27f79255634d9789f367273504545c1ebfad90a0 (patch) | |
tree | 9d2977cd52f18abcc824dae743ec7c4a3e6f04c0 /compiler/main/GHC.hs | |
parent | c0c1f801f4ca26f1db68ac527341a1cf051cb7d6 (diff) | |
download | haskell-27f79255634d9789f367273504545c1ebfad90a0.tar.gz |
Allow use of the external interpreter in stage1.
Summary:
Now that we have -fexternal-interpreter, we can lose most of the GHCI ifdefs.
This was originally added in https://phabricator.haskell.org/D2826
but that led to a compatibility issue with ghc 7.10.x on Windows.
That's fixed here and the revert reverted.
Reviewers: goldfire, hvr, austin, bgamari, Phyx
Reviewed By: Phyx
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2884
GHC Trac Issues: #13008
Diffstat (limited to 'compiler/main/GHC.hs')
-rw-r--r-- | compiler/main/GHC.hs | 38 |
1 files changed, 6 insertions, 32 deletions
diff --git a/compiler/main/GHC.hs b/compiler/main/GHC.hs index cf066d0ea7..59e42f9c75 100644 --- a/compiler/main/GHC.hs +++ b/compiler/main/GHC.hs @@ -91,7 +91,6 @@ module GHC ( -- * Interactive evaluation -#ifdef GHCI -- ** Executing statements execStmt, ExecOptions(..), execOptions, ExecResult(..), resumeExec, @@ -103,11 +102,10 @@ module GHC ( parseImportDecl, setContext, getContext, setGHCiMonad, getGHCiMonad, -#endif + -- ** Inspecting the current context getBindings, getInsts, getPrintUnqual, findModule, lookupModule, -#ifdef GHCI isModuleTrusted, moduleTrustReqs, getNamesInScope, getRdrNamesInScope, @@ -123,9 +121,8 @@ module GHC ( -- ** Looking up a Name parseName, -#endif lookupName, -#ifdef GHCI + -- ** Compiling expressions HValue, parseExpr, compileParsedExpr, InteractiveEval.compileExpr, dynCompileExpr, @@ -154,7 +151,6 @@ module GHC ( RunResult(..), runStmt, runStmtWithLocation, resume, -#endif -- * Abstract syntax elements @@ -290,14 +286,12 @@ module GHC ( #include "HsVersions.h" -#ifdef GHCI import ByteCodeTypes import InteractiveEval import InteractiveEvalTypes import TcRnDriver ( runTcInteractive ) import GHCi import GHCi.RemoteTypes -#endif import PprTyThing ( pprFamInst ) import HscMain @@ -469,9 +463,7 @@ withCleanupSession ghc = ghc `gfinally` cleanup liftIO $ do cleanTempFiles dflags cleanTempDirs dflags -#ifdef GHCI stopIServ hsc_env -- shut down the IServ -#endif -- exceptions will be blocked while we clean the temporary files, -- so there shouldn't be any difficulty if we receive further -- signals. @@ -889,10 +881,8 @@ typecheckModule pmod = do minf_rdr_env = Just (tcg_rdr_env tc_gbl_env), minf_instances = fixSafeInstances safe $ md_insts details, minf_iface = Nothing, - minf_safe = safe -#ifdef GHCI - ,minf_modBreaks = emptyModBreaks -#endif + minf_safe = safe, + minf_modBreaks = emptyModBreaks }} -- | Desugar a typechecked module. @@ -1080,10 +1070,8 @@ data ModuleInfo = ModuleInfo { minf_rdr_env :: Maybe GlobalRdrEnv, -- Nothing for a compiled/package mod minf_instances :: [ClsInst], minf_iface :: Maybe ModIface, - minf_safe :: SafeHaskellMode -#ifdef GHCI - ,minf_modBreaks :: ModBreaks -#endif + minf_safe :: SafeHaskellMode, + minf_modBreaks :: ModBreaks } -- We don't want HomeModInfo here, because a ModuleInfo applies -- to package modules too. @@ -1106,7 +1094,6 @@ getModuleInfo mdl = withSession $ \hsc_env -> do -- exist... hence the isHomeModule test here. (ToDo: reinstate) getPackageModuleInfo :: HscEnv -> Module -> IO (Maybe ModuleInfo) -#ifdef GHCI getPackageModuleInfo hsc_env mdl = do eps <- hscEPS hsc_env iface <- hscGetModuleInterface hsc_env mdl @@ -1125,11 +1112,6 @@ getPackageModuleInfo hsc_env mdl minf_safe = getSafeMode $ mi_trust iface, minf_modBreaks = emptyModBreaks })) -#else --- bogusly different for non-GHCI (ToDo) -getPackageModuleInfo _hsc_env _mdl = do - return Nothing -#endif getHomeModuleInfo :: HscEnv -> Module -> IO (Maybe ModuleInfo) getHomeModuleInfo hsc_env mdl = @@ -1145,9 +1127,7 @@ getHomeModuleInfo hsc_env mdl = minf_instances = md_insts details, minf_iface = Just iface, minf_safe = getSafeMode $ mi_trust iface -#ifdef GHCI ,minf_modBreaks = getModBreaks hmi -#endif })) -- | The list of top-level entities defined in a module @@ -1196,10 +1176,8 @@ modInfoIface = minf_iface modInfoSafe :: ModuleInfo -> SafeHaskellMode modInfoSafe = minf_safe -#ifdef GHCI modInfoModBreaks :: ModuleInfo -> ModBreaks modInfoModBreaks = minf_modBreaks -#endif isDictonaryId :: Id -> Bool isDictonaryId id @@ -1219,11 +1197,9 @@ findGlobalAnns deserialize target = withSession $ \hsc_env -> do ann_env <- liftIO $ prepareAnnotations hsc_env Nothing return (findAnns deserialize ann_env target) -#ifdef GHCI -- | get the GlobalRdrEnv for a session getGRE :: GhcMonad m => m GlobalRdrEnv getGRE = withSession $ \hsc_env-> return $ ic_rn_gbl_env (hsc_IC hsc_env) -#endif -- ----------------------------------------------------------------------------- @@ -1422,7 +1398,6 @@ lookupLoadedHomeModule mod_name = withSession $ \hsc_env -> Just mod_info -> return (Just (mi_module (hm_iface mod_info))) _not_a_home_module -> return Nothing -#ifdef GHCI -- | Check that a module is safe to import (according to Safe Haskell). -- -- We return True to indicate the import is safe and False otherwise @@ -1464,7 +1439,6 @@ obtainTermFromId :: GhcMonad m => Int -> Bool -> Id -> m Term obtainTermFromId bound force id = withSession $ \hsc_env -> liftIO $ InteractiveEval.obtainTermFromId hsc_env bound force id -#endif -- | Returns the 'TyThing' for a 'Name'. The 'Name' may refer to any -- entity known to GHC, including 'Name's defined using 'runStmt'. |