summaryrefslogtreecommitdiff
path: root/compiler/GHC/Hs/Expr.hs
diff options
context:
space:
mode:
authorAlan Zimmerman <alan.zimm@gmail.com>2021-05-09 15:19:45 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-05-11 05:36:02 -0400
commit32367cac4e586fb5aedaa021b257388392d976c4 (patch)
tree059b555f27488b9d80bcd2fb566bc1d8969f7579 /compiler/GHC/Hs/Expr.hs
parent087ac4ebee39bacd90529cab0e88af85a903448b (diff)
downloadhaskell-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 'compiler/GHC/Hs/Expr.hs')
-rw-r--r--compiler/GHC/Hs/Expr.hs13
1 files changed, 11 insertions, 2 deletions
diff --git a/compiler/GHC/Hs/Expr.hs b/compiler/GHC/Hs/Expr.hs
index f812c66540..3cff120713 100644
--- a/compiler/GHC/Hs/Expr.hs
+++ b/compiler/GHC/Hs/Expr.hs
@@ -288,7 +288,7 @@ type instance XCase GhcPs = EpAnn EpAnnHsCase
type instance XCase GhcRn = NoExtField
type instance XCase GhcTc = NoExtField
-type instance XIf GhcPs = EpAnn [AddEpAnn]
+type instance XIf GhcPs = EpAnn AnnsIf
type instance XIf GhcRn = NoExtField
type instance XIf GhcTc = NoExtField
@@ -388,6 +388,15 @@ data AnnProjection
apClose :: EpaLocation -- ^ ')'
} deriving Data
+data AnnsIf
+ = AnnsIf {
+ aiIf :: EpaLocation,
+ aiThen :: EpaLocation,
+ aiElse :: EpaLocation,
+ aiThenSemi :: Maybe EpaLocation,
+ aiElseSemi :: Maybe EpaLocation
+ } deriving Data
+
-- ---------------------------------------------------------------------
type instance XSCC (GhcPass _) = EpAnn AnnPragma
@@ -1039,7 +1048,7 @@ type instance XCmdCase GhcTc = NoExtField
type instance XCmdLamCase (GhcPass _) = EpAnn [AddEpAnn]
-type instance XCmdIf GhcPs = EpAnn [AddEpAnn]
+type instance XCmdIf GhcPs = EpAnn AnnsIf
type instance XCmdIf GhcRn = NoExtField
type instance XCmdIf GhcTc = NoExtField