Skip to content

Commit

Permalink
Tidy up pretty-printing of InlinePragma
Browse files Browse the repository at this point in the history
We were getting "INLINEALWAYS" printed out here and there.
Now there are always brackets around the activation, thus "INLINE[ALWAYS]"
  • Loading branch information
simonpj@microsoft.com committed Mar 9, 2010
1 parent 7effbbb commit 0ccb37a
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions compiler/basicTypes/BasicTypes.lhs
Expand Up @@ -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)
Expand All @@ -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
Expand Down

0 comments on commit 0ccb37a

Please sign in to comment.