diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2011-08-03 16:10:24 +0100 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2011-08-03 16:10:24 +0100 |
commit | 66096716817eb22ccd1dfb142e816b4b2846f7b3 (patch) | |
tree | d29a9a797b942d3e197b7a92cf0b99baef630241 /compiler/main/DynamicLoading.hs | |
parent | a303ee91d4186eba80864c45ff3ad7a58e70fa65 (diff) | |
download | haskell-66096716817eb22ccd1dfb142e816b4b2846f7b3.tar.gz |
Refactor to replace hscGetModuleExports by hscGetModuleInterface
I also tidied up the interfaces for LoadIface to be a bit simpler
Diffstat (limited to 'compiler/main/DynamicLoading.hs')
-rw-r--r-- | compiler/main/DynamicLoading.hs | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/compiler/main/DynamicLoading.hs b/compiler/main/DynamicLoading.hs index e8a8dfe015..cc382a74fe 100644 --- a/compiler/main/DynamicLoading.hs +++ b/compiler/main/DynamicLoading.hs @@ -17,21 +17,19 @@ module DynamicLoading ( #ifdef GHCI import Linker ( linkModule, getHValue ) -import OccName ( occNameSpace ) -import Name ( nameOccName ) import SrcLoc ( noSrcSpan ) import Finder ( findImportedModule, cannotFindModule ) import DriverPhases ( HscSource(HsSrcFile) ) -import TcRnDriver ( getModuleExports ) +import TcRnDriver ( getModuleInterface ) import TcRnMonad ( initTc, initIfaceTcRn ) import LoadIface ( loadUserInterface ) -import RdrName ( RdrName, Provenance(..), ImportSpec(..), ImpDeclSpec(..), ImpItemSpec(..), - mkGlobalRdrEnv, lookupGRE_RdrName, gre_name, rdrNameSpace ) +import RdrName ( RdrName, Provenance(..), ImportSpec(..), ImpDeclSpec(..) + , ImpItemSpec(..), mkGlobalRdrEnv, lookupGRE_RdrName, gre_name ) import RnNames ( gresFromAvails ) import PrelNames ( iNTERACTIVE ) import DynFlags -import HscTypes ( HscEnv(..), FindResult(..), lookupTypeHscEnv ) +import HscTypes ( HscEnv(..), FindResult(..), ModIface(..), lookupTypeHscEnv ) import TypeRep ( TyThing(..), pprTyThingCategory ) import Type ( Type, eqType ) import TyCon ( TyCon ) @@ -138,17 +136,19 @@ lookupRdrNameInModule hsc_env mod_name rdr_name = do case found_module of Found _ mod -> do -- Find the exports of the module - (_, mb_avail_info) <- getModuleExports hsc_env mod - case mb_avail_info of - Just avail_info -> do + (_, mb_iface) <- getModuleInterface hsc_env mod + case mb_iface of + Just iface -> do -- Try and find the required name in the exports - let decl_spec = ImpDeclSpec { is_mod = mod_name, is_as = mod_name, is_qual = False, is_dloc = noSrcSpan } + let decl_spec = ImpDeclSpec { is_mod = mod_name, is_as = mod_name + , is_qual = False, is_dloc = noSrcSpan } provenance = Imported [ImpSpec decl_spec ImpAll] - env = mkGlobalRdrEnv (gresFromAvails provenance avail_info) - case [name | gre <- lookupGRE_RdrName rdr_name env, let name = gre_name gre, rdrNameSpace rdr_name == occNameSpace (nameOccName name)] of - [name] -> return (Just name) - [] -> return Nothing - _ -> panic "lookupRdrNameInModule" + env = mkGlobalRdrEnv (gresFromAvails provenance (mi_exports iface)) + case lookupGRE_RdrName rdr_name env of + [gre] -> return (Just (gre_name gre)) + [] -> return Nothing + _ -> panic "lookupRdrNameInModule" + Nothing -> throwCmdLineErrorS $ hsep [ptext (sLit "Could not determine the exports of the module"), ppr mod_name] err -> throwCmdLineErrorS $ cannotFindModule dflags mod_name err where |