summaryrefslogtreecommitdiff
path: root/compiler/main/DynamicLoading.hs
diff options
context:
space:
mode:
authorDaniel Vainsencher <daniel.vainsencher@gmail.com>2012-11-26 11:18:50 +0000
committerSimon Peyton Jones <simonpj@microsoft.com>2012-12-05 16:41:28 +0000
commit57d6798353f53850943e361f4707db76c76dc38f (patch)
tree8456d2fe24b1c88118231de04164ce0d72fa6491 /compiler/main/DynamicLoading.hs
parentf971e75e66fc549e52a0a3d7ed1e6ba0109e6697 (diff)
downloadhaskell-57d6798353f53850943e361f4707db76c76dc38f.tar.gz
When using a GHC plugin, load its interface file very partially: just enough that it can be used, without its rules and instances affecting (and being linked from!) the module being compiled.
Diffstat (limited to 'compiler/main/DynamicLoading.hs')
-rw-r--r--compiler/main/DynamicLoading.hs7
1 files changed, 3 insertions, 4 deletions
diff --git a/compiler/main/DynamicLoading.hs b/compiler/main/DynamicLoading.hs
index 84eb2612e0..adcb0eb3b3 100644
--- a/compiler/main/DynamicLoading.hs
+++ b/compiler/main/DynamicLoading.hs
@@ -20,9 +20,8 @@ import Linker ( linkModule, getHValue )
import SrcLoc ( noSrcSpan )
import Finder ( findImportedModule, cannotFindModule )
import DriverPhases ( HscSource(HsSrcFile) )
-import TcRnDriver ( getModuleInterface )
import TcRnMonad ( initTc, initIfaceTcRn )
-import LoadIface ( loadUserInterface )
+import LoadIface ( loadPluginInterface )
import RdrName ( RdrName, Provenance(..), ImportSpec(..), ImpDeclSpec(..)
, ImpItemSpec(..), mkGlobalRdrEnv, lookupGRE_RdrName, gre_name )
import RnNames ( gresFromAvails )
@@ -50,7 +49,7 @@ import GHC.Exts ( unsafeCoerce# )
-- for debugging (@-ddump-if-trace@) only: it is shown as the reason why the module is being loaded.
forceLoadModuleInterfaces :: HscEnv -> SDoc -> [Module] -> IO ()
forceLoadModuleInterfaces hsc_env doc modules
- = (initTc hsc_env HsSrcFile False iNTERACTIVE $ initIfaceTcRn $ mapM_ (loadUserInterface False doc) modules) >> return ()
+ = (initTc hsc_env HsSrcFile False iNTERACTIVE $ initIfaceTcRn $ mapM_ (loadPluginInterface doc) modules) >> return ()
-- | Force the interface for the module containing the name to be loaded. The 'SDoc' parameter is used
-- for debugging (@-ddump-if-trace@) only: it is shown as the reason why the module is being loaded.
@@ -138,7 +137,7 @@ lookupRdrNameInModule hsc_env mod_name rdr_name = do
case found_module of
Found _ mod -> do
-- Find the exports of the module
- (_, mb_iface) <- getModuleInterface hsc_env mod
+ (_, mb_iface) <- initTc hsc_env HsSrcFile False iNTERACTIVE $ initIfaceTcRn $ loadPluginInterface (ptext (sLit "contains a name used in an invocation of lookupRdrNameInModule")) mod
case mb_iface of
Just iface -> do
-- Try and find the required name in the exports