+ -------------------
+ -- RENAME and TYPECHECK
+ -------------------
+ (tc_msgs, maybe_tc_result)
+ <- {-# SCC "Typecheck-Rename" #-}
+ tcRnModule hsc_env (ms_hsc_src mod_summary) False rdr_module
+
+ ; printErrorsAndWarnings dflags tc_msgs
+ ; case maybe_tc_result of {
+ Nothing -> return Nothing ;
+ Just tc_result -> do {
+
+ -------------------
+ -- DESUGAR
+ -------------------
+ ; (warns, maybe_ds_result) <- {-# SCC "DeSugar" #-}
+ deSugar hsc_env tc_result
+ ; printBagOfWarnings dflags warns
+ ; return maybe_ds_result
+ }}}}}
+
+------------------------------
+
+hscFileCheck :: HscEnv -> ModSummary -> IO HscResult
+hscFileCheck hsc_env mod_summary = do {
+ -------------------
+ -- PARSE
+ -------------------
+ ; let dflags = hsc_dflags hsc_env
+ hspp_file = expectJust "hscFileFrontEnd" (ms_hspp_file mod_summary)
+ hspp_buf = ms_hspp_buf mod_summary
+
+ ; maybe_parsed <- myParseModule dflags hspp_file hspp_buf
+
+ ; case maybe_parsed of {
+ Left err -> do { printBagOfErrors dflags (unitBag err)
+ ; return HscFail } ;
+ Right rdr_module -> do {
+
+ -------------------
+ -- RENAME and TYPECHECK
+ -------------------
+ (tc_msgs, maybe_tc_result)
+ <- _scc_ "Typecheck-Rename"
+ tcRnModule hsc_env (ms_hsc_src mod_summary)
+ True{-save renamed syntax-}
+ rdr_module
+
+ ; printErrorsAndWarnings dflags tc_msgs
+ ; case maybe_tc_result of {
+ Nothing -> return (HscChecked rdr_module Nothing Nothing);
+ Just tc_result -> do
+ let md = ModDetails {
+ md_types = tcg_type_env tc_result,
+ md_exports = tcg_exports tc_result,
+ md_insts = tcg_insts tc_result,
+ md_rules = [panic "no rules"] }
+ -- Rules are CoreRules, not the
+ -- RuleDecls we get out of the typechecker
+ return (HscChecked rdr_module
+ (tcg_rn_decls tc_result)
+ (Just (tcg_binds tc_result,
+ tcg_rdr_env tc_result,
+ md)))
+ }}}}
+
+------------------------------
+hscBootBackEnd :: HscEnv -> ModSummary -> Maybe ModIface -> Maybe ModGuts -> IO HscResult
+-- For hs-boot files, there's no code generation to do
+
+hscBootBackEnd hsc_env mod_summary maybe_old_iface Nothing
+ = return HscFail
+hscBootBackEnd hsc_env mod_summary maybe_old_iface (Just ds_result)
+ = do { details <- mkBootModDetails hsc_env ds_result
+
+ ; (new_iface, no_change)
+ <- {-# SCC "MkFinalIface" #-}
+ mkIface hsc_env maybe_old_iface ds_result details
+
+ ; writeIfaceFile hsc_env (ms_location mod_summary) new_iface no_change
+
+ -- And the answer is ...
+ ; dumpIfaceStats hsc_env
+
+ ; return (HscRecomp details new_iface
+ False False Nothing)
+ }
+
+------------------------------
+hscBackEnd :: HscEnv -> ModSummary -> Maybe ModIface -> Maybe ModGuts -> IO HscResult
+
+hscBackEnd hsc_env mod_summary maybe_old_iface Nothing
+ = return HscFail
+
+hscBackEnd hsc_env mod_summary maybe_old_iface (Just ds_result)
+ = do { -- OMITTED:
+ -- ; seqList imported_modules (return ())
+
+ let one_shot = isOneShot (ghcMode dflags)
+ dflags = hsc_dflags hsc_env