isEmptyOccSet, intersectOccSet, intersectsOccSet,
occNameFS, isTcOcc )
import Module ( Module, moduleFS,
- ModLocation(..), mkSysModuleFS, moduleUserString,
+ ModLocation(..), mkModuleFS, moduleString,
ModuleEnv, emptyModuleEnv, lookupModuleEnv,
extendModuleEnv_C
)
import Monad ( when )
import List ( insert )
import Maybes ( orElse, mapCatMaybes, isNothing, isJust,
- fromJust, expectJust, MaybeErr(..) )
+ expectJust, MaybeErr(..) )
\end{code}
-- Debug printing
; when (isJust pp_orphs && dopt Opt_WarnOrphans dflags)
- (printDump (fromJust pp_orphs))
+ (printDump (expectJust "mkIface" pp_orphs))
; when (dopt Opt_D_dump_hi_diffs dflags) (printDump pp_diffs)
; dumpIfSet_dyn dflags Opt_D_dump_hi "FINAL INTERFACE"
(pprModIface new_iface)
-----------------------------
-writeIfaceFile :: HscEnv -> ModLocation -> ModIface -> Bool -> IO ()
--- Write the interface file, if necessary
-writeIfaceFile hsc_env location new_iface no_change_at_all
- | no_change_at_all = return ()
- | ghc_mode == Interactive = return ()
- | ghc_mode == JustTypecheck = return ()
- | otherwise
- = do { createDirectoryHierarchy (directoryOf hi_file_path)
- ; writeBinIface hi_file_path new_iface }
- where
- ghc_mode = ghcMode (hsc_dflags hsc_env)
- hi_file_path = ml_hi_file location
+writeIfaceFile :: ModLocation -> ModIface -> IO ()
+writeIfaceFile location new_iface
+ = do createDirectoryHierarchy (directoryOf hi_file_path)
+ writeBinIface hi_file_path new_iface
+ where hi_file_path = ml_hi_file location
-----------------------------
-- Group by module and sort by occurrence
-- This keeps the list in canonical order
mkIfaceExports exports
- = [ (mkSysModuleFS fs, eltsFM avails)
+ = [ (mkModuleFS fs, eltsFM avails)
| (fs, avails) <- fmToList groupFM
]
where
checkOldIface hsc_env mod_summary source_unchanged maybe_iface
= do { showPass (hsc_dflags hsc_env)
- ("Checking old interface for " ++ moduleUserString (ms_mod mod_summary)) ;
+ ("Checking old interface for " ++ moduleString (ms_mod mod_summary)) ;
; initIfaceCheck hsc_env $
check_old_iface mod_summary source_unchanged maybe_iface
-- If the source has changed and we're in interactive mode, avoid reading
-- an interface; just return the one we might have been supplied with.
- getGhciMode `thenM` \ ghci_mode ->
- if (ghci_mode == Interactive || ghci_mode == JustTypecheck)
+ getGhcMode `thenM` \ ghc_mode ->
+ if (ghc_mode == Interactive || ghc_mode == JustTypecheck)
&& not source_unchanged then
returnM (outOfDate, maybe_iface)
else
-- CHECK EXPORT LIST
if checkExportList maybe_old_export_vers new_export_vers then
out_of_date_vers (ptext SLIT(" Export list changed"))
- (fromJust maybe_old_export_vers)
+ (expectJust "checkModUsage" maybe_old_export_vers)
new_export_vers
else