summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lynagh <ian@well-typed.com>2013-02-28 02:21:19 +0000
committerIan Lynagh <ian@well-typed.com>2013-02-28 13:12:44 +0000
commitc0e581f75825ebfd4cfe75bef68a80a7fe611487 (patch)
tree7127aed1b8640e444c3167d67d471410f2c073dc
parent8fe04ebc9ad9de6f3cb6d2bb2b7e6420e4e18b5b (diff)
downloadhaskell-c0e581f75825ebfd4cfe75bef68a80a7fe611487.tar.gz
Small refactoring
pipeLoop now returns the final dflags, rather than having runPipeline' extract it from the end state.
-rw-r--r--compiler/main/DriverPipeline.hs9
1 files changed, 4 insertions, 5 deletions
diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs
index fa3b9dcad8..2f62438490 100644
--- a/compiler/main/DriverPipeline.hs
+++ b/compiler/main/DriverPipeline.hs
@@ -591,10 +591,9 @@ runPipeline' start_phase stop_phase hsc_env env input_fn
-- Execute the pipeline...
let state = PipeState{ hsc_env, maybe_loc, maybe_stub_o = maybe_stub_o }
- (state', output_fn) <- unP (pipeLoop start_phase input_fn) env state
+ (state', (dflags, output_fn)) <- unP (pipeLoop start_phase input_fn) env state
- let PipeState{ hsc_env=hsc_env', maybe_loc } = state'
- dflags = hsc_dflags hsc_env'
+ let PipeState{ maybe_loc } = state'
-- Sometimes, a compilation phase doesn't actually generate any output
-- (eg. the CPP phase when -fcpp is not turned on). If we end on this
@@ -682,14 +681,14 @@ phaseOutputFilename next_phase = do
-- outer pipeline loop
-- | pipeLoop runs phases until we reach the stop phase
-pipeLoop :: Phase -> FilePath -> CompPipeline FilePath
+pipeLoop :: Phase -> FilePath -> CompPipeline (DynFlags, FilePath)
pipeLoop phase input_fn = do
PipeEnv{stop_phase} <- getPipeEnv
dflags <- getDynFlags
let happensBefore' = happensBefore dflags
case () of
_ | phase `eqPhase` stop_phase -- All done
- -> return input_fn
+ -> return (dflags, input_fn)
| not (phase `happensBefore'` stop_phase)
-- Something has gone wrong. We'll try to cover all the cases when