summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsimonpj@microsoft.com <unknown>2010-03-09 17:27:30 +0000
committersimonpj@microsoft.com <unknown>2010-03-09 17:27:30 +0000
commit0ccb37ab2cc96f6e9cca7fe8fe0889efc13a8a69 (patch)
tree19145eeb6a7a409a86768ca9d906ddb9dd5271c0
parent7effbbbbdfe7eb05c6402fa9337e358e7e9fadde (diff)
downloadhaskell-0ccb37ab2cc96f6e9cca7fe8fe0889efc13a8a69.tar.gz
Tidy up pretty-printing of InlinePragma
We were getting "INLINEALWAYS" printed out here and there. Now there are always brackets around the activation, thus "INLINE[ALWAYS]"
-rw-r--r--compiler/basicTypes/BasicTypes.lhs18
1 files changed, 9 insertions, 9 deletions
diff --git a/compiler/basicTypes/BasicTypes.lhs b/compiler/basicTypes/BasicTypes.lhs
index 3a882a707a..4531c912c8 100644
--- a/compiler/basicTypes/BasicTypes.lhs
+++ b/compiler/basicTypes/BasicTypes.lhs
@@ -701,8 +701,8 @@ setInlinePragmaRuleMatchInfo :: InlinePragma -> RuleMatchInfo -> InlinePragma
setInlinePragmaRuleMatchInfo prag info = prag { inl_rule = info }
instance Outputable Activation where
- ppr AlwaysActive = ptext (sLit "ALWAYS")
- ppr NeverActive = ptext (sLit "NEVER")
+ ppr AlwaysActive = brackets (ptext (sLit "ALWAYS"))
+ ppr NeverActive = brackets (ptext (sLit "NEVER"))
ppr (ActiveBefore n) = brackets (char '~' <> int n)
ppr (ActiveAfter n) = brackets (int n)
@@ -713,18 +713,18 @@ instance Outputable RuleMatchInfo where
instance Outputable InlinePragma where
ppr (InlinePragma { inl_inline = inline, inl_act = activation
, inl_rule = info, inl_sat = mb_arity })
- = pp_inline <> pp_activation <+> pp_sat <+> pp_info
+ = pp_inl_act (inline, activation) <+> pp_sat <+> pp_info
where
- pp_inline | inline = ptext (sLit "INLINE")
- | otherwise = ptext (sLit "NOINLINE")
+ pp_inl_act (False, AlwaysActive) = empty -- defaultInlinePragma
+ pp_inl_act (False, NeverActive) = ptext (sLit "NOINLINE")
+ pp_inl_act (False, act) = ptext (sLit "NOINLINE") <> ppr act
+ pp_inl_act (True, AlwaysActive) = ptext (sLit "INLINE")
+ pp_inl_act (True, act) = ptext (sLit "INLINE") <> ppr act
+
pp_sat | Just ar <- mb_arity = parens (ptext (sLit "sat-args=") <> int ar)
| otherwise = empty
pp_info | isFunLike info = empty
| otherwise = ppr info
- pp_activation
- | inline && isAlwaysActive activation = empty
- | not inline && isNeverActive activation = empty
- | otherwise = ppr activation
isActive :: CompilerPhase -> Activation -> Bool
isActive _ NeverActive = False