-instance HsCompiler OneShotResult where
-
- hscCompile hsc_env mod_summary src_changed mb_old_iface mb_i_of_n = do
- -- One-shot mode needs a knot-tying mutable variable for interface files.
- -- See TcRnTypes.TcGblEnv.tcg_type_env_var.
- type_env_var <- liftIO $ newIORef emptyNameEnv
- let
- mod = ms_mod mod_summary
- hsc_env' = hsc_env{ hsc_type_env_var = Just (mod, type_env_var) }
- ---
- genericHscCompile oneShotMsg hsc_env' mod_summary src_changed
- mb_old_iface mb_i_of_n
-
- hscNoRecomp _old_iface = do
- withSession (liftIO . dumpIfaceStats)
- return HscNoRecomp
-
- hscRecompile = genericHscRecompile
-
- hscGenBootOutput tc_result mod_summary mb_old_iface = do
- (iface, changed, _) <- hscSimpleIface tc_result mb_old_iface
- hscWriteIface iface changed mod_summary
- return (HscRecomp False HscOneShotTag)
-
- hscGenOutput guts0 mod_summary mb_old_iface = do
- guts <- hscSimplify guts0
- (iface, changed, _details, cgguts)
- <- hscNormalIface guts mb_old_iface
- hscWriteIface iface changed mod_summary
- hasStub <- hscGenHardCode cgguts mod_summary
- return (HscRecomp hasStub HscOneShotTag)
+hscOneShotCompiler :: HsCompiler OneShotResult
+hscOneShotCompiler =
+ HsCompiler {
+
+ hscNoRecomp = \_old_iface -> do
+ withSession (liftIO . dumpIfaceStats)
+ return HscNoRecomp
+
+ , hscRecompile = genericHscRecompile hscOneShotCompiler
+
+ , hscBackend = \ tc_result mod_summary mb_old_hash -> do
+ hsc_env <- getSession
+ case hscTarget (hsc_dflags hsc_env) of
+ HscNothing -> return (HscRecomp False ())
+ _otherw -> genericHscBackend hscOneShotCompiler
+ tc_result mod_summary mb_old_hash
+
+ , hscGenBootOutput = \tc_result mod_summary mb_old_iface -> do
+ (iface, changed, _) <- hscSimpleIface tc_result mb_old_iface
+ hscWriteIface iface changed mod_summary
+ return (HscRecomp False ())
+
+ , hscGenOutput = \guts0 mod_summary mb_old_iface -> do
+ guts <- hscSimplify guts0
+ (iface, changed, _details, cgguts)
+ <- hscNormalIface guts mb_old_iface
+ hscWriteIface iface changed mod_summary
+ hasStub <- hscGenHardCode cgguts mod_summary
+ return (HscRecomp hasStub ())
+ }