X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fiface%2FIfaceEnv.lhs;h=ce90c8c5e0eaeb6e5f7d3aa4319e46da55206c9c;hb=601ee730cc2ce6a849197bfcd3d7a100d605879a;hp=3c3a34d6d84f53461145566f9d413b1cfdac8dc7;hpb=49c98d143c382a1341e1046f5ca00819a25691ba;p=ghc-hetmet.git diff --git a/compiler/iface/IfaceEnv.lhs b/compiler/iface/IfaceEnv.lhs index 3c3a34d..ce90c8c 100644 --- a/compiler/iface/IfaceEnv.lhs +++ b/compiler/iface/IfaceEnv.lhs @@ -1,6 +1,13 @@ (c) The University of Glasgow 2002-2006 \begin{code} +{-# OPTIONS -w #-} +-- The above warning supression flag is a temporary kludge. +-- While working on this module you are encouraged to remove it and fix +-- any warnings in the module. See +-- http://hackage.haskell.org/trac/ghc/wiki/Commentary/CodingStyle#Warnings +-- for details + module IfaceEnv ( newGlobalBinder, newIPName, newImplicitBinder, lookupIfaceTop, @@ -8,6 +15,7 @@ module IfaceEnv ( newIfaceName, newIfaceNames, extendIfaceIdEnv, extendIfaceTyVarEnv, tcIfaceLclId, tcIfaceTyVar, + tcIfaceTick, ifaceExportNames, @@ -34,6 +42,7 @@ import UniqSupply import FiniteMap import BasicTypes import SrcLoc +import MkId import Outputable \end{code} @@ -46,7 +55,7 @@ import Outputable %********************************************************* \begin{code} -newGlobalBinder :: Module -> OccName -> SrcLoc -> TcRnIf a b Name +newGlobalBinder :: Module -> OccName -> SrcSpan -> TcRnIf a b Name -- Used for source code and interface files, to make the -- Name for a thing, given its Module and OccName -- @@ -56,7 +65,7 @@ newGlobalBinder :: Module -> OccName -> SrcLoc -> TcRnIf a b Name newGlobalBinder mod occ loc = do { mod `seq` occ `seq` return () -- See notes with lookupOrig_help - ; traceIf (text "newGlobalBinder" <+> ppr mod <+> ppr occ <+> ppr loc) +-- ; traceIf (text "newGlobalBinder" <+> ppr mod <+> ppr occ <+> ppr loc) ; name_supply <- getNameCache ; let (name_supply', name) = allocateGlobalBinder name_supply mod occ @@ -66,7 +75,7 @@ newGlobalBinder mod occ loc allocateGlobalBinder :: NameCache - -> Module -> OccName -> SrcLoc + -> Module -> OccName -> SrcSpan -> (NameCache, Name) allocateGlobalBinder name_supply mod occ loc = case lookupOrigNameCache (nsNames name_supply) mod occ of @@ -114,7 +123,7 @@ newImplicitBinder :: Name -- Base name newImplicitBinder base_name mk_sys_occ = newGlobalBinder (nameModule base_name) (mk_sys_occ (nameOccName base_name)) - (nameSrcLoc base_name) + (nameSrcSpan base_name) ifaceExportNames :: [IfaceExport] -> TcRnIf gbl lcl [AvailInfo] ifaceExportNames exports = do @@ -130,7 +139,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 - 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 @@ -146,16 +155,16 @@ lookupOrig mod occ -- which does some stuff that modifies the name cache -- This did happen, with tycon_mod in TcIface.tcIfaceAlt (DataAlt..) mod `seq` occ `seq` return () - ; traceIf (text "lookup_orig" <+> ppr mod <+> ppr occ) +-- ; traceIf (text "lookup_orig" <+> ppr mod <+> ppr occ) ; 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 uniq = uniqFromSupply us - name = mkExternalName uniq mod occ noSrcLoc + name = mkExternalName uniq mod occ noSrcSpan new_cache = extendNameCache (nsNames name_cache) mod occ name in case splitUniqSupply us of { (us',_) -> do @@ -164,15 +173,14 @@ lookupOrig mod occ }}} 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 - in 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 @@ -292,11 +300,27 @@ lookupIfaceTop occ newIfaceName :: OccName -> IfL Name newIfaceName occ = do { uniq <- newUnique - ; return $! mkInternalName uniq occ noSrcLoc } + ; return $! mkInternalName uniq occ noSrcSpan } newIfaceNames :: [OccName] -> IfL [Name] newIfaceNames occs = do { uniqs <- newUniqueSupply - ; return [ mkInternalName uniq occ noSrcLoc + ; return [ mkInternalName uniq occ noSrcSpan | (occ,uniq) <- occs `zip` uniqsFromSupply uniqs] } \end{code} + +%************************************************************************ +%* * + (Re)creating tick boxes +%* * +%************************************************************************ + +\begin{code} +tcIfaceTick :: Module -> Int -> IfL Id +tcIfaceTick modName tickNo + = do { uniq <- newUnique + ; return $ mkTickBoxOpId uniq modName tickNo + } +\end{code} + +