aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Waern <unknown>2007-08-03 18:48:08 +0000
committerDavid Waern <unknown>2007-08-03 18:48:08 +0000
commit1be867d0a2e2d5982b7c97964e171e6a37da1abb (patch)
tree80de63b36ec5cd245a19bf1acc820becdac79b2f /src
parent78cbe9fb937d3a03d74ed7d082061210421d551f (diff)
Load all targets explicitly (checkModule doesn't chase dependencies anymore)
Diffstat (limited to 'src')
-rw-r--r--src/Main.hs31
1 files changed, 14 insertions, 17 deletions
diff --git a/src/Main.hs b/src/Main.hs
index 47e00238..d8af437c 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -65,6 +65,7 @@ import Bag
import HscTypes
import Util ( handleDyn )
import ErrUtils ( printBagOfErrors )
+import BasicTypes
import FastString
#define FSLIT(x) (mkFastString# (x#))
@@ -338,37 +339,33 @@ sortAndCheckModules :: Session -> [FilePath] -> IO [CheckedMod]
sortAndCheckModules session files = do
-- load all argument files
+
targets <- mapM (\f -> guessTarget f Nothing) files
setTargets session targets
- putStrLn "argument targets:"
- mapM (putStrLn . showSDoc . pprTarget) targets
-- compute the dependencies and load them as well
+
allMods <- getSortedModuleGraph session
targets' <- mapM (\(_, f) -> guessTarget f Nothing) allMods
setTargets session targets'
- putStrLn "all targets:"
- targets'' <- getTargets session
- mapM (putStrLn . showSDoc . pprTarget) targets''
+
+ flag <- load session LoadAllTargets
+ when (failed flag) $
+ throwE "Failed to load all needed modules"
-- typecheck the argument modules
+
let argMods = filter ((`elem` files) . snd) allMods
checkedMods <- forM argMods $ \(mod, file) -> do
mbMod <- checkModule session (moduleName mod) False
- checkedMod <- case mbMod of
- Just m -> return m
- Nothing -> throwE ("Failed to load module: " ++ moduleString mod)
- return (mod, file, checkedMod)
+ case mbMod of
+ Just (CheckedModule a (Just b) (Just c) (Just d) _)
+ -> return (mod, file, (a,b,c,d))
+ _ -> throwE ("Failed to check module: " ++ moduleString mod)
+
+ return checkedMods
- ensureFullyChecked checkedMods
- where
- ensureFullyChecked modules
- | length modules' == length modules = return modules'
- | otherwise = throwE "Failed to check all modules properly"
- where modules' = [ (mod, f, (a,b,c,d)) |
- (mod, f, CheckedModule a (Just b) (Just c) (Just d) _)
- <- modules ]
run :: [Flag] -> [CheckedMod] -> Map Name Name -> IO ()
run flags modules extEnv = do