X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2Frename%2FRnNames.lhs;h=750ffb01ad78f314646050f9dc277e83076c7eae;hb=95d8fef4a0af5cd0993986a98a7ec219c9aa0cd6;hp=683dfd88c974c80e415b1bb07a66be62b3600be0;hpb=7d7d186e02f0c86efb7fc9291a142b30005718ae;p=ghc-hetmet.git diff --git a/ghc/compiler/rename/RnNames.lhs b/ghc/compiler/rename/RnNames.lhs index 683dfd8..750ffb0 100644 --- a/ghc/compiler/rename/RnNames.lhs +++ b/ghc/compiler/rename/RnNames.lhs @@ -164,8 +164,8 @@ importsFromImportDecl this_mod_name (ImportDecl imp_mod_name from qual_only as_m Just another_name -> another_name mk_prov name = NonLocalDef (UserImport imp_mod iloc (name `elemNameSet` explicits)) - gbl_env = mkGlobalRdrEnv qual_mod unqual_imp hides mk_prov filtered_avails - exports = mkExportAvails qual_mod unqual_imp gbl_env filtered_avails + gbl_env = mkGlobalRdrEnv qual_mod unqual_imp True hides mk_prov filtered_avails + exports = mkExportAvails qual_mod unqual_imp gbl_env filtered_avails in returnRn (gbl_env, exports) \end{code} @@ -174,7 +174,7 @@ importsFromImportDecl this_mod_name (ImportDecl imp_mod_name from qual_only as_m \begin{code} importsFromLocalDecls this_mod decls = mapRn (getLocalDeclBinders this_mod) decls `thenRn` \ avails_s -> - + -- The avails that are returned don't include the "system" names let avails = concat avails_s @@ -187,32 +187,35 @@ importsFromLocalDecls this_mod decls -- Check for duplicate definitions mapRn_ (addErrRn . dupDeclErr) dups `thenRn_` + -- Record that locally-defined things are available recordLocalSlurps (availsToNameSet avails) `thenRn_` - let mod_name = moduleName this_mod unqual_imp = True -- Want unqualified names mk_prov n = LocalDef -- Provenance is local hides = [] -- Hide nothing - gbl_env = mkGlobalRdrEnv mod_name unqual_imp [] mk_prov avails - exports = mkExportAvails mod_name unqual_imp gbl_env avails + gbl_env = mkGlobalRdrEnv mod_name unqual_imp True hides mk_prov avails + exports = mkExportAvails mod_name unqual_imp gbl_env avails in returnRn (gbl_env, exports) --------------------------- -getLocalDeclBinders :: Module - -> RdrNameHsDecl -> RnMG Avails +getLocalDeclBinders :: Module -> RdrNameHsDecl -> RnMG [AvailInfo] getLocalDeclBinders mod (TyClD tycl_decl) = -- For type and class decls, we generate Global names, with -- no export indicator. They need to be global because they get -- permanently bound into the TyCons and Classes. They don't need -- an export indicator because they are all implicitly exported. - getTyClDeclBinders mod tycl_decl `thenRn` \ avail -> + getTyClDeclBinders mod tycl_decl `thenRn` \ (avail, sys_names) -> + + -- Record that the system names are available + recordLocalSlurps (mkNameSet sys_names) `thenRn_` returnRn [avail] getLocalDeclBinders mod (ValD binds) - = mapRn new (bagToList (collectTopBinders binds)) + = mapRn new (bagToList (collectTopBinders binds)) `thenRn` \ avails -> + returnRn avails where new (rdr_name, loc) = newTopBinder mod rdr_name loc `thenRn` \ name -> returnRn (Avail name)