@@ -52,7 +52,6 @@ import Data.Maybe
5252import Data.Tuple.Extra
5353import qualified Data.Map.Strict as Map
5454import System.FilePath
55−import System.Directory
5655import System.IO.Extra
5756import Data.Char
5857
@@ -84,19 +83,18 @@ computePackageDeps env pkg = do
8483
8584-- | Typecheck a single module using the supplied dependencies and packages.
8685typecheckModule
87− :: IdeOptions
88− -> HscEnv
86+ :: HscEnv
8987 -> [TcModuleResult]
9088 -> ParsedModule
9189 -> IO ([FileDiagnostic], Maybe TcModuleResult)
92−typecheckModule opt packageState deps pm =
90+typecheckModule packageState deps pm =
9391 fmap (either (, Nothing) (second Just)) $
9492 runGhcEnv packageState $
9593 catchSrcErrors $ do
9694 setupEnv deps
9795 (warnings, tcm) <- withWarnings $ \tweak ->
9896 GHC.typecheckModule pm{pm_mod_summary = tweak $ pm_mod_summary pm}
99− tcm2 <- mkTcModuleResult (optIfaceDir opt) tcm
97+ tcm2 <- mkTcModuleResult tcm
10098 return (warnings, tcm2)
10199
102100-- | Compile a single type-checked module to a 'CoreModule' value, or
@@ -138,30 +136,16 @@ addRelativeImport modu dflags = dflags
138136
139137mkTcModuleResult
140138 :: GhcMonad m
141− => InterfaceDirectory
142− -> TypecheckedModule
139+ => TypecheckedModule
143140 -> m TcModuleResult
144−mkTcModuleResult (InterfaceDirectory mbIfaceDir) tcm = do
145− session <- getSession
146− (iface,_) <- liftIO $ mkIfaceTc session Nothing Sf_None details tcGblEnv
147− liftIO $ whenJust mbIfaceDir $ \ifaceDir -> do
148− let path = ifaceDir </> file tcm
149− createDirectoryIfMissing True (takeDirectory path)
150− writeIfaceFile (hsc_dflags session) (replaceExtension path ".hi") iface
151− -- For now, we write .hie files whenever we write .hi files which roughly corresponds to
152− -- when we are building a package. It should be easily decoupable if that turns out to be
153− -- useful.
154− hieFile <- runHsc session $ mkHieFile (tcModSummary tcm) tcGblEnv (fromJust $ renamedSource tcm)
155− writeHieFile (replaceExtension path ".hie") hieFile
141+mkTcModuleResult tcm = do
142+ session <- getSession
143+ (iface, _) <- liftIO $ mkIfaceTc session Nothing Sf_None details tcGblEnv
156144 let mod_info = HomeModInfo iface details Nothing
157145 return $ TcModuleResult tcm mod_info
158146 where
159− file = ms_hspp_file . tcModSummary
160147 (tcGblEnv, details) = tm_internals_ tcm
161148
162−tcModSummary :: TypecheckedModule -> ModSummary
163−tcModSummary = pm_mod_summary . tm_parsed_module
164−
165149-- | Setup the environment that GHC needs according to our
166150-- best understanding (!)
167151setupEnv :: GhcMonad m => [TcModuleResult] -> m ()