import Maybes ( maybeToBool, catMaybes )
import Outputable
import IO ( openFile, IOMode(..) )
-import HscTypes ( PersistentCompilerState, HomeIfaceTable, HomeSymbolTable,
- ModIface(..), WhatsImported(..),
- VersionInfo(..), ImportVersion, IsExported,
- IfaceDecls, mkIfaceDecls, dcl_tycl, dcl_rules, dcl_insts,
- GlobalRdrEnv, GlobalRdrElt(..), pprGlobalRdrEnv,
- AvailEnv, GenAvailInfo(..), AvailInfo,
- Provenance(..), ImportReason(..), initialVersionInfo,
- Deprecations(..), GhciMode(..),
- LocalRdrEnv
- )
+import HscTypes -- lots of it
import List ( partition, nub )
\end{code}
renameStmt :: DynFlags
-> HomeIfaceTable -> HomeSymbolTable
-> PersistentCompilerState
- -> Module -- current context (scope to compile in)
-> Module -- current module
- -> LocalRdrEnv -- current context (temp bindings)
+ -> InteractiveContext
-> RdrNameStmt -- parsed stmt
-> IO ( PersistentCompilerState,
PrintUnqualified,
Maybe ([Name], (RenamedStmt, [RenamedHsDecl]))
)
-renameStmt dflags hit hst pcs scope_module this_module local_env stmt
+renameStmt dflags hit hst pcs this_module ic stmt
= renameSource dflags hit hst pcs this_module $
+ extendTypeEnvRn (ic_type_env ic) $
-- load the context module
- loadContextModule scope_module $ \ (rdr_env, print_unqual) ->
+ loadContextModule (ic_module ic) $ \ (rdr_env, print_unqual) ->
-- Rename the stmt
- initRnMS rdr_env local_env emptyLocalFixityEnv CmdLineMode (
+ initRnMS rdr_env (ic_rn_env ic) emptyLocalFixityEnv CmdLineMode (
rnStmt stmt $ \ stmt' ->
returnRn (([], stmt'), emptyFVs)
) `thenRn` \ ((binders, stmt), fvs) ->
-- Mod> let y = x + 3
-- We need to pass 'x' among the fvs to slurpImpDecls, so that
-- the latter can see that T is a gate, and hence import the Num T
- -- instance decl. (See the InTypEnv case in RnIfaces.slurpSourceRefs
+ -- instance decl. (See the InTypEnv case in RnIfaces.slurpSourceRefs.)
doDump dflags binders stmt decls `thenRn_`
returnRn (print_unqual, Just (binders, (stmt, decls)))
:: DynFlags
-> HomeIfaceTable -> HomeSymbolTable
-> PersistentCompilerState
- -> Module -- current context (scope to compile in)
-> Module -- current module
- -> LocalRdrEnv -- current context (temp bindings)
+ -> InteractiveContext
-> [RdrName] -- name to rename
-> IO ( PersistentCompilerState,
PrintUnqualified,
Maybe ([Name], [RenamedHsDecl])
)
-renameRdrName dflags hit hst pcs scope_module this_module local_env rdr_names =
- renameSource dflags hit hst pcs this_module $
- loadContextModule scope_module $ \ (rdr_env, print_unqual) ->
+renameRdrName dflags hit hst pcs this_module ic rdr_names =
+ renameSource dflags hit hst pcs this_module $
+ extendTypeEnvRn (ic_type_env ic) $
+ loadContextModule (ic_module ic) $ \ (rdr_env, print_unqual) ->
-- rename the rdr_name
- initRnMS rdr_env local_env emptyLocalFixityEnv CmdLineMode
+ initRnMS rdr_env (ic_rn_env ic) emptyLocalFixityEnv CmdLineMode
(mapRn (tryRn.lookupOccRn) rdr_names) `thenRn` \ maybe_names ->
let
ok_names = [ a | Right a <- maybe_names ]