module IfaceEnv (
newGlobalBinder, newIPName, newImplicitBinder,
lookupIfaceTop, lookupIfaceExt,
- lookupOrig, lookupImplicitOrig, lookupIfaceTc,
+ lookupOrig, lookupIfaceTc,
newIfaceName, newIfaceNames,
extendIfaceIdEnv, extendIfaceTyVarEnv,
tcIfaceGlobal, tcIfaceTyCon, tcIfaceClass, tcIfaceExtId,
tcIfaceTyVar, tcIfaceDataCon, tcIfaceLclId,
-- Name-cache stuff
- allocateGlobalBinder, extendOrigNameCache, initNameCache
+ allocateGlobalBinder, initNameCache
) where
#include "HsVersions.h"
-- We fake up
-- Module to AnotherPackage
-- SrcLoc to noSrcLoc
+-- Parent no Nothing
-- They'll be overwritten, in due course, by LoadIface.loadDecl.
-lookupOrig mod_name occ = lookupOrig_help mod_name occ Nothing
-
-lookupImplicitOrig :: Name -> OccName -> TcRnIf m n Name
--- Same as lookupOrig, but install (Just parent) as the
--- parent Name. This is used when looking at the exports
--- of an interface:
--- Suppose module M exports type A.T, and constructor A.MkT
--- Then, we know that A.MkT is an implicit name of A.T,
--- even though we aren't at the binding site of A.T
--- And it's important, because we may simply re-export A.T
--- without ever sucking in the declaration itself.
-lookupImplicitOrig name occ
- = lookupOrig_help (nameModuleName name) occ (Just name)
-
-lookupOrig_help :: ModuleName -> OccName -> Maybe Name -> TcRnIf a b Name
--- Local helper, not exported
-lookupOrig_help mod_name occ mb_parent
+
+lookupOrig mod_name occ
= do { -- First ensure that mod_name and occ are evaluated
-- If not, chaos can ensue:
-- we read the name-cache
{ let { (us', us1) = splitUniqSupply (nsUniqs name_supply)
; uniq = uniqFromSupply us1
- ; name = mkExternalName uniq tmp_mod occ mb_parent noSrcLoc
+ ; name = mkExternalName uniq tmp_mod occ Nothing noSrcLoc
; new_cache = extend_name_cache (nsNames name_supply) tmp_mod occ name
; new_name_supply = name_supply {nsUniqs = us', nsNames = new_cache}
; tmp_mod = mkPackageModule mod_name
}}}
tcIfaceTyCon :: IfaceTyCon -> IfL TyCon
-tcIfaceTyCon IfaceIntTc = return intTyCon
+tcIfaceTyCon IfaceIntTc = return intTyCon
tcIfaceTyCon IfaceBoolTc = return boolTyCon
tcIfaceTyCon IfaceCharTc = return charTyCon
tcIfaceTyCon IfaceListTc = return listTyCon
%* *
%************************************************************************
-IfaceDecls etc are populated with RdrNames. The RdrNames may either be
-
- Orig or Unqual when the interface is read from a file
-
- Exact when the interface is kept by GHCi, and is now
- being re-linked with the type environment
-
-At an occurrence site, to convert the RdrName to Name:
- Unqual look up in LocalRdrEnv
- Orig look up in OrigNameCache
- Exact return the Name
-
-At a binding site, to bind the RdrName
- Unqual we extend the LocalRdrEnv
- Orig or Unqual we don't extend the LocalRdrEnv (no need)
-
-First, we deal with the RdrName -> Name mapping
-
\begin{code}
lookupIfaceTc :: IfaceTyCon -> IfL Name
lookupIfaceTc (IfaceTc ext) = lookupIfaceExt ext