import TcRnTypes -- Re-export all
import IOEnv -- Re-export all
-#if defined(GHCI)
-import TypeRep
-import IdInfo
-import TysWiredIn
-import PrelNames
-import {-#SOURCE#-} TcEnv
-#endif
-
import HsSyn hiding (LIE)
import HscTypes
import Module
initTc :: HscEnv
-> HscSource
+ -> Bool -- True <=> retain renamed syntax trees
-> Module
-> TcM r
-> IO (Messages, Maybe r)
-- Nothing => error thrown by the thing inside
-- (error messages should have been printed already)
-initTc hsc_env hsc_src mod do_this
+initTc hsc_env hsc_src keep_rn_syntax mod do_this
= do { errs_var <- newIORef (emptyBag, emptyBag) ;
tvs_var <- newIORef emptyVarSet ;
type_env_var <- newIORef emptyNameEnv ;
th_var <- newIORef False ;
dfun_n_var <- newIORef 1 ;
let {
+ maybe_rn_syntax empty_val
+ | keep_rn_syntax = Just empty_val
+ | otherwise = Nothing ;
+
gbl_env = TcGblEnv {
tcg_mod = mod,
tcg_src = hsc_src,
tcg_exports = [],
tcg_imports = emptyImportAvails,
tcg_dus = emptyDUs,
- tcg_rn_imports = Nothing,
- tcg_rn_exports = Nothing,
- tcg_rn_decls = Nothing,
+
+ tcg_rn_imports = maybe_rn_syntax [],
+ tcg_rn_exports = maybe_rn_syntax [],
+ tcg_rn_decls = maybe_rn_syntax emptyRnGroup,
+
tcg_binds = emptyLHsBinds,
tcg_deprecs = NoDeprecs,
tcg_insts = [],
-> TcM r
-> IO (Maybe r)
initTcPrintErrors env mod todo = do
- (msgs, res) <- initTc env HsSrcFile mod todo
+ (msgs, res) <- initTc env HsSrcFile False mod todo
printErrorsAndWarnings (hsc_dflags env) msgs
return res
\end{code}
addBreakpointBindings :: TcM a -> TcM a
addBreakpointBindings thing_inside
= thing_inside
-
\end{code}
%************************************************************************