From 6b8e1664b3d192546407954057d3a1a561fde840 Mon Sep 17 00:00:00 2001 From: simonmar Date: Mon, 26 Feb 2001 16:42:48 +0000 Subject: [PATCH] [project @ 2001-02-26 16:42:48 by simonmar] Unload temporary bindings from the ClosureEnv properly at cmLoadModule time. --- ghc/compiler/compMan/CmLink.lhs | 1 + ghc/compiler/ghci/ByteCodeLink.lhs | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ghc/compiler/compMan/CmLink.lhs b/ghc/compiler/compMan/CmLink.lhs index fb34f69..af0b8f4 100644 --- a/ghc/compiler/compMan/CmLink.lhs +++ b/ghc/compiler/compMan/CmLink.lhs @@ -109,6 +109,7 @@ updateClosureEnv pls new_bindings -- -- * otherwise, we unload it. -- +-- * we also implicitly unload all temporary bindings at this point. unload :: GhciMode -> DynFlags diff --git a/ghc/compiler/ghci/ByteCodeLink.lhs b/ghc/compiler/ghci/ByteCodeLink.lhs index 7000cbf..1619758 100644 --- a/ghc/compiler/ghci/ByteCodeLink.lhs +++ b/ghc/compiler/ghci/ByteCodeLink.lhs @@ -110,10 +110,13 @@ instance Outputable UnlinkedBCO where type ClosureEnv = FiniteMap Name HValue data HValue = HValue -- dummy type, actually a pointer to some Real Code. --- remove all entries for a given set of modules from the environment +-- remove all entries for a given set of modules from the environment; +-- note that this removes all local names too (ie. temporary bindings from +-- the command line). filterNameMap :: [ModuleName] -> FiniteMap Name a -> FiniteMap Name a filterNameMap mods env - = filterFM (\n _ -> moduleName (nameModule n) `elem` mods) env + = filterFM (\n _ -> isGlobalName n && + moduleName (nameModule n) `elem` mods) env \end{code} %************************************************************************ -- 1.7.10.4