[project @ 2002-11-19 12:34:55 by simonpj]
[ghc-hetmet.git] / ghc / compiler / compMan / CompManager.lhs
index c2237ea..f026f5b 100644 (file)
@@ -88,7 +88,7 @@ import DATA_IOREF     ( readIORef )
 import HscMain         ( hscThing, hscStmt, hscTcExpr )
 import Module          ( moduleUserString )
 import TcRnDriver      ( mkGlobalContext, getModuleContents )
-import Name            ( Name, NamedThing(..), isExternalName )
+import Name            ( Name, NamedThing(..), isExternalName, nameModule )
 import Id              ( idType )
 import Type            ( tidyType )
 import VarEnv          ( emptyTidyEnv )
@@ -267,7 +267,7 @@ cmInfoThing cmstate dflags id
      getFixity :: PersistentCompilerState -> Name -> Fixity
      getFixity pcs name
        | isExternalName name,
-         Just iface  <- lookupIface hpt pit name,
+         Just iface  <- lookupIface hpt pit (nameModule name),
          Just (FixitySig _ fixity _) <- lookupNameEnv (mi_fixities iface) name
        = fixity
        | otherwise
@@ -455,7 +455,7 @@ cmCompileExpr cmstate dflags expr
 cmUnload :: CmState -> DynFlags -> IO CmState
 cmUnload state@CmState{ gmode=mode, pcs=pcs } dflags
  = do -- Throw away the old home dir cache
-      emptyHomeDirCache
+      flushFinderCache
 
       -- Unload everything the linker knows about
       cm_unload mode dflags []
@@ -801,9 +801,7 @@ getValidLinkable old_linkables objects_allowed new_linkables summary
           <- if (not objects_allowed)
                then return Nothing
 
-               else case ml_obj_file (ms_location summary) of
-                       Just obj_fn -> maybe_getFileLinkable mod_name obj_fn
-                       Nothing     -> return Nothing
+               else findLinkable mod_name (ms_location summary)
 
        let old_linkable = findModuleLinkable_maybe old_linkables mod_name
 
@@ -847,20 +845,6 @@ getValidLinkable old_linkables objects_allowed new_linkables summary
        return (new_linkables' ++ new_linkables)
 
 
-maybe_getFileLinkable :: ModuleName -> FilePath -> IO (Maybe Linkable)
-maybe_getFileLinkable mod obj_fn
-   = do obj_exist <- doesFileExist obj_fn
-        if not obj_exist 
-         then return Nothing 
-         else 
-         do let stub_fn = case splitFilename3 obj_fn of
-                             (dir, base, ext) -> dir ++ "/" ++ base ++ ".stub_o"
-            stub_exist <- doesFileExist stub_fn
-            obj_time <- getModificationTime obj_fn
-            if stub_exist
-             then return (Just (LM obj_time mod [DotO obj_fn, DotO stub_fn]))
-             else return (Just (LM obj_time mod [DotO obj_fn]))
-
 hptLinkables :: HomePackageTable -> [Linkable]
 -- Get all the linkables from the home package table, one for each module
 -- Once the HPT is up to date, these are the ones we should link
@@ -1224,12 +1208,12 @@ summariseFile file
    = do hspp_fn <- preprocess file
         (srcimps,imps,mod_name) <- getImportsFromFile hspp_fn
 
-        let (path, basename, _ext) = splitFilename3 file
+        let (path, basename, ext) = splitFilename3 file
             -- GHC.Prim doesn't exist physically, so don't go looking for it.
             the_imps = filter (/= gHC_PRIM_Name) imps
 
-       (mod, location)
-          <- mkHomeModuleLocn mod_name (path ++ '/':basename) file
+       (mod, location) <- mkHomeModLocation mod_name True{-is a root-}
+                               path basename ext
 
         src_timestamp
            <- case ml_hs_file location of