TypeEnv, lookupType, mkTypeEnv, extendTypeEnvList,
typeEnvClasses, typeEnvTyCons,
- WhetherHasOrphans, ImportVersion, WhatsImported(..),
+ ImportedModuleInfo, WhetherHasOrphans, ImportVersion, WhatsImported(..),
PersistentRenamerState(..), IsBootInterface, Avails, DeclsMap,
IfaceInsts, IfaceRules, GatedDecl, IsExported,
NameSupply(..), OrigNameCache, OrigIParamCache,
type PackageInstEnv = InstEnv
data PersistentRenamerState
- = PRS { prsOrig :: NameSupply,
- prsDecls :: DeclsMap,
- prsInsts :: IfaceInsts,
- prsRules :: IfaceRules
+ = PRS { prsOrig :: NameSupply,
+ prsImpMods :: ImportedModuleInfo,
+ prsDecls :: DeclsMap,
+ prsInsts :: IfaceInsts,
+ prsRules :: IfaceRules
}
\end{code}
type OrigIParamCache = FiniteMap OccName Name
\end{code}
+@ImportedModuleInfo@ contains info ONLY about modules that have not yet
+been loaded into the iPIT. These modules are mentioned in interfaces we've
+already read, so we know a tiny bit about them, but we havn't yet looked
+at the interface file for the module itself. It needs to persist across
+invocations of the renamer, at least from Rename.checkOldIface to Rename.renameSource.
+And there's no harm in it persisting across multiple compilations.
+
+\begin{code}
+type ImportedModuleInfo = FiniteMap ModuleName (WhetherHasOrphans, IsBootInterface)
+\end{code}
A DeclsMap contains a binding for each Name in the declaration
including the constructors of a type decl etc. The Bool is True just
import CmdLineOpts ( opt_IgnoreIfacePragmas )
import HscTypes ( ModuleLocation(..),
ModIface(..), emptyModIface,
- VersionInfo(..),
+ VersionInfo(..), ImportedModuleInfo,
lookupIfaceByModName,
ImportVersion, WhetherHasOrphans, IsBootInterface,
DeclsMap, GatedDecl, IfaceInsts, IfaceRules,
iRules = new_rules,
iImpModInfo = mod_map2 }
in
+ seq mod_map2 $
setIfacesRn new_ifaces `thenRn_`
returnRn (mod_iface, Nothing)
}}
-----------------------------------------------------
addModDeps :: Module
- -> (ModuleName -> Bool) -- True for module interfaces
+ -> (ModuleName -> Bool) -- True for modules that are already loaded
-> [ImportVersion a]
-> ImportedModuleInfo -> ImportedModuleInfo
-- (addModDeps M ivs deps)
-- and in that case, forget about the boot indicator
filtered_new_deps :: [(ModuleName, (WhetherHasOrphans, IsBootInterface))]
filtered_new_deps
- | isHomeModule mod
- = [ (imp_mod, (has_orphans, is_boot))
+ | isHomeModule mod = [ (imp_mod, (has_orphans, is_boot))
| (imp_mod, has_orphans, is_boot, _) <- new_deps,
not (is_loaded imp_mod)
]
import RnHsSyn ( RenamedFixitySig )
import HscTypes ( AvailEnv, lookupType,
NameSupply(..),
- WhetherHasOrphans, ImportVersion,
- PersistentRenamerState(..), IsBootInterface, Avails,
+ ImportedModuleInfo, WhetherHasOrphans, ImportVersion,
+ PersistentRenamerState(..), Avails,
DeclsMap, IfaceInsts, IfaceRules,
HomeSymbolTable, TyThing,
PersistentCompilerState(..), GlobalRdrEnv,
import CmdLineOpts ( DynFlags, DynFlag(..), dopt )
import SrcLoc ( SrcLoc, generatedSrcLoc, noSrcLoc )
import Unique ( Unique )
-import FiniteMap ( FiniteMap, emptyFM )
+import FiniteMap ( FiniteMap )
import Bag ( Bag, emptyBag, isEmptyBag, snocBag )
import UniqSupply
import Outputable
-- package symbol table, and the renamer incrementally adds
-- to it.
+ iImpModInfo :: ImportedModuleInfo,
+ -- Modules that we know something about, because they are mentioned
+ -- in interface files, BUT which we have not loaded yet.
+ -- No module is both in here and in the PIT
+
iDecls :: DeclsMap,
-- A single, global map of Names to unslurped decls
-- EPHEMERAL FIELDS
-- These fields persist during the compilation of a single module only
- iImpModInfo :: ImportedModuleInfo,
- -- Modules that we know something about, because they are mentioned
- -- in interface files, BUT which we have not loaded yet.
- -- No module is both in here and in the PIT
-
iSlurp :: NameSet,
-- All the names (whether "big" or "small", whether wired-in or not,
-- whether locally defined or not) that have been slurped in so far.
-- names that have been slurped in so far, with their versions.
-- This is used to generate the "usage" information for this module.
-- Subset of the previous field.
+ --
-- The module set is the non-home-package modules from which we have
-- slurped at least one name.
-- It's worth keeping separately, because there's no very easy
-- way to distinguish the "big" names from the "non-big" ones.
-- But this is a decision we might want to revisit.
}
-
-type ImportedModuleInfo = FiniteMap ModuleName (WhetherHasOrphans, IsBootInterface)
- -- Contains info ONLY about modules that
- -- have not yet been loaded into the iPIT
\end{code}
iInsts = prsInsts prs,
iRules = prsRules prs,
- iImpModInfo = emptyFM,
+ iImpModInfo = prsImpMods prs,
iSlurp = unitNameSet (mkUnboundName dummyRdrVarName),
-- Pretend that the dummy unbound name has already been
-- slurped. This is what's returned for an out-of-scope name,
(warns, errs) <- readIORef errs_var
new_ifaces <- readIORef iface_var
new_orig <- readIORef names_var
- let new_prs = prs { prsOrig = new_orig,
- prsDecls = iDecls new_ifaces,
- prsInsts = iInsts new_ifaces,
- prsRules = iRules new_ifaces }
+ let new_prs = prs { prsOrig = new_orig,
+ prsImpMods = iImpModInfo new_ifaces,
+ prsDecls = iDecls new_ifaces,
+ prsInsts = iInsts new_ifaces,
+ prsRules = iRules new_ifaces }
let new_pcs = pcs { pcs_PIT = iPIT new_ifaces,
pcs_PRS = new_prs }