summaryrefslogtreecommitdiff
path: root/utils/check-exact/ExactPrint.hs
diff options
context:
space:
mode:
authorGHC GitLab CI <ghc-ci@gitlab-haskell.org>2021-03-23 08:32:31 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-03-25 04:53:16 -0400
commit1350a5cd730f1cbbe306b849def26bfcd119c103 (patch)
tree45c8b4ef2cd4b09d6f9a24da905a1be5ff5ee616 /utils/check-exact/ExactPrint.hs
parent0029df2bd52aa7f93e2254a369428e4261e5d3ae (diff)
downloadhaskell-1350a5cd730f1cbbe306b849def26bfcd119c103.tar.gz
EPA : Remove ApiAnn from ParsedModule
All the comments are now captured in the AST, there is no need for a side-channel structure for them.
Diffstat (limited to 'utils/check-exact/ExactPrint.hs')
-rw-r--r--utils/check-exact/ExactPrint.hs30
1 files changed, 16 insertions, 14 deletions
diff --git a/utils/check-exact/ExactPrint.hs b/utils/check-exact/ExactPrint.hs
index 8f4f89e265..80ef0eb19c 100644
--- a/utils/check-exact/ExactPrint.hs
+++ b/utils/check-exact/ExactPrint.hs
@@ -50,17 +50,17 @@ import Types
-- ---------------------------------------------------------------------
-exactPrint :: ExactPrint ast => Located ast -> ApiAnns -> String
-exactPrint ast anns = runIdentity (runEP anns stringOptions (markAnnotated ast))
+exactPrint :: ExactPrint ast => Located ast -> String
+exactPrint ast = runIdentity (runEP stringOptions (markAnnotated ast))
type EP w m a = RWST (PrintOptions m w) (EPWriter w) EPState m a
type EPP a = EP String Identity a
-runEP :: ApiAnns -> PrintOptions Identity String
+runEP :: PrintOptions Identity String
-> Annotated () -> Identity String
-runEP anns epReader action =
+runEP epReader action =
fmap (output . snd) .
- (\next -> execRWST next epReader (defaultEPState anns))
+ (\next -> execRWST next epReader defaultEPState)
. xx $ action
xx :: Annotated () -> EP String Identity ()
@@ -69,10 +69,9 @@ xx = id
-- ---------------------------------------------------------------------
-defaultEPState :: ApiAnns -> EPState
-defaultEPState as = EPState
+defaultEPState :: EPState
+defaultEPState = EPState
{ epPos = (1,1)
- , epApiAnns = as
, dLHS = 1
, pMarkLayout = False
, pLHS = 1
@@ -80,7 +79,7 @@ defaultEPState as = EPState
, dPriorEndPosition = (1,1)
, uAnchorSpan = badRealSrcSpan
, uExtraDP = Nothing
- , epComments = rogueComments as
+ , epComments = []
}
@@ -130,9 +129,7 @@ instance Monoid w => Monoid (EPWriter w) where
mempty = EPWriter mempty
data EPState = EPState
- { epApiAnns :: !ApiAnns
-
- , uAnchorSpan :: !RealSrcSpan -- ^ in pre-changed AST
+ { uAnchorSpan :: !RealSrcSpan -- ^ in pre-changed AST
-- reference frame, from
-- Annotation
, uExtraDP :: !(Maybe Anchor) -- ^ Used to anchor a
@@ -3628,7 +3625,9 @@ instance ExactPrint (Pat GhcPs) where
-- filtered.
let pun_RDR = "pun-right-hand-side"
when (showPprUnsafe n /= pun_RDR) $ markAnnotated n
- -- | LazyPat an pat)
+ exact (LazyPat an pat) = do
+ markApiAnn an AnnTilde
+ markAnnotated pat
exact (AsPat an n pat) = do
markAnnotated n
markApiAnn an AnnAt
@@ -3638,7 +3637,10 @@ instance ExactPrint (Pat GhcPs) where
markAnnotated pat
markAnnKw an ap_close AnnCloseP
- -- | BangPat an pat)
+ exact (BangPat an pat) = do
+ markApiAnn an AnnBang
+ markAnnotated pat
+
exact (ListPat an pats) = markAnnList an (markAnnotated pats)
exact (TuplePat an pats boxity) = do