diff options
author | romes <rodrigo.m.mesquita@gmail.com> | 2022-05-22 21:05:32 +0200 |
---|---|---|
committer | romes <rodrigo.m.mesquita@gmail.com> | 2022-05-26 16:27:57 +0000 |
commit | 44bb71115bcf1edaee82fc75cbe07a3e242e9476 (patch) | |
tree | c850a97d6279f5a94b9ffab97bca24df9df5e142 /utils | |
parent | d0e4355af8c936a3ba831ecf6afa62b06475069f (diff) | |
download | haskell-44bb71115bcf1edaee82fc75cbe07a3e242e9476.tar.gz |
TTG: Move MatchGroup Origin field and MatchGroupTc to GHC.Hswip/romes/ttg-matchgroup-origin
Diffstat (limited to 'utils')
-rw-r--r-- | utils/check-exact/ExactPrint.hs | 6 | ||||
-rw-r--r-- | utils/check-exact/Main.hs | 2 | ||||
-rw-r--r-- | utils/check-exact/Transform.hs | 18 |
3 files changed, 13 insertions, 13 deletions
diff --git a/utils/check-exact/ExactPrint.hs b/utils/check-exact/ExactPrint.hs index bda1647ccd..b52aa18de9 100644 --- a/utils/check-exact/ExactPrint.hs +++ b/utils/check-exact/ExactPrint.hs @@ -1890,7 +1890,7 @@ instance ExactPrint (HsExpr GhcPs) where NoSourceText -> withPpr x exact (HsLit _an lit) = withPpr lit - exact (HsLam _ (MG _ (L _ [match]) _)) = do + exact (HsLam _ (MG _ (L _ [match]))) = do markAnnotated match -- markExpr _ (HsLam _ (MG _ (L _ [match]) _)) = do -- setContext (Set.singleton LambdaExpr) $ do @@ -2205,13 +2205,13 @@ instance ExactPrint (HsSplice GhcPs) where -- TODO:AZ: combine these instances instance ExactPrint (MatchGroup GhcPs (LocatedA (HsExpr GhcPs))) where getAnnotationEntry = const NoEntryVal - exact (MG _ matches _) = do + exact (MG _ matches) = do -- TODO:AZ use SortKey, in MG ann. markAnnotated matches instance ExactPrint (MatchGroup GhcPs (LocatedA (HsCmd GhcPs))) where getAnnotationEntry = const NoEntryVal - exact (MG _ matches _) = do + exact (MG _ matches) = do -- TODO:AZ use SortKey, in MG ann. markAnnotated matches diff --git a/utils/check-exact/Main.hs b/utils/check-exact/Main.hs index 46e68d638a..f017233da5 100644 --- a/utils/check-exact/Main.hs +++ b/utils/check-exact/Main.hs @@ -692,7 +692,7 @@ addLocaLDecl6 libdir lp = do [de1'',d2] <- balanceCommentsList decls0 let de1 = captureMatchLineSpacing de1'' - let L _ (ValD _ (FunBind _ _ (MG _ (L _ ms) _) _)) = de1 + let L _ (ValD _ (FunBind _ _ (MG _ (L _ ms)) _)) = de1 let [ma1,_ma2] = ms (de1',_) <- modifyValD (getLocA ma1) de1 $ \_m decls -> do diff --git a/utils/check-exact/Transform.hs b/utils/check-exact/Transform.hs index d6ea9a627d..fec7a32068 100644 --- a/utils/check-exact/Transform.hs +++ b/utils/check-exact/Transform.hs @@ -263,8 +263,8 @@ captureOrder ls = AnnSortKey $ map (rs . getLocA) ls -- --------------------------------------------------------------------- captureMatchLineSpacing :: LHsDecl GhcPs -> LHsDecl GhcPs -captureMatchLineSpacing (L l (ValD x (FunBind a b (MG c (L d ms ) e) f))) - = L l (ValD x (FunBind a b (MG c (L d ms') e) f)) +captureMatchLineSpacing (L l (ValD x (FunBind a b (MG c (L d ms )) f))) + = L l (ValD x (FunBind a b (MG c (L d ms')) f)) where ms' :: [LMatch GhcPs (LHsExpr GhcPs)] ms' = captureLineSpacing ms @@ -447,8 +447,8 @@ getEntryDP anns ast = -- --------------------------------------------------------------------- setEntryDPDecl :: LHsDecl GhcPs -> DeltaPos -> LHsDecl GhcPs -setEntryDPDecl decl@(L _ (ValD x (FunBind a b (MG c (L d ms ) e) f))) dp - = L l' (ValD x (FunBind a b (MG c (L d ms') e) f)) +setEntryDPDecl decl@(L _ (ValD x (FunBind a b (MG c (L d ms )) f))) dp + = L l' (ValD x (FunBind a b (MG c (L d ms')) f)) where L l' _ = setEntryDP' decl dp ms' :: [LMatch GhcPs (LHsExpr GhcPs)] @@ -552,8 +552,8 @@ transferEntryDP' la lb = do pushDeclDP :: HsDecl GhcPs -> DeltaPos -> HsDecl GhcPs -pushDeclDP (ValD x (FunBind a b (MG c (L d ms ) e) f)) dp - = ValD x (FunBind a b (MG c (L d' ms') e) f) +pushDeclDP (ValD x (FunBind a b (MG c (L d ms )) f)) dp + = ValD x (FunBind a b (MG c (L d' ms')) f) where L d' _ = setEntryDP' (L d ms) dp ms' :: [LMatch GhcPs (LHsExpr GhcPs)] @@ -623,7 +623,7 @@ balanceComments first second = do -- 'Match' if that 'Match' needs to be manipulated. balanceCommentsFB :: (Monad m) => LHsBind GhcPs -> LocatedA b -> TransformT m (LHsBind GhcPs, LocatedA b) -balanceCommentsFB (L lf (FunBind x n (MG mx (L lm matches) o) t)) second = do +balanceCommentsFB (L lf (FunBind x n (MG o (L lm matches)) t)) second = do logTr $ "balanceCommentsFB entered: " ++ showGhc (ss2range $ locA lf) -- There are comments on lf. We need to -- + Keep the prior ones here @@ -655,7 +655,7 @@ balanceCommentsFB (L lf (FunBind x n (MG mx (L lm matches) o) t)) second = do _ -> (m'',lf') logTr $ "balanceCommentsMatch done" -- return (L lf'' (FunBind x n (MG mx (L lm (reverse (m''':ms))) o) t), second') - balanceComments' (L lf'' (FunBind x n (MG mx (L lm (reverse (m''':ms))) o) t)) second' + balanceComments' (L lf'' (FunBind x n (MG o (L lm (reverse (m''':ms)))) t)) second' balanceCommentsFB f s = balanceComments' f s -- | Move comments on the same line as the end of the match into the @@ -1372,7 +1372,7 @@ hsDeclsGeneric t = q t -- --------------------------------- lhsbind :: (Monad m) => LHsBind GhcPs -> TransformT m [LHsDecl GhcPs] - lhsbind (L _ (FunBind _ _ (MG _ (L _ matches) _) _)) = do + lhsbind (L _ (FunBind _ _ (MG _ (L _ matches)) _)) = do dss <- mapM hsDecls matches return (concat dss) lhsbind p@(L _ (PatBind{})) = do |