diff options
author | simonmar <unknown> | 2002-01-24 16:55:37 +0000 |
---|---|---|
committer | simonmar <unknown> | 2002-01-24 16:55:37 +0000 |
commit | 03b874e796c49ed6c6d23e07f1a14c5dcb35c5ce (patch) | |
tree | 7bf834691292439934a6d3eccf530f08fa2c23e8 /ghc/compiler/rename/Rename.lhs | |
parent | d8ef45a3126bf72d09e1eae91d45de66e9ab37af (diff) | |
download | haskell-03b874e796c49ed6c6d23e07f1a14c5dcb35c5ce.tar.gz |
[project @ 2002-01-24 16:55:35 by simonmar]
Add support for Hugs's :browse (or :b) command. There are two forms:
- :b M (interpreted modules only) shows everything
defined in M - the types of top-level functions,
and definitions of classes and datatypes.
- :b *M shows everything exported from module M.
Available for both compiled and interpreted modules.
The user interface is subject to change, but for now it is consistent
with the new semantics of the :module command.
The implementation is a little tricky, since for a package module we
have to be sure to slurp in all the required declarations first.
Diffstat (limited to 'ghc/compiler/rename/Rename.lhs')
-rw-r--r-- | ghc/compiler/rename/Rename.lhs | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/ghc/compiler/rename/Rename.lhs b/ghc/compiler/rename/Rename.lhs index c99a63a08f..e49f9fbbad 100644 --- a/ghc/compiler/rename/Rename.lhs +++ b/ghc/compiler/rename/Rename.lhs @@ -6,7 +6,7 @@ \begin{code} module Rename ( renameModule, renameStmt, renameRdrName, mkGlobalContext, - closeIfaceDecls, checkOldIface + closeIfaceDecls, checkOldIface, slurpIface ) where #include "HsVersions.h" @@ -243,6 +243,31 @@ getModuleExports mod = %********************************************************* %* * +\subsection{Slurp in a whole module eagerly} +%* * +%********************************************************* + +\begin{code} +slurpIface + :: DynFlags -> HomeIfaceTable -> HomeSymbolTable + -> PersistentCompilerState -> Module + -> IO (PersistentCompilerState, PrintUnqualified, + Maybe ([Name], [RenamedHsDecl])) +slurpIface dflags hit hst pcs mod = + renameSource dflags hit hst pcs iNTERACTIVE $ + + let mod_name = moduleName mod + in + loadInterface contextDoc mod_name ImportByUser `thenRn` \ iface -> + let fvs = availsToNameSet [ avail | (mn,avails) <- mi_exports iface, + avail <- avails ] + in + slurpImpDecls fvs `thenRn` \ rn_imp_decls -> + returnRn (alwaysQualify, Just (nameSetToList fvs, rn_imp_decls)) +\end{code} + +%********************************************************* +%* * \subsection{The main function: rename} %* * %********************************************************* |