summaryrefslogtreecommitdiff
path: root/compiler/GHC.hs
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2020-11-27 15:34:44 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-12-11 22:42:09 -0500
commit690c894616a539c59cb8e58d2bba8b9c02c5ad4c (patch)
tree95a3861b5c2e9f379c19cfc2650e1a9b744e4b3d /compiler/GHC.hs
parentb4a929a1e54272ff6ba67c1a2baba635bae93b0b (diff)
downloadhaskell-690c894616a539c59cb8e58d2bba8b9c02c5ad4c.tar.gz
Parser: move parser utils into their own module
Move code unrelated to runtime evaluation out of GHC.Runtime.Eval
Diffstat (limited to 'compiler/GHC.hs')
-rw-r--r--compiler/GHC.hs13
1 files changed, 13 insertions, 0 deletions
diff --git a/compiler/GHC.hs b/compiler/GHC.hs
index cc8f93bba0..d6fe5094d5 100644
--- a/compiler/GHC.hs
+++ b/compiler/GHC.hs
@@ -325,6 +325,7 @@ import qualified GHC.Parser as Parser
import GHC.Parser.Lexer
import GHC.Parser.Annotation
import GHC.Parser.Errors.Ppr
+import GHC.Parser.Utils
import GHC.Iface.Load ( loadSysInterface )
import GHC.Hs
@@ -1347,6 +1348,18 @@ getPackageModuleInfo hsc_env mdl
minf_modBreaks = emptyModBreaks
}))
+availsToGlobalRdrEnv :: ModuleName -> [AvailInfo] -> GlobalRdrEnv
+availsToGlobalRdrEnv mod_name avails
+ = mkGlobalRdrEnv (gresFromAvails (Just imp_spec) avails)
+ where
+ -- We're building a GlobalRdrEnv as if the user imported
+ -- all the specified modules into the global interactive module
+ imp_spec = ImpSpec { is_decl = decl, is_item = ImpAll}
+ decl = ImpDeclSpec { is_mod = mod_name, is_as = mod_name,
+ is_qual = False,
+ is_dloc = srcLocSpan interactiveSrcLoc }
+
+
getHomeModuleInfo :: HscEnv -> Module -> IO (Maybe ModuleInfo)
getHomeModuleInfo hsc_env mdl =
case lookupHpt (hsc_HPT hsc_env) (moduleName mdl) of