diff options
author | Alan Zimmerman <alan.zimm@gmail.com> | 2021-03-25 21:46:56 +0000 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-03-31 11:13:28 -0400 |
commit | 49bc1e9ec854e571dfa78ac43565073586579f31 (patch) | |
tree | 4cf1ea1b7f53581ae57a493ba757cf1130585a03 /utils | |
parent | d03005e642710d0f1f78757292e0fe65287e5f0a (diff) | |
download | haskell-49bc1e9ec854e571dfa78ac43565073586579f31.tar.gz |
EPA : rename AnnAnchor to EpaAnchor
Follow-up from !2418, see #19579
Diffstat (limited to 'utils')
-rw-r--r-- | utils/check-exact/ExactPrint.hs | 16 | ||||
-rw-r--r-- | utils/check-exact/Transform.hs | 18 | ||||
-rw-r--r-- | utils/check-exact/Utils.hs | 2 |
3 files changed, 18 insertions, 18 deletions
diff --git a/utils/check-exact/ExactPrint.hs b/utils/check-exact/ExactPrint.hs index e1fcc88219..30f71bdbc8 100644 --- a/utils/check-exact/ExactPrint.hs +++ b/utils/check-exact/ExactPrint.hs @@ -439,12 +439,12 @@ printStringAtSs ss str = printStringAtKw' (realSrcSpan ss) str -- --------------------------------------------------------------------- -- AZ:TODO get rid of this -printStringAtMkw :: Maybe AnnAnchor -> String -> EPP () +printStringAtMkw :: Maybe EpaAnchor -> String -> EPP () printStringAtMkw (Just aa) s = printStringAtAA aa s printStringAtMkw Nothing s = printStringAtLsDelta (DP 0 1) s -printStringAtAA :: AnnAnchor -> String -> EPP () +printStringAtAA :: EpaAnchor -> String -> EPP () printStringAtAA (AR r) s = printStringAtKw' r s printStringAtAA (AD d) s = do pe <- getPriorEndD @@ -525,7 +525,7 @@ markAnnOpen :: EpAnn -> SourceText -> String -> EPP () markAnnOpen an NoSourceText txt = markLocatedAALS an id AnnOpen (Just txt) markAnnOpen an (SourceText txt) _ = markLocatedAALS an id AnnOpen (Just txt) -markAnnOpen' :: Maybe AnnAnchor -> SourceText -> String -> EPP () +markAnnOpen' :: Maybe EpaAnchor -> SourceText -> String -> EPP () markAnnOpen' ms NoSourceText txt = printStringAtMkw ms txt markAnnOpen' ms (SourceText txt) _ = printStringAtMkw ms txt @@ -544,15 +544,15 @@ markParen (EpAnn _ (AnnParen pt o c) _) f = markKwA (f $ kw pt) (f (o, c)) kw AnnParensSquare = (AnnOpenS, AnnCloseS) -markAnnKw :: EpAnn' a -> (a -> AnnAnchor) -> AnnKeywordId -> EPP () +markAnnKw :: EpAnn' a -> (a -> EpaAnchor) -> AnnKeywordId -> EPP () markAnnKw EpAnnNotUsed _ _ = return () markAnnKw (EpAnn _ a _) f kw = markKwA kw (f a) -markAnnKwAll :: EpAnn' a -> (a -> [AnnAnchor]) -> AnnKeywordId -> EPP () +markAnnKwAll :: EpAnn' a -> (a -> [EpaAnchor]) -> AnnKeywordId -> EPP () markAnnKwAll EpAnnNotUsed _ _ = return () markAnnKwAll (EpAnn _ a _) f kw = mapM_ (markKwA kw) (sort (f a)) -markAnnKwM :: EpAnn' a -> (a -> Maybe AnnAnchor) -> AnnKeywordId -> EPP () +markAnnKwM :: EpAnn' a -> (a -> Maybe EpaAnchor) -> AnnKeywordId -> EPP () markAnnKwM EpAnnNotUsed _ _ = return () markAnnKwM (EpAnn _ a _) f kw = go (f a) where @@ -598,7 +598,7 @@ markKw :: AddEpAnn -> EPP () markKw (AddEpAnn kw ss) = markKwA kw ss -- | This should be the main driver of the process, managing comments -markKwA :: AnnKeywordId -> AnnAnchor -> EPP () +markKwA :: AnnKeywordId -> EpaAnchor -> EPP () markKwA kw aa = printStringAtAA aa (keywordToString (G kw)) -- --------------------------------------------------------------------- @@ -3184,7 +3184,7 @@ instance ExactPrint (LocatedN RdrName) where markTrailing t markName :: NameAdornment - -> AnnAnchor -> Maybe (AnnAnchor,RdrName) -> AnnAnchor -> EPP () + -> EpaAnchor -> Maybe (EpaAnchor,RdrName) -> EpaAnchor -> EPP () markName adorn open mname close = do let (kwo,kwc) = adornments adorn markKw (AddEpAnn kwo open) diff --git a/utils/check-exact/Transform.hs b/utils/check-exact/Transform.hs index 60a059cb3c..210f873a20 100644 --- a/utils/check-exact/Transform.hs +++ b/utils/check-exact/Transform.hs @@ -502,13 +502,13 @@ setEntryDP _ast _dp anns = anns -- --------------------------------------------------------------------- -addAnnAnchorDelta :: LayoutStartCol -> RealSrcSpan -> AnnAnchor -> AnnAnchor -addAnnAnchorDelta _off _anc (AD d) = AD d -addAnnAnchorDelta off anc (AR r) +addEpaAnchorDelta :: LayoutStartCol -> RealSrcSpan -> EpaAnchor -> EpaAnchor +addEpaAnchorDelta _off _anc (AD d) = AD d +addEpaAnchorDelta off anc (AR r) = AD (adjustDeltaForOffset 0 off (ss2deltaEnd anc r)) -- Set the entry DP for an element coming after an existing keyword annotation -setEntryDPFromAnchor :: LayoutStartCol -> AnnAnchor -> LocatedA t -> LocatedA t +setEntryDPFromAnchor :: LayoutStartCol -> EpaAnchor -> LocatedA t -> LocatedA t setEntryDPFromAnchor _off (AD _) (L la a) = L la a setEntryDPFromAnchor off (AR anc) ll@(L la _) = setEntryDP' ll dp' where @@ -957,13 +957,13 @@ noAnnSrcSpanDP1 l = noAnnSrcSpanDP l (DP 0 1) noAnnSrcSpanDPn :: (Monoid ann) => SrcSpan -> Int -> SrcSpanAnn' (EpAnn' ann) noAnnSrcSpanDPn l s = noAnnSrcSpanDP l (DP 0 s) -d0 :: AnnAnchor +d0 :: EpaAnchor d0 = AD $ DP 0 0 -d1 :: AnnAnchor +d1 :: EpaAnchor d1 = AD $ DP 0 1 -dn :: Int -> AnnAnchor +dn :: Int -> EpaAnchor dn n = AD $ DP 0 n m0 :: AnchorOperation @@ -1131,7 +1131,7 @@ instance HasDecls (LocatedA (HsExpr GhcPs)) where newDecls'' = case newDecls of [] -> newDecls (d:ds) -> setEntryDPDecl d (DP 0 0) : ds - in ( EpAnn a (AnnsLet l (addAnnAnchorDelta off lastAnc i)) cs + in ( EpAnn a (AnnsLet l (addEpaAnchorDelta off lastAnc i)) cs , ex'' , newDecls'') binds' <- replaceDeclsValbinds WithoutWhere binds newDecls' @@ -1414,7 +1414,7 @@ oldWhereAnnotation EpAnnNotUsed ww _oldSpan = do noCom return an oldWhereAnnotation (EpAnn anc an cs) ww _oldSpan = do - -- TODO: when we set DP (0,0) for the HsValBinds EpAnnAnchor, change the AnnList anchor to have the correct DP too + -- TODO: when we set DP (0,0) for the HsValBinds EpEpaAnchor, change the AnnList anchor to have the correct DP too let (AnnList ancl o c _r t) = an let w = case ww of WithWhere -> [AddEpAnn AnnWhere (AD (DP 0 0))] diff --git a/utils/check-exact/Utils.hs b/utils/check-exact/Utils.hs index f309c103a3..57dab9d95c 100644 --- a/utils/check-exact/Utils.hs +++ b/utils/check-exact/Utils.hs @@ -283,7 +283,7 @@ normaliseCommentText ('\r':xs) = normaliseCommentText xs normaliseCommentText (x:xs) = x:normaliseCommentText xs -- | Makes a comment which originates from a specific keyword. -mkKWComment :: AnnKeywordId -> AnnAnchor -> Comment +mkKWComment :: AnnKeywordId -> EpaAnchor -> Comment mkKWComment kw (AR ss) = Comment (keywordToString $ G kw) (Anchor ss UnchangedAnchor) (Just kw) mkKWComment kw (AD dp) |