Store a SrcSpan instead of a SrcLoc inside a Name
[ghc-hetmet.git] / compiler / coreSyn / CoreTidy.lhs
index bacf64f..95c3ac4 100644 (file)
@@ -1,7 +1,11 @@
 %
+% (c) The University of Glasgow 2006
 % (c) The AQUA Project, Glasgow University, 1996-1998
 %
 
+This module contains "tidying" code for *nested* expressions, bindings, rules.
+The code for *top-level* bindings is in TidyPgm.
+
 \begin{code}
 module CoreTidy (
        tidyExpr, tidyVarOcc, tidyRule, tidyRules 
@@ -10,27 +14,21 @@ module CoreTidy (
 #include "HsVersions.h"
 
 import CoreSyn
-import CoreUtils       ( exprArity )
-import Id              ( Id, mkUserLocal, idInfo, setIdInfo, idUnique, idType )
-import IdInfo          ( setArityInfo, vanillaIdInfo,
-                         newStrictnessInfo, setAllStrictnessInfo,
-                         newDemandInfo, setNewDemandInfo )
-import Type            ( tidyType, tidyTyVarBndr )
-import Var             ( Var, varName )
+import CoreUtils
+import Id
+import IdInfo
+import Type
+import Var
 import VarEnv
-import UniqFM          ( lookupUFM )
-import Name            ( Name, getOccName )
-import OccName         ( tidyOccName )
-import SrcLoc          ( noSrcLoc )
-import Maybes          ( orElse )
-import Outputable
-import Util            ( mapAccumL )
+import UniqFM
+import Name hiding (tidyNameOcc)
+import OccName
+import SrcLoc
+import Maybes
+import Util
 \end{code}
 
 
-This module contains "tidying" code for *nested* expressions, bindings, rules.
-The code for *top-level* bindings is in TidyPgm.
-
 %************************************************************************
 %*                                                                     *
 \subsection{Tidying expressions, rules}
@@ -115,7 +113,7 @@ tidyNameOcc :: TidyEnv -> Name -> Name
 -- Fortunately, we can lookup in the VarEnv with a name
 tidyNameOcc (_, var_env) n = case lookupUFM var_env n of
                                Nothing -> n
-                               Just v  -> varName v
+                               Just v  -> idName v
 
 tidyVarOcc :: TidyEnv -> Var -> Var
 tidyVarOcc (_, var_env) v = lookupVarEnv var_env v `orElse` v
@@ -148,13 +146,16 @@ tidyLetBndr env (id,rhs)
        -- CorePrep to turn the let into a case.
        --
        -- Similarly arity info for eta expansion in CorePrep
-       --
+       -- 
+       -- Set inline-prag info so that we preseve it across 
+       -- separate compilation boundaries
     final_id = new_id `setIdInfo` new_info
     idinfo   = idInfo id
     new_info = vanillaIdInfo
                `setArityInfo`          exprArity rhs
                `setAllStrictnessInfo`  newStrictnessInfo idinfo
                `setNewDemandInfo`      newDemandInfo idinfo
+               `setInlinePragInfo`     inlinePragInfo idinfo
 
     -- Override the env we get back from tidyId with the new IdInfo
     -- so it gets propagated to the usage sites.
@@ -175,7 +176,7 @@ tidyIdBndr env@(tidy_env, var_env) id
        -- which should save some space.
        -- But note that tidyLetBndr puts some of it back.
         ty'              = tidyType env (idType id)
-       id'               = mkUserLocal occ' (idUnique id) ty' noSrcLoc
+       id'               = mkUserLocal occ' (idUnique id) ty' noSrcSpan
                                `setIdInfo` vanillaIdInfo
        var_env'          = extendVarEnv var_env id id'
     in