X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2FbasicTypes%2FUnique.lhs;h=396feeab11879a781e014e7712c45fff89253646;hp=1ef0ca85909fab053fdf9328cc38f8f6343a4396;hb=b2524b3960999fffdb3767900f58825903f6560f;hpb=388e3356f71daffa62f1d4157e1e07e4c68f218a diff --git a/compiler/basicTypes/Unique.lhs b/compiler/basicTypes/Unique.lhs index 1ef0ca8..396feea 100644 --- a/compiler/basicTypes/Unique.lhs +++ b/compiler/basicTypes/Unique.lhs @@ -16,6 +16,7 @@ Some of the other hair in this code is to be able to use a Haskell). \begin{code} +{-# LANGUAGE BangPatterns #-} module Unique ( -- * Main data types Unique, Uniquable(..), @@ -62,7 +63,7 @@ import BasicTypes import FastTypes import FastString import Outputable -import StaticFlags +-- import StaticFlags #if defined(__GLASGOW_HASKELL__) --just for implementing a fast [0,61) -> Char function @@ -215,9 +216,9 @@ We do sometimes make strings with @Uniques@ in them: \begin{code} pprUnique :: Unique -> SDoc pprUnique uniq - | opt_SuppressUniques - = empty -- Used exclusively to suppress uniques so you - | otherwise -- can compare output easily +-- | opt_SuppressUniques +-- = empty -- Used exclusively to suppress uniques so you +-- | otherwise -- can compare output easily = case unpkUnique uniq of (tag, u) -> finish_ppr tag u (text (iToBase62 u)) @@ -368,9 +369,14 @@ mkRegSubUnique = mkUnique 'S' mkRegPairUnique = mkUnique 'P' mkRegClassUnique = mkUnique 'L' -mkVarOccUnique, mkDataOccUnique, mkTvOccUnique, mkTcOccUnique :: FastString -> Unique +mkVarOccUnique :: FastString -> Int -> Unique +mkVarOccUnique fs depth = + if depth > 255 + then error "FIXME: no support for syntactic depth > 255" + else mkUnique 'i' ((iBox (uniqueOfFS fs)) * 8 + depth ) + +mkDataOccUnique, mkTvOccUnique, mkTcOccUnique :: FastString -> Unique -- See Note [The Unique of an OccName] in OccName -mkVarOccUnique fs = mkUnique 'i' (iBox (uniqueOfFS fs)) mkDataOccUnique fs = mkUnique 'd' (iBox (uniqueOfFS fs)) mkTvOccUnique fs = mkUnique 'v' (iBox (uniqueOfFS fs)) mkTcOccUnique fs = mkUnique 'c' (iBox (uniqueOfFS fs))