projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add ASSERTs to all calls of nameModule
[ghc-hetmet.git]
/
compiler
/
iface
/
IfaceEnv.lhs
diff --git
a/compiler/iface/IfaceEnv.lhs
b/compiler/iface/IfaceEnv.lhs
index
d62aad1
..
20d7327
100644
(file)
--- a/
compiler/iface/IfaceEnv.lhs
+++ b/
compiler/iface/IfaceEnv.lhs
@@
-29,7
+29,7
@@
import Name
import OccName
import PrelNames
import Module
import OccName
import PrelNames
import Module
-import UniqFM
+import LazyUniqFM
import FastString
import UniqSupply
import FiniteMap
import FastString
import UniqSupply
import FiniteMap
@@
-132,7
+132,7
@@
lookupAvail mod (AvailTC p_occ occs) = do
p_name <- lookupOrig mod p_occ
let lookup_sub occ | occ == p_occ = return p_name
| otherwise = lookupOrig mod occ
p_name <- lookupOrig mod p_occ
let lookup_sub occ | occ == p_occ = return p_name
| otherwise = lookupOrig mod occ
- subs <- mappM lookup_sub occs
+ subs <- mapM lookup_sub occs
return (AvailTC p_name subs)
-- Remember that 'occs' is all the exported things, including
-- the parent. It's possible to export just class ops without
return (AvailTC p_name subs)
-- Remember that 'occs' is all the exported things, including
-- the parent. It's possible to export just class ops without
@@
-152,7
+152,7
@@
lookupOrig mod occ
; name_cache <- getNameCache
; case lookupOrigNameCache (nsNames name_cache) mod occ of {
; name_cache <- getNameCache
; case lookupOrigNameCache (nsNames name_cache) mod occ of {
- Just name -> returnM name;
+ Just name -> return name;
Nothing ->
let
us = nsUniqs name_cache
Nothing ->
let
us = nsUniqs name_cache
@@
-166,15
+166,14
@@
lookupOrig mod occ
}}}
newIPName :: IPName OccName -> TcRnIf m n (IPName Name)
}}}
newIPName :: IPName OccName -> TcRnIf m n (IPName Name)
-newIPName occ_name_ip
- = getNameCache `thenM` \ name_supply ->
+newIPName occ_name_ip = do
+ name_supply <- getNameCache
let
ipcache = nsIPs name_supply
let
ipcache = nsIPs name_supply
- in
case lookupFM ipcache key of
case lookupFM ipcache key of
- Just name_ip -> returnM name_ip
- Nothing -> setNameCache new_ns `thenM_`
- returnM name_ip
+ Just name_ip -> return name_ip
+ Nothing -> do setNameCache new_ns
+ return name_ip
where
(us', us1) = splitUniqSupply (nsUniqs name_supply)
uniq = uniqFromSupply us1
where
(us', us1) = splitUniqSupply (nsUniqs name_supply)
uniq = uniqFromSupply us1
@@
-185,12
+184,17
@@
newIPName occ_name_ip
key = occ_name_ip -- Ensures that ?x and %x get distinct Names
\end{code}
key = occ_name_ip -- Ensures that ?x and %x get distinct Names
\end{code}
- Local helper functions (not exported)
+%************************************************************************
+%* *
+ Name cache access
+%* *
+%************************************************************************
\begin{code}
lookupOrigNameCache :: OrigNameCache -> Module -> OccName -> Maybe Name
\begin{code}
lookupOrigNameCache :: OrigNameCache -> Module -> OccName -> Maybe Name
-lookupOrigNameCache nc mod occ
- | mod == dATA_TUP || mod == gHC_PRIM, -- Boxed tuples from one,
+lookupOrigNameCache _ mod occ
+ -- XXX Why is gHC_UNIT not mentioned here?
+ | mod == gHC_TUPLE || mod == gHC_PRIM, -- Boxed tuples from one,
Just tup_info <- isTupleOcc_maybe occ -- unboxed from the other
= -- Special case for tuples; there are too many
-- of them to pre-populate the original-name cache
Just tup_info <- isTupleOcc_maybe occ -- unboxed from the other
= -- Special case for tuples; there are too many
-- of them to pre-populate the original-name cache
@@
-208,7
+212,8
@@
lookupOrigNameCache nc mod occ -- The normal case
extendOrigNameCache :: OrigNameCache -> Name -> OrigNameCache
extendOrigNameCache nc name
extendOrigNameCache :: OrigNameCache -> Name -> OrigNameCache
extendOrigNameCache nc name
- = extendNameCache nc (nameModule name) (nameOccName name) name
+ = ASSERT2( isExternalName name, ppr name )
+ extendNameCache nc (nameModule name) (nameOccName name) name
extendNameCache :: OrigNameCache -> Module -> OccName -> Name -> OrigNameCache
extendNameCache nc mod occ name
extendNameCache :: OrigNameCache -> Module -> OccName -> Name -> OrigNameCache
extendNameCache nc mod occ name