[project @ 2005-06-02 08:51:17 by simonmar]
authorsimonmar <unknown>
Thu, 2 Jun 2005 08:51:17 +0000 (08:51 +0000)
committersimonmar <unknown>
Thu, 2 Jun 2005 08:51:17 +0000 (08:51 +0000)
Make GHC.depanal store the module graph in the session again.  Fixes
ghc -M.

ghc/compiler/main/GHC.hs

index 65a295e..192bfbf 100644 (file)
@@ -401,7 +401,11 @@ depanal (Session ref) excluded_mods = do
                     text "Chasing modules from: ",
                        hcat (punctuate comma (map pprTarget targets))]))
 
-  downsweep hsc_env old_graph excluded_mods
+  r <- downsweep hsc_env old_graph excluded_mods
+  case r of
+    Right mod_graph -> writeIORef ref hsc_env{ hsc_mod_graph = mod_graph }
+    _ -> return ()
+  return r
 
 {-
 -- | The result of load.
@@ -442,11 +446,8 @@ loadMsgs s@(Session ref) how_much msg_act
        -- were successfully loaded by inspecting the Session's HPT.
        mb_graph <- depanal s []
        case mb_graph of
-          Left msgs -> do msg_act msgs; return Failed
-          Right mod_graph -> do
-               hsc_env <- readIORef ref
-               writeIORef ref hsc_env{ hsc_mod_graph = mod_graph }
-               loadMsgs2 s how_much msg_act mod_graph 
+          Left msgs       -> do msg_act msgs; return Failed
+          Right mod_graph -> loadMsgs2 s how_much msg_act mod_graph 
 
 loadMsgs2 s@(Session ref) how_much msg_act mod_graph = do
        hsc_env <- readIORef ref