From: sof Date: Wed, 20 Mar 2002 20:21:15 +0000 (+0000) Subject: [project @ 2002-03-20 20:21:15 by sof] X-Git-Tag: Approx_11550_changesets_converted~2240 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=1dc23a471efc6e37cc4c04f0908e0cde55dd689d;p=ghc-hetmet.git [project @ 2002-03-20 20:21:15 by sof] findPackageMod: for source imports, restrict ourselves to looking for hi-boots only --- diff --git a/ghc/compiler/main/Finder.lhs b/ghc/compiler/main/Finder.lhs index ce01c28..082891e 100644 --- a/ghc/compiler/main/Finder.lhs +++ b/ghc/compiler/main/Finder.lhs @@ -61,7 +61,7 @@ findModuleDep name is_source = do { j <- maybeHomeModule name is_source ; case j of Just home_module -> return (Just home_module) - Nothing -> findPackageMod name False + Nothing -> findPackageMod name False is_source } maybeHomeModule :: ModuleName -> Bool -> IO (Maybe (Module, ModuleLocation)) @@ -103,6 +103,7 @@ maybeHomeModule mod_name is_source = do -- for SOURCE imports, check the hi-boot extensions -- before the source/iface ones, to avoid -- creating circ Makefile deps. + mkHiOnlyModuleLocn mod_name hi_file = return @@ -147,8 +148,9 @@ mkHomeModuleLocn mod_name findPackageMod :: ModuleName -> Bool + -> Bool -> IO (Maybe (Module, ModuleLocation)) -findPackageMod mod_name hiOnly = do +findPackageMod mod_name hiOnly is_source = do pkgs <- getPackageInfo -- hi-suffix for packages depends on the build tag. @@ -169,18 +171,26 @@ findPackageMod mod_name hiOnly = do , ml_obj_file = Nothing }) + -- last chance: .hi-boot- and .hi-boot + hi_boot_ver = "hi-boot-" ++ cHscIfaceFileVersion + + boot_exts = + [ (hi_boot_ver, \ fName path -> mkHiOnlyModuleLocn mod_name fName) + , ("hi-boot", \ fName path -> mkHiOnlyModuleLocn mod_name fName) + ] + searchPathExts imp_dirs basename - ((package_hisuf,\ fName path -> retPackageModule mod_name Nothing path) : - -- can packages contain hi-boots? - (if hiOnly then [] else - [ ("hs", \ fName path -> retPackageModule mod_name (Just fName) path) - , ("lhs", \ fName path -> retPackageModule mod_name (Just fName) path) - ])) + (if is_source then boot_exts else + ((package_hisuf,\ fName path -> retPackageModule mod_name Nothing path) : + (if hiOnly then [] else + [ ("hs", \ fName path -> retPackageModule mod_name (Just fName) path) + , ("lhs", \ fName path -> retPackageModule mod_name (Just fName) path) + ]))) where findPackageModule :: ModuleName -> IO (Maybe (Module, ModuleLocation)) -findPackageModule mod_name = findPackageMod mod_name True +findPackageModule mod_name = findPackageMod mod_name True False searchPathExts :: [FilePath] -> String