[project @ 2004-10-08 17:32:06 by panne]
[ghc-hetmet.git] / ghc / compiler / compMan / CompManager.lhs
index 76902f2..289bd07 100644 (file)
@@ -4,47 +4,41 @@
 % The Compilation Manager
 %
 \begin{code}
-{-# OPTIONS -fvia-C #-}
 module CompManager ( 
     ModuleGraph, ModSummary(..),
 
     CmState,           -- abstract
 
-    cmInit,       -- :: GhciMode -> DynFlags -> IO CmState
+    cmInit,       -- :: GhciMode -> IO CmState
 
-    cmDepAnal,    -- :: CmState -> DynFlags -> [FilePath] -> IO ModuleGraph
+    cmDepAnal,    -- :: CmState -> [FilePath] -> IO ModuleGraph
 
-    cmLoadModules, -- :: CmState -> DynFlags -> ModuleGraph
+    cmLoadModules, -- :: CmState -> ModuleGraph
                   --    -> IO (CmState, Bool, [String])
 
-    cmUnload,     -- :: CmState -> DynFlags -> IO CmState
+    cmUnload,     -- :: CmState -> IO CmState
 
 #ifdef GHCI
     cmModuleIsInterpreted, -- :: CmState -> String -> IO Bool
 
-    cmSetContext,  -- :: CmState -> DynFlags -> [String] -> [String] -> IO CmState
+    cmSetContext,  -- :: CmState -> [String] -> [String] -> IO CmState
     cmGetContext,  -- :: CmState -> IO ([String],[String])
 
-    cmInfoThing,    -- :: CmState -> String -> IO (CmState, [(TyThing,Fixity)])
+    cmGetInfo,    -- :: CmState -> String -> IO (CmState, [(TyThing,Fixity)])
+    GetInfoResult,
     cmBrowseModule, -- :: CmState -> IO [TyThing]
 
     CmRunResult(..),
-    cmRunStmt,    -- :: CmState -> DynFlags -> String
-                  --    -> IO (CmState, CmRunResult)
+    cmRunStmt,         -- :: CmState -> String -> IO (CmState, CmRunResult)
 
-    cmTypeOfExpr,  -- :: CmState -> DynFlags -> String
-                  --   -> IO (CmState, Maybe String)
-
-    cmKindOfType,  -- :: CmState -> DynFlags -> String
-                  --   -> IO (CmState, Maybe String)
-
-    cmTypeOfName,  -- :: CmState -> Name -> IO (Maybe String)
+    cmTypeOfExpr,      -- :: CmState -> String -> IO (CmState, Maybe String)
+    cmKindOfType,      -- :: CmState -> String -> IO (CmState, Maybe String)
+    cmTypeOfName,      -- :: CmState -> Name -> IO (Maybe String)
 
     HValue,
-    cmCompileExpr, -- :: CmState -> DynFlags -> String 
-                  --   -> IO (CmState, Maybe HValue)
+    cmCompileExpr,     -- :: CmState -> String -> IO (CmState, Maybe HValue)
 
-    cmGetModInfo,              -- :: CmState -> (ModuleGraph, HomePackageTable)
+    cmGetModInfo,      -- :: CmState -> (ModuleGraph, HomePackageTable)
 
     cmSetDFlags,
     cmGetBindings,     -- :: CmState -> [TyThing]
@@ -82,9 +76,9 @@ import Maybes         ( expectJust, orElse, mapCatMaybes )
 import DATA_IOREF      ( readIORef )
 
 #ifdef GHCI
-import HscMain         ( hscThing, hscStmt, hscTcExpr, hscKcType )
+import HscMain         ( hscGetInfo, GetInfoResult, hscStmt, hscTcExpr, hscKcType )
 import TcRnDriver      ( mkExportEnv, getModuleContents )
-import IfaceSyn                ( IfaceDecl )
+import IfaceSyn                ( IfaceDecl, IfaceInst )
 import RdrName         ( GlobalRdrEnv, plusGlobalRdrEnv )
 import Name            ( Name )
 import NameEnv
@@ -95,6 +89,7 @@ import BasicTypes     ( Fixity )
 import Linker          ( HValue, unload, extendLinkEnv )
 import GHC.Exts                ( unsafeCoerce# )
 import Foreign
+import SrcLoc          ( SrcLoc )
 import Control.Exception as Exception ( Exception, try )
 #endif
 
@@ -187,7 +182,7 @@ cmSetContext cmstate toplevs exports = do
 
   let all_env = foldr plusGlobalRdrEnv export_env toplev_envs
   return cmstate{ cm_ic = old_ic { ic_toplev_scope = toplevs,
-                                  ic_exports      = exports,
+                                  ic_exports      = exports,
                                   ic_rn_gbl_env   = all_env } }
 
 mkTopLevEnv :: HomePackageTable -> String -> IO GlobalRdrEnv
@@ -219,9 +214,8 @@ cmSetDFlags cm_state dflags
 -- A string may refer to more than one TyThing (eg. a constructor,
 -- and type constructor), so we return a list of all the possible TyThings.
 
-cmInfoThing :: CmState -> String -> IO [(IfaceDecl,Fixity)]
-cmInfoThing cmstate id
-   = hscThing (cm_hsc cmstate) (cm_ic cmstate) id
+cmGetInfo :: CmState -> String -> IO [GetInfoResult]
+cmGetInfo cmstate id = hscGetInfo (cm_hsc cmstate) (cm_ic cmstate) id
 
 -- ---------------------------------------------------------------------------
 -- cmBrowseModule: get all the TyThings defined in a module
@@ -947,7 +941,8 @@ upsweep_mod hsc_env oldUI summary1 reachable_inc_me
               | otherwise = False
 
         compresult <- compile hsc_env_strictDC this_mod location 
-                             source_unchanged have_object mb_old_iface
+                       (ms_hs_date summary1) 
+                       source_unchanged have_object mb_old_iface
 
         case compresult of