[project @ 2002-05-14 08:17:38 by matthewc]
[ghc-hetmet.git] / ghc / compiler / main / DriverPipeline.hs
index b979232..b567817 100644 (file)
@@ -44,6 +44,9 @@ import CmdLineOpts
 import Config
 import Panic
 import Util
+import Maybes          ( expectJust )
+
+import ParserCoreUtils ( getCoreModuleName )
 
 #ifdef GHCI
 import Time            ( getClockTime )
@@ -514,7 +517,14 @@ run_phase Hsc basename suff input_fn output_fn
        writeIORef v_HCHeader cc_injects
 
   -- gather the imports and module name
-        (srcimps,imps,mod_name) <- getImportsFromFile input_fn
+        (srcimps,imps,mod_name) <- 
+            if extcoreish_suffix suff
+            then do
+               -- no explicit imports in ExtCore input.
+              m <- getCoreModuleName input_fn
+              return ([], [], mkModuleName m)
+            else 
+              getImportsFromFile input_fn
 
   -- build a ModuleLocation to pass to hscMain.
        (mod, location')
@@ -542,7 +552,7 @@ run_phase Hsc basename suff input_fn output_fn
                   -- THIS COMPILATION, then use that to determine if the 
                   -- source is unchanged.
                | Just x <- expl_o_file, todo == StopBefore Ln  =  x
-               | otherwise = unJust "source_unchanged" (ml_obj_file location)
+               | otherwise = expectJust "source_unchanged" (ml_obj_file location)
 
        source_unchanged <- 
           if not (do_recomp && ( todo == DoLink || todo == StopBefore Ln ))
@@ -1062,8 +1072,8 @@ compile ghci_mode summary source_unchanged have_object
 
    let verb      = verbosity dyn_flags
    let location   = ms_location summary
-   let input_fn   = unJust "compile:hs" (ml_hs_file location) 
-   let input_fnpp = unJust "compile:hspp" (ml_hspp_file location)
+   let input_fn   = expectJust "compile:hs" (ml_hs_file location) 
+   let input_fnpp = expectJust "compile:hspp" (ml_hspp_file location)
 
    when (verb >= 2) (hPutStrLn stderr ("compile: input file " ++ input_fnpp))