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