aboutsummaryrefslogtreecommitdiff
path: root/src/Main.hs
diff options
context:
space:
mode:
authorDavid Waern <davve@dtek.chalmers.se>2007-10-18 22:03:20 +0000
committerDavid Waern <davve@dtek.chalmers.se>2007-10-18 22:03:20 +0000
commit3fdfcf2a507667327fc6b0e1c95cc9898fc1f9b6 (patch)
treec04142ff36153395424558d12540f9162654a8e3 /src/Main.hs
parent54d9edbb47657ba67b5b1c5248f295c772bf2948 (diff)
Add support for --read-interface again
Diffstat (limited to 'src/Main.hs')
-rw-r--r--src/Main.hs17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/Main.hs b/src/Main.hs
index c900529c..8ddea3e9 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -105,14 +105,18 @@ main = handleTopExceptions $ do
libDir <- handleEasyFlags flags fileArgs
-- initialize GHC
- let ghcFlags = makeGhcFlags flags
+ let ghcFlags = getGhcFlags flags
(session, dynflags) <- startGhc libDir ghcFlags
-- get the -use-package packages, load them in GHC,
-- and try to get the corresponding installed HaddockPackages
let usePackages = [ pkg | Flag_UsePackage pkg <- flags ]
pkgInfos <- loadPackages session usePackages
- packages <- getHaddockPackages pkgInfos
+ packages'' <- getHaddockPackages pkgInfos
+
+ -- get packages via --read-interface
+ packages' <- getHaddockPackages' (getIfacePairs flags)
+ let packages = packages'' ++ packages'
-- typecheck argument modules using GHC
modules <- typecheckFiles session fileArgs
@@ -129,7 +133,7 @@ main = handleTopExceptions $ do
render flags interfaces
-- last but not least, dump the interface file!
- dumpInterfaceFile homeLinks flags
+ dumpInterfaceFile (map ghcModule modules) homeLinks flags
-------------------------------------------------------------------------------
@@ -217,14 +221,15 @@ render flags interfaces = do
-------------------------------------------------------------------------------
-dumpInterfaceFile :: LinkEnv -> [Flag] -> IO ()
-dumpInterfaceFile homeLinks flags =
+dumpInterfaceFile :: [Module] -> LinkEnv -> [Flag] -> IO ()
+dumpInterfaceFile modules homeLinks flags =
case [str | Flag_DumpInterface str <- flags] of
[] -> return ()
fs -> let filename = last fs in writeInterfaceFile filename ifaceFile
where
ifaceFile = InterfaceFile {
- ifLinkEnv = homeLinks
+ ifModules = modules,
+ ifLinkEnv = homeLinks
}