X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2Frename%2FRnNames.lhs;h=37399d2c856a99c78198851f5f1dca4a1a59eaae;hb=fc63e16fda616d34ffc93a19d1f47271d416e65a;hp=7bc2cceb85473307e13be7db030058155278d2b1;hpb=9430fd74f5e398c4a6db2be56055d4afb075bfae;p=ghc-hetmet.git diff --git a/ghc/compiler/rename/RnNames.lhs b/ghc/compiler/rename/RnNames.lhs index 7bc2cce..37399d2 100644 --- a/ghc/compiler/rename/RnNames.lhs +++ b/ghc/compiler/rename/RnNames.lhs @@ -411,29 +411,30 @@ filterImports :: ModIface -- Complains if import spec mentions things that the module doesn't export -- Warns/informs if import spec contains duplicates. +mkGenericRdrEnv imp_spec avails + = mkGlobalRdrEnv [ GRE { gre_name = name, gre_prov = Imported [imp_spec] False } + | avail <- avails, name <- availNames avail ] + filterImports iface imp_spec Nothing total_avails = returnM (mkAvailEnv total_avails, - mkGlobalRdrEnv [ GRE { gre_name = name, gre_prov = Imported [imp_spec] False } - | avail <- total_avails, name <- availNames avail ]) + mkGenericRdrEnv imp_spec total_avails) filterImports iface imp_spec (Just (want_hiding, import_items)) total_avails = mapAndUnzipM (addLocM get_item) import_items `thenM` \ (avails_s, gres) -> let avails = concat avails_s - rdr_env | not want_hiding - = foldr plusGlobalRdrEnv emptyGlobalRdrEnv gres - | otherwise -- Hiding; qualified-only import of hidden things - = mkGlobalRdrEnv [ GRE { gre_name = name, - gre_prov = Imported [mk_imp_spec name] False } - | avail <- total_avails, name <- availNames avail ] - hidden = availsToNameSet avails - mk_imp_spec n - | n `elemNameSet` hidden = imp_spec { is_qual = True } - | otherwise = imp_spec in - returnM (mkAvailEnv avails, rdr_env) - -- Hiding still imports everything qualified, so 'avails' is not - -- conditional on hiding. But the rdrenv is modified to + if not want_hiding then + return (mkAvailEnv avails, + foldr plusGlobalRdrEnv emptyGlobalRdrEnv gres) + else + let + hidden = availsToNameSet avails + keep n = not (n `elemNameSet` hidden) + pruned_avails = pruneAvails keep total_avails + in + return (mkAvailEnv pruned_avails, + mkGenericRdrEnv imp_spec pruned_avails) where import_fm :: OccEnv AvailInfo