diff options
Diffstat (limited to 'compiler/GHC/Parser/PostProcess.hs')
-rw-r--r-- | compiler/GHC/Parser/PostProcess.hs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/compiler/GHC/Parser/PostProcess.hs b/compiler/GHC/Parser/PostProcess.hs index 8a89bef84d..845f7eb25c 100644 --- a/compiler/GHC/Parser/PostProcess.hs +++ b/compiler/GHC/Parser/PostProcess.hs @@ -39,6 +39,7 @@ module GHC.Parser.PostProcess ( fromSpecTyVarBndr, fromSpecTyVarBndrs, annBinds, fixValbindsAnn, + stmtsAnchor, stmtsLoc, cvBindGroup, cvBindsAndSigs, @@ -478,6 +479,18 @@ fixValbindsAnn EpAnnNotUsed = EpAnnNotUsed fixValbindsAnn (EpAnn anchor (AnnList ma o c r t) cs) = (EpAnn (widenAnchor anchor (map trailingAnnToAddEpAnn t)) (AnnList ma o c r t) cs) +-- | The 'Anchor' for a stmtlist is based on either the location or +-- the first semicolon annotion. +stmtsAnchor :: Located (OrdList AddEpAnn,a) -> Anchor +stmtsAnchor (L l ((ConsOL (AddEpAnn _ (EpaSpan r)) _), _)) + = widenAnchorR (Anchor (realSrcSpan l) UnchangedAnchor) r +stmtsAnchor (L l _) = Anchor (realSrcSpan l) UnchangedAnchor + +stmtsLoc :: Located (OrdList AddEpAnn,a) -> SrcSpan +stmtsLoc (L l ((ConsOL aa _), _)) + = widenSpan l [aa] +stmtsLoc (L l _) = l + {- ********************************************************************** #cvBinds-etc# Converting to @HsBinds@, etc. |