[project @ 2002-11-28 17:17:41 by simonpj]
[ghc-hetmet.git] / ghc / compiler / rename / RnHiFiles.lhs
index bdab40a..f14fb61 100644 (file)
@@ -14,14 +14,14 @@ module RnHiFiles (
 #include "HsVersions.h"
 
 import DriverState     ( v_GhcMode, isCompManagerMode )
-import DriverUtil      ( splitFilename, replaceFilenameSuffix )
+import DriverUtil      ( replaceFilenameSuffix )
 import CmdLineOpts     ( opt_IgnoreIfacePragmas )
 import Parser          ( parseIface )
 import HscTypes                ( ModIface(..), emptyModIface,
-                         ExternalPackageState(..), 
+                         ExternalPackageState(..), noDependencies,
                          VersionInfo(..), Usage(..),
                          lookupIfaceByModName, RdrExportItem, 
-                         WhetherHasOrphans, IsBootInterface,
+                         IsBootInterface,
                          DeclsMap, GatedDecl, IfaceInsts, IfaceRules, mkIfaceDecls,
                          AvailInfo, GenAvailInfo(..), ParsedIface(..), IfaceDeprecs,
                          Avails, availNames, availName, Deprecations(..)
@@ -69,7 +69,6 @@ import Outputable
 import Bag
 import BinIface                ( readBinIface )
 import Panic
-import Config
 
 import EXCEPTION as Exception
 import DATA_IOREF      ( readIORef )
@@ -135,18 +134,16 @@ loadInterface doc_str mod_name from
                        -- before we got to real imports.  
        other       -> 
 
-   traceRn (vcat [text "loadInterface" <+> brackets doc_str,
-                 ppr (dep_mods import_avails)])        `thenM_`
    let
-       mod_map  = dep_mods import_avails
+       mod_map  = imp_dep_mods import_avails
        mod_info = lookupModuleEnvByName mod_map mod_name
 
        hi_boot_file 
          = case (from, mod_info) of
-               (ImportByUser   is_boot, _)            -> is_boot
-               (ImportForUsage is_boot, _)            -> is_boot
-               (ImportBySystem, Just (_, _, is_boot)) -> is_boot
-               (ImportBySystem, Nothing)              -> False
+               (ImportByUser   is_boot, _)         -> is_boot
+               (ImportForUsage is_boot, _)         -> is_boot
+               (ImportBySystem, Just (_, is_boot)) -> is_boot
+               (ImportBySystem, Nothing)           -> False
                        -- We're importing a module we know absolutely
                        -- nothing about, so we assume it's from
                        -- another package, where we aren't doing 
@@ -154,8 +151,8 @@ loadInterface doc_str mod_name from
 
        redundant_source_import 
          = case (from, mod_info) of 
-               (ImportByUser True, Just (_, _, False)) -> True
-               other                                   -> False
+               (ImportByUser True, Just (_, False)) -> True
+               other                                -> False
    in
 
        -- Issue a warning for a redundant {- SOURCE -} import
@@ -227,15 +224,9 @@ loadInterface doc_str mod_name from
                                vers_rules = rule_vers,
                                vers_decls = decls_vers }
 
-       this_mod_name = moduleName this_mod
-       is_loaded m   =  m == this_mod_name 
-                     || maybeToBool (lookupIfaceByModName hpt pit m)
-               -- We treat the currently-being-compiled module as 'loaded' because
-               -- even though it isn't yet in the HIT or PIT; otherwise it gets
-               -- put into iImpModInfo, and then spat out into its own interface
-               -- file as a dependency
-
        -- Now add info about this module to the PIT
+       -- Even home modules loaded by this route (which only 
+       -- happens in OneShot mode) are put in the PIT
        has_orphans = pi_orphan iface
        new_pit   = extendModuleEnv pit mod mod_iface
        mod_iface = ModIface { mi_module = mod, mi_package = pi_pkg iface,
@@ -308,7 +299,7 @@ loadDecl mod (version_map, decls_map) (version, decl)
 
        new_version_map = extendNameEnv version_map main_name version
     in
-    traceRn (text "Loading" <+> ppr full_avail) `thenM_`
+--    traceRn (text "Loading" <+> ppr full_avail) `thenM_`
     returnM (new_version_map, new_decls_map)
 
 
@@ -426,7 +417,7 @@ loadInstDecl mod insts decl@(InstDecl inst_ty _ _ _ _)
        -- (Note that we do let the inst decl in if it mentions 
        --  no tycons at all.  Hence the null free_ty_names.)
     in
-    traceRn ((text "Load instance for" <+> ppr inst_ty') $$ ppr free_tcs)      `thenM_`
+--    traceRn ((text "Load instance for" <+> ppr inst_ty') $$ ppr free_tcs)    `thenM_`
     returnM ((gate_fn, (mod, decl)) `consBag` insts)
 
 
@@ -465,7 +456,7 @@ loadDeprecs (Just (Right prs)) = foldlM loadDeprec emptyNameEnv prs `thenM` \ en
                                 returnM (DeprecSome env)
 loadDeprec deprec_env (n, txt)
   = lookupGlobalOccRn n        `thenM` \ name ->
-    traceRn (text "Loaded deprecation(s) for" <+> ppr name <> colon <+> ppr txt) `thenM_`
+--    traceRn (text "Loaded deprecation(s) for" <+> ppr name <> colon <+> ppr txt) `thenM_`
     returnM (extendNameEnv deprec_env name (name,txt))
 \end{code}
 
@@ -685,7 +676,7 @@ ghcPrimIface :: ParsedIface
 ghcPrimIface = ParsedIface {
       pi_mod    = gHC_PRIM_Name,
       pi_pkg     = basePackage,
-      pi_deps    = ([],[]),
+      pi_deps    = noDependencies,
       pi_vers    = 1,
       pi_orphan  = False,
       pi_usages  = [],