Comment out unused definitions
parent
eccd2debb0
commit
acdc30c227
|
@ -213,45 +213,45 @@ commentAnnFixTransformGlob ast = do
|
|||
-- moveTrailingComments lexpr (List.last fs)
|
||||
-- _ -> return ()
|
||||
|
||||
commentAnnFixTransform :: GHC.ParsedSource -> ExactPrint.Transform ()
|
||||
commentAnnFixTransform modul = SYB.everything (>>) genF modul
|
||||
where
|
||||
genF :: Data.Data.Data a => a -> ExactPrint.Transform ()
|
||||
genF = (\_ -> return ()) `SYB.extQ` exprF
|
||||
exprF :: Located (HsExpr GhcPs) -> ExactPrint.Transform ()
|
||||
exprF lexpr@(L _ expr) = case expr of
|
||||
RecordCon _ _ (HsRecFields fs@(_:_) Nothing) ->
|
||||
moveTrailingComments lexpr (List.last fs)
|
||||
RecordUpd _ _e fs@(_:_) ->
|
||||
moveTrailingComments lexpr (List.last fs)
|
||||
_ -> return ()
|
||||
-- commentAnnFixTransform :: GHC.ParsedSource -> ExactPrint.Transform ()
|
||||
-- commentAnnFixTransform modul = SYB.everything (>>) genF modul
|
||||
-- where
|
||||
-- genF :: Data.Data.Data a => a -> ExactPrint.Transform ()
|
||||
-- genF = (\_ -> return ()) `SYB.extQ` exprF
|
||||
-- exprF :: Located (HsExpr GhcPs) -> ExactPrint.Transform ()
|
||||
-- exprF lexpr@(L _ expr) = case expr of
|
||||
-- RecordCon _ _ (HsRecFields fs@(_:_) Nothing) ->
|
||||
-- moveTrailingComments lexpr (List.last fs)
|
||||
-- RecordUpd _ _e fs@(_:_) ->
|
||||
-- moveTrailingComments lexpr (List.last fs)
|
||||
-- _ -> return ()
|
||||
|
||||
moveTrailingComments :: (Data.Data.Data a,Data.Data.Data b)
|
||||
=> GHC.Located a -> GHC.Located b -> ExactPrint.Transform ()
|
||||
moveTrailingComments astFrom astTo = do
|
||||
let
|
||||
k1 = ExactPrint.mkAnnKey astFrom
|
||||
k2 = ExactPrint.mkAnnKey astTo
|
||||
moveComments ans = ans'
|
||||
where
|
||||
an1 = Data.Maybe.fromJust $ Map.lookup k1 ans
|
||||
an2 = Data.Maybe.fromJust $ Map.lookup k2 ans
|
||||
cs1f = ExactPrint.annFollowingComments an1
|
||||
cs2f = ExactPrint.annFollowingComments an2
|
||||
(comments, nonComments) = flip breakEither (ExactPrint.annsDP an1)
|
||||
$ \case
|
||||
(ExactPrint.AnnComment com, dp) -> Left (com, dp)
|
||||
x -> Right x
|
||||
an1' = an1
|
||||
{ ExactPrint.annsDP = nonComments
|
||||
, ExactPrint.annFollowingComments = []
|
||||
}
|
||||
an2' = an2
|
||||
{ ExactPrint.annFollowingComments = cs1f ++ cs2f ++ comments
|
||||
}
|
||||
ans' = Map.insert k1 an1' $ Map.insert k2 an2' ans
|
||||
-- moveTrailingComments :: (Data.Data.Data a,Data.Data.Data b)
|
||||
-- => GHC.Located a -> GHC.Located b -> ExactPrint.Transform ()
|
||||
-- moveTrailingComments astFrom astTo = do
|
||||
-- let
|
||||
-- k1 = ExactPrint.mkAnnKey astFrom
|
||||
-- k2 = ExactPrint.mkAnnKey astTo
|
||||
-- moveComments ans = ans'
|
||||
-- where
|
||||
-- an1 = Data.Maybe.fromJust $ Map.lookup k1 ans
|
||||
-- an2 = Data.Maybe.fromJust $ Map.lookup k2 ans
|
||||
-- cs1f = ExactPrint.annFollowingComments an1
|
||||
-- cs2f = ExactPrint.annFollowingComments an2
|
||||
-- (comments, nonComments) = flip breakEither (ExactPrint.annsDP an1)
|
||||
-- $ \case
|
||||
-- (ExactPrint.AnnComment com, dp) -> Left (com, dp)
|
||||
-- x -> Right x
|
||||
-- an1' = an1
|
||||
-- { ExactPrint.annsDP = nonComments
|
||||
-- , ExactPrint.annFollowingComments = []
|
||||
-- }
|
||||
-- an2' = an2
|
||||
-- { ExactPrint.annFollowingComments = cs1f ++ cs2f ++ comments
|
||||
-- }
|
||||
-- ans' = Map.insert k1 an1' $ Map.insert k2 an2' ans
|
||||
|
||||
ExactPrint.modifyAnnsT moveComments
|
||||
-- ExactPrint.modifyAnnsT moveComments
|
||||
|
||||
-- | split a set of annotations in a module into a map from top-level module
|
||||
-- elements to the relevant annotations. Avoids quadratic behaviour a trivial
|
||||
|
|
Loading…
Reference in New Issue