diff options
author | Alan Zimmerman <alan.zimm@gmail.com> | 2021-03-25 21:38:13 +0000 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-03-31 11:13:28 -0400 |
commit | d03005e642710d0f1f78757292e0fe65287e5f0a (patch) | |
tree | 2bd2c11a00577649ac19ddc6aa9705efa19bc8e5 /utils | |
parent | 0fe5175ac537c0ce2afe969ec82a0d1c73a4ae38 (diff) | |
download | haskell-d03005e642710d0f1f78757292e0fe65287e5f0a.tar.gz |
EPA : rename 'api annotations' to 'exact print annotations'
In comments, and notes.
Follow-up from !2418, see #19579
Diffstat (limited to 'utils')
-rw-r--r-- | utils/check-exact/ExactPrint.hs | 10 | ||||
-rw-r--r-- | utils/check-exact/Transform.hs | 10 | ||||
-rw-r--r-- | utils/check-ppr/Main.hs | 2 |
3 files changed, 8 insertions, 14 deletions
diff --git a/utils/check-exact/ExactPrint.hs b/utils/check-exact/ExactPrint.hs index 2415e73db9..e1fcc88219 100644 --- a/utils/check-exact/ExactPrint.hs +++ b/utils/check-exact/ExactPrint.hs @@ -2688,7 +2688,7 @@ instance ExactPrint (TyClDecl GhcPs) where markEpAnn an AnnCloseC where top_matter = do - annotationsToComments (apiAnnAnns an) [AnnOpenP, AnnCloseP] + annotationsToComments (epAnnAnns an) [AnnOpenP, AnnCloseP] markEpAnn an AnnClass exactVanillaDeclHead an lclas tyvars fixity context unless (null fds) $ do @@ -3282,7 +3282,7 @@ instance ExactPrint (ConDecl GhcPs) where mapM_ markAnnotated doc mapM_ markAnnotated cons markEpAnn an AnnDcolon - annotationsToComments (apiAnnAnns an) [AnnOpenP, AnnCloseP] + annotationsToComments (epAnnAnns an) [AnnOpenP, AnnCloseP] -- when has_forall $ markEpAnn an AnnForall markAnnotated bndrs -- mapM_ markAnnotated qvars @@ -4011,12 +4011,6 @@ setLayoutOffsetP c = do debugM $ "setLayoutOffsetP:" ++ show c modify (\s -> s { pLHS = c }) --- getEofPos :: (Monad m, Monoid w) => EP w m RealSrcSpan --- getEofPos = do --- as <- gets epEpAnns --- case apiAnnEofPos as of --- Nothing -> return placeholderRealSpan --- Just ss -> return ss -- --------------------------------------------------------------------- ------------------------------------------------------------------------- diff --git a/utils/check-exact/Transform.hs b/utils/check-exact/Transform.hs index 740591250c..60a059cb3c 100644 --- a/utils/check-exact/Transform.hs +++ b/utils/check-exact/Transform.hs @@ -663,7 +663,7 @@ balanceCommentsMatch (L l (Match am mctxt pats (GRHSs xg grhss binds))) = do where simpleBreak (r,_) = r /= 0 (SrcSpanAnn an1 _loc1) = l - anc1 = addCommentOrigDeltas $ apiAnnComments an1 + anc1 = addCommentOrigDeltas $ epAnnComments an1 cs1f = getFollowingComments anc1 -- (move',stay') = break simpleBreak (commentsDeltas (anchorFromLocatedA (L l ())) cs1f) (move',stay') = break simpleBreak (trailingCommentsDeltas (anchorFromLocatedA (L l ())) cs1f) @@ -734,8 +734,8 @@ balanceComments' la1 la2 = do simpleBreak n (r,_) = r > n L (SrcSpanAnn an1 loc1) f = la1 L (SrcSpanAnn an2 loc2) s = la2 - anc1 = addCommentOrigDeltas $ apiAnnComments an1 - anc2 = addCommentOrigDeltas $ apiAnnComments an2 + anc1 = addCommentOrigDeltas $ epAnnComments an1 + anc2 = addCommentOrigDeltas $ epAnnComments an2 cs1f = getFollowingComments anc1 cs2b = priorComments anc2 (stay'',move') = break (simpleBreak 1) (priorCommentsDeltas (anchorFromLocatedA la2) cs2b) @@ -854,7 +854,7 @@ balanceSameLineComments (L la (Match anm mctxt pats (GRHSs x grhss lb))) = do (L lg (GRHS ga gs rhs):grs) -> (la'',reverse $ (L lg (GRHS ga' gs rhs)):grs,[(gac,(csp,csf))]) where (SrcSpanAnn an1 _loc1) = la - anc1 = addCommentOrigDeltas $ apiAnnComments an1 + anc1 = addCommentOrigDeltas $ epAnnComments an1 (EpAnn anc an _) = ga :: EpAnn' GrhsAnn (csp,csf) = case anc1 of AnnComments cs -> ([],cs) @@ -864,7 +864,7 @@ balanceSameLineComments (L la (Match anm mctxt pats (GRHSs x grhss lb))) = do stay = map snd stay' cs1 = AnnCommentsBalanced csp stay - gac = addCommentOrigDeltas $ apiAnnComments ga + gac = addCommentOrigDeltas $ epAnnComments ga gfc = getFollowingComments gac gac' = setFollowingComments gac (sort $ gfc ++ move) ga' = (EpAnn anc an gac') diff --git a/utils/check-ppr/Main.hs b/utils/check-ppr/Main.hs index 7a36446807..c08f6e755d 100644 --- a/utils/check-ppr/Main.hs +++ b/utils/check-ppr/Main.hs @@ -106,7 +106,7 @@ getPragmas (L _ (HsModule { hsmodAnn = anns'})) = pragmaStr tokComment _ = "" cmp (L l1 _) (L l2 _) = compare (anchor l1) (anchor l2) - comments' = map tokComment $ sortBy cmp $ priorComments $ apiAnnComments anns' + comments' = map tokComment $ sortBy cmp $ priorComments $ epAnnComments anns' pragmas = filter (\c -> isPrefixOf "{-#" c ) comments' pragmaStr = intercalate "\n" pragmas |