diff options
author | Alan Zimmerman <alan.zimm@gmail.com> | 2021-05-09 15:19:45 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-05-11 05:36:02 -0400 |
commit | 32367cac4e586fb5aedaa021b257388392d976c4 (patch) | |
tree | 059b555f27488b9d80bcd2fb566bc1d8969f7579 /utils/check-exact/ExactPrint.hs | |
parent | 087ac4ebee39bacd90529cab0e88af85a903448b (diff) | |
download | haskell-32367cac4e586fb5aedaa021b257388392d976c4.tar.gz |
EPA: Use custom AnnsIf structure for HsIf and HsCmdIf
This clearly identifies the presence and location of optional
semicolons in an if statement.
Closes #19813
Diffstat (limited to 'utils/check-exact/ExactPrint.hs')
-rw-r--r-- | utils/check-exact/ExactPrint.hs | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/utils/check-exact/ExactPrint.hs b/utils/check-exact/ExactPrint.hs index 3680405a0a..5047346111 100644 --- a/utils/check-exact/ExactPrint.hs +++ b/utils/check-exact/ExactPrint.hs @@ -1907,11 +1907,13 @@ instance ExactPrint (HsExpr GhcPs) where -- exact x@(HsCase EpAnnNotUsed _ _) = withPpr x exact (HsIf an e1 e2 e3) = do - markEpAnn an AnnIf + markAnnKw an aiIf AnnIf markAnnotated e1 - markEpAnn an AnnThen + markAnnKwM an aiThenSemi AnnSemi + markAnnKw an aiThen AnnThen markAnnotated e2 - markEpAnn an AnnElse + markAnnKwM an aiElseSemi AnnSemi + markAnnKw an aiElse AnnElse markAnnotated e3 exact (HsMultiIf an mg) = do @@ -2399,6 +2401,16 @@ instance ExactPrint (HsCmd GhcPs) where -- mark GHC.AnnElse -- markLocated e3 + exact (HsCmdIf an _ e1 e2 e3) = do + markAnnKw an aiIf AnnIf + markAnnotated e1 + markAnnKwM an aiThenSemi AnnSemi + markAnnKw an aiThen AnnThen + markAnnotated e2 + markAnnKwM an aiElseSemi AnnSemi + markAnnKw an aiElse AnnElse + markAnnotated e3 + -- markAST _ (GHC.HsCmdLet _ (GHC.L _ binds) e) = do -- mark GHC.AnnLet -- markOptional GHC.AnnOpenC |