1
1
mirror of https://github.com/google/ormolu.git synced 2024-12-02 23:43:34 +03:00

Drop ‘normalizePragma’

AFAIU it's not used anymore because we handle LANGUAGE pragmas specially
while all other pragmas are parsed properly and do not end up as comments.
This commit is contained in:
mrkkrp 2019-07-05 21:04:46 +02:00
parent 875c79d88d
commit 94ef8f4f75
No known key found for this signature in database
GPG Key ID: 8564658B2889FF7C

View File

@ -56,8 +56,7 @@ mkCommentStream extraComments pstate =
-- NOTE It's easier to normalize pragmas right when we construct comment
-- streams. Because this way we need to do it only once and when we
-- perform checking later they'll automatically match.
mkComment . fmap normalizePragma
<$> sortOn (realSrcSpanStart . getLoc) comments
mkComment <$> sortOn (realSrcSpanStart . getLoc) comments
, S.unions exts
)
where
@ -85,14 +84,6 @@ showCommentStream (CommentStream xs) = unlines $
----------------------------------------------------------------------------
-- Helpers
-- | Normalize pragmas by deleting extra white space.
normalizePragma :: String -> String
normalizePragma x =
if "{-#" `isPrefixOf` x
then unwords (words x)
else x
-- | Normalize comment string. Sometimes one multi-line comment is turned
-- into several lines for subsequent outputting with correct indentation for
-- each line.