X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;ds=sidebyside;f=ghc%2Fcompiler%2FbasicTypes%2FModule.lhs;h=0846c9991d5718b78b40bd21071111a2e20ab9f9;hb=eff316f25357221991b4cd17dd02439478101d6d;hp=4320bc3982bf5cd42ff847293199cf4bd3bf40fd;hpb=506fa77d392191e46c12b2c19387ff5b0888f6a2;p=ghc-hetmet.git diff --git a/ghc/compiler/basicTypes/Module.lhs b/ghc/compiler/basicTypes/Module.lhs index 4320bc3..0846c99 100644 --- a/ghc/compiler/basicTypes/Module.lhs +++ b/ghc/compiler/basicTypes/Module.lhs @@ -143,10 +143,6 @@ type ModuleName = EncodedFS -- Haskell module names can include the quote character ', -- so the module names have the z-encoding applied to them -type ModuleNameSet = FiniteMap ModuleName -elemModuleNameSet s x = elemFM s x -moduleNameSetElems s = eltsFM s - pprModuleName :: ModuleName -> SDoc pprModuleName nm = pprEncodedFS nm @@ -316,17 +312,27 @@ getAllFilesMatching dirs hims (dir_path, suffix) = ( do addModules is_dll his@(hi_env, hib_env) filename = fromMaybe his $ FMAP add_hi (go xiffus rev_fname) `seqMaybe` - FMAP add_vhib (go hi_boot_version_xiffus rev_fname) `seqMaybe` - FMAP add_hib (go hi_boot_xiffus rev_fname) - where - rev_fname = reverse filename - path = dir_path ++ '/':filename - mk_module mod_nm = Module mod_nm is_sys is_dll - add_hi mod_nm = (addToFM_C addNewOne hi_env mod_nm (path, mk_module mod_nm), hib_env) - add_vhib mod_nm = (hi_env, addToFM_C overrideNew hib_env mod_nm (path, mk_module mod_nm)) - add_hib mod_nm = (hi_env, addToFM_C addNewOne hib_env mod_nm (path, mk_module mod_nm)) + FMAP add_vhib (go hi_boot_version_xiffus rev_fname) `seqMaybe` + -- If there's a Foo.hi-boot-N file then override any Foo.hi-boot + FMAP add_hib (go hi_boot_xiffus rev_fname) + where + rev_fname = reverse filename + path = dir_path ++ '/':filename + + -- In these functions file_nm is the base of the filename, + -- with the path and suffix both stripped off. The filename + -- is the *unencoded* module name (else 'make' gets confused). + -- But the domain of the HiMaps is ModuleName which is encoded. + add_hi file_nm = (add_to_map addNewOne hi_env file_nm, hib_env) + add_vhib file_nm = (hi_env, add_to_map overrideNew hib_env file_nm) + add_hib file_nm = (hi_env, add_to_map addNewOne hib_env file_nm) + + add_to_map combiner env file_nm + = addToFM_C combiner env mod_nm (path, mkModule mod_nm is_sys is_dll) + where + mod_nm = mkSrcModuleFS file_nm -- go prefix (prefix ++ stuff) == Just (reverse stuff) go [] xs = Just (_PK_ (reverse xs))