summaryrefslogtreecommitdiff
path: root/compiler/basicTypes
diff options
context:
space:
mode:
authorIan Lynagh <ian@well-typed.com>2012-10-09 15:59:15 +0100
committerIan Lynagh <ian@well-typed.com>2012-10-09 15:59:15 +0100
commitf89ce062078fcf88d7d806394442f9f4abaeab27 (patch)
tree9b94a1ee5ecef7ce82e026363091529d57cd0633 /compiler/basicTypes
parentef786b6cbc5f67a673bf8c10be5311317c1e7b88 (diff)
downloadhaskell-f89ce062078fcf88d7d806394442f9f4abaeab27.tar.gz
Make the -dsuppress-* flags dynamic
Diffstat (limited to 'compiler/basicTypes')
-rw-r--r--compiler/basicTypes/Name.lhs24
-rw-r--r--compiler/basicTypes/OccName.lhs8
-rw-r--r--compiler/basicTypes/Var.lhs4
3 files changed, 20 insertions, 16 deletions
diff --git a/compiler/basicTypes/Name.lhs b/compiler/basicTypes/Name.lhs
index de8bd7dae7..76018614bf 100644
--- a/compiler/basicTypes/Name.lhs
+++ b/compiler/basicTypes/Name.lhs
@@ -88,7 +88,7 @@ import Unique
import Util
import Maybes
import Binary
-import StaticFlags
+import DynFlags
import FastTypes
import FastString
import Outputable
@@ -465,8 +465,10 @@ pprExternal sty uniq mod occ name is_wired is_builtin
| BuiltInSyntax <- is_builtin = ppr_occ_name occ -- Never qualify builtin syntax
| otherwise = pprModulePrefix sty mod name <> ppr_occ_name occ
where
- pp_mod | opt_SuppressModulePrefixes = empty
- | otherwise = ppr mod <> dot
+ pp_mod = sdocWithDynFlags $ \dflags ->
+ if dopt Opt_SuppressModulePrefixes dflags
+ then empty
+ else ppr mod <> dot
pprInternal :: PprStyle -> Unique -> OccName -> SDoc
pprInternal sty uniq occ
@@ -493,11 +495,11 @@ pprSystem sty uniq occ
pprModulePrefix :: PprStyle -> Module -> Name -> SDoc
-- Print the "M." part of a name, based on whether it's in scope or not
-- See Note [Printing original names] in HscTypes
-pprModulePrefix sty mod name
- | opt_SuppressModulePrefixes = empty
-
- | otherwise
- = case qualName sty name of -- See Outputable.QualifyName:
+pprModulePrefix sty mod name = sdocWithDynFlags $ \dflags ->
+ if dopt Opt_SuppressModulePrefixes dflags
+ then empty
+ else
+ case qualName sty name of -- See Outputable.QualifyName:
NameQual modname -> ppr modname <> dot -- Name is in scope
NameNotInScope1 -> ppr mod <> dot -- Not in scope
NameNotInScope2 -> ppr (modulePackageId mod) <> colon -- Module not in
@@ -508,8 +510,10 @@ ppr_underscore_unique :: Unique -> SDoc
-- Print an underscore separating the name from its unique
-- But suppress it if we aren't printing the uniques anyway
ppr_underscore_unique uniq
- | opt_SuppressUniques = empty
- | otherwise = char '_' <> pprUnique uniq
+ = sdocWithDynFlags $ \dflags ->
+ if dopt Opt_SuppressUniques dflags
+ then empty
+ else char '_' <> pprUnique uniq
ppr_occ_name :: OccName -> SDoc
ppr_occ_name occ = ftext (occNameFS occ)
diff --git a/compiler/basicTypes/OccName.lhs b/compiler/basicTypes/OccName.lhs
index a162040d13..74fbeb7fff 100644
--- a/compiler/basicTypes/OccName.lhs
+++ b/compiler/basicTypes/OccName.lhs
@@ -109,12 +109,12 @@ module OccName (
import Util
import Unique
import BasicTypes
+import DynFlags
import UniqFM
import UniqSet
import FastString
import Outputable
import Binary
-import StaticFlags( opt_SuppressUniques )
import Data.Char
import Data.Data
\end{code}
@@ -271,8 +271,10 @@ pprOccName (OccName sp occ)
pp_debug sty | debugStyle sty = braces (pprNameSpaceBrief sp)
| otherwise = empty
- pp_occ | opt_SuppressUniques = text (strip_th_unique (unpackFS occ))
- | otherwise = ftext occ
+ pp_occ = sdocWithDynFlags $ \dflags ->
+ if dopt Opt_SuppressUniques dflags
+ then text (strip_th_unique (unpackFS occ))
+ else ftext occ
-- See Note [Suppressing uniques in OccNames]
strip_th_unique ('[' : c : _) | isAlphaNum c = []
diff --git a/compiler/basicTypes/Var.lhs b/compiler/basicTypes/Var.lhs
index c6e743fbb3..42c0e7f026 100644
--- a/compiler/basicTypes/Var.lhs
+++ b/compiler/basicTypes/Var.lhs
@@ -86,8 +86,6 @@ import FastTypes
import FastString
import Outputable
--- import StaticFlags ( opt_SuppressVarKinds )
-
import Data.Data
\end{code}
@@ -217,7 +215,7 @@ After CoreTidy, top-level LocalIds are turned into GlobalIds
instance Outputable Var where
ppr var = ppr (varName var) <+> ifPprDebug (brackets (ppr_debug var))
-- Printing the type on every occurrence is too much!
--- <+> if (not opt_SuppressVarKinds)
+-- <+> if (not (dopt Opt_SuppressVarKinds dflags))
-- then ifPprDebug (text "::" <+> ppr (tyVarKind var) <+> text ")")
-- else empty