[project @ 2002-10-17 14:26:16 by simonmar]
[ghc-hetmet.git] / ghc / compiler / compMan / CompManager.lhs
index 64b332e..ad580a1 100644 (file)
@@ -319,8 +319,11 @@ cmRunStmt cmstate@CmState{ hpt=hpt, pcs=pcs, ic=icontext }
 
                case either_hvals of
                    Left e -> do
-                       return ( cmstate{ pcs=new_pcs, ic=new_ic }, 
-                                CmRunException e )
+                       -- on error, keep the *old* interactive context,
+                       -- so that 'it' is not bound to something
+                       -- that doesn't exist.
+                       return ( cmstate{ pcs=new_pcs }, CmRunException e )
+
                    Right hvals -> do
                        -- Get the newly bound things, and bind them.  
                        -- Don't need to delete any shadowed bindings;
@@ -452,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 []
@@ -1221,21 +1224,22 @@ 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 
                  Nothing     -> noHsFileErr mod_name
                  Just src_fn -> getModificationTime src_fn
 
-        return (ModSummary mod
-                           location{ml_hspp_file=Just hspp_fn}
-                           srcimps the_imps src_timestamp)
+        return (ModSummary { ms_mod = mod, 
+                             ms_location = location{ml_hspp_file=Just hspp_fn},
+                             ms_srcimps = srcimps, ms_imps = the_imps,
+                            ms_hs_date = src_timestamp })
 
 -- Summarise a module, and pick up source and timestamp.
 summarise :: Module -> ModLocation -> Maybe ModSummary