- ; mb_res <- case target of
- HscNothing -> return (Just ([], [], NoStubs, hpcInfo, emptyModBreaks))
- _ -> do (binds_cvr,ds_hpc_info, modBreaks)
- <- if (opt_Hpc
- || target == HscInterpreted)
- && (not (isHsBoot hsc_src))
- then addCoverageTicksToBinds dflags mod mod_loc (typeEnvTyCons type_env) binds
- else return (binds, hpcInfo, emptyModBreaks)
- initDs hsc_env mod rdr_env type_env $ do
- { core_prs <- dsTopLHsBinds auto_scc binds_cvr
- ; (ds_fords, foreign_prs) <- dsForeigns fords
- ; let all_prs = foreign_prs ++ core_prs
- ; ds_rules <- mapM dsRule rules
- ; return (all_prs, catMaybes ds_rules, ds_fords, ds_hpc_info, modBreaks)
- }
- ; case mb_res of {
- Nothing -> return Nothing ;
- Just (all_prs, ds_rules, ds_fords,ds_hpc_info, modBreaks) -> do
+ ; (msgs, mb_res)
+ <- case target of
+ HscNothing ->
+ return (emptyMessages,
+ Just ([], nilOL, [], [], NoStubs, hpcInfo, emptyModBreaks))
+ _ -> do
+ (binds_cvr,ds_hpc_info, modBreaks)
+ <- if (opt_Hpc
+ || target == HscInterpreted)
+ && (not (isHsBoot hsc_src))
+ then addCoverageTicksToBinds dflags mod mod_loc
+ (typeEnvTyCons type_env) binds
+ else return (binds, hpcInfo, emptyModBreaks)
+ initDs hsc_env mod rdr_env type_env $ do
+ do { ds_ev_binds <- dsEvBinds ev_binds
+ ; core_prs <- dsTopLHsBinds auto_scc binds_cvr
+ ; (spec_prs, spec_rules) <- dsImpSpecs imp_specs
+ ; (ds_fords, foreign_prs) <- dsForeigns fords
+ ; ds_rules <- mapMaybeM dsRule rules
+ ; ds_vects <- mapM dsVect vects
+ ; let hpc_init
+ | opt_Hpc = hpcInitCode mod ds_hpc_info
+ | otherwise = empty
+ ; return ( ds_ev_binds
+ , foreign_prs `appOL` core_prs `appOL` spec_prs
+ , spec_rules ++ ds_rules, ds_vects
+ , ds_fords `appendStubC` hpc_init
+ , ds_hpc_info, modBreaks) }
+
+ ; case mb_res of {
+ Nothing -> return (msgs, Nothing) ;
+ Just (ds_ev_binds, all_prs, all_rules, ds_vects, ds_fords,ds_hpc_info, modBreaks) -> do