summaryrefslogtreecommitdiff
path: root/utils/check-ppr
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-ppr
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-ppr')
-rw-r--r--utils/check-ppr/Main.hs9
1 files changed, 4 insertions, 5 deletions
diff --git a/utils/check-ppr/Main.hs b/utils/check-ppr/Main.hs
index f537a0085c..0973d2ccfe 100644
--- a/utils/check-ppr/Main.hs
+++ b/utils/check-ppr/Main.hs
@@ -45,8 +45,7 @@ testOneFile libdir fileName = do
$ showAstData BlankSrcSpan BlankApiAnnotations
$ eraseLayoutInfo (pm_parsed_source p)
pped = pragmas ++ "\n" ++ pp (pm_parsed_source p)
- anns' = pm_annotations p
- pragmas = getPragmas anns'
+ pragmas = getPragmas (pm_parsed_source p)
newFile = dropExtension fileName <.> "ppr" <.> takeExtension fileName
astFile = fileName <.> "ast"
@@ -98,15 +97,15 @@ parseOneFile libdir fileName = do
++ show (map (ml_hs_file . ms_location) xs)
parseModule modSum
-getPragmas :: ApiAnns -> String
-getPragmas anns' = pragmaStr
+getPragmas :: Located HsModule -> String
+getPragmas (L _ (HsModule { hsmodAnn = anns'})) = pragmaStr
where
tokComment (L _ (AnnComment (AnnBlockComment s) _)) = s
tokComment (L _ (AnnComment (AnnLineComment s) _)) = s
tokComment _ = ""
cmp (L l1 _) (L l2 _) = compare (anchor l1) (anchor l2)
- comments' = map tokComment $ sortBy cmp $ apiAnnRogueComments anns'
+ comments' = map tokComment $ sortBy cmp $ priorComments $ apiAnnComments anns'
pragmas = filter (\c -> isPrefixOf "{-#" c ) comments'
pragmaStr = intercalate "\n" pragmas